Skip to content

Conversation

@tpwrules
Copy link
Contributor

@tpwrules tpwrules commented Nov 23, 2025

This lowers the effort required to turn off just one arming check. Previously, a user had to disable the ALL bit and enable every check except the undesired one. Now they can just disable that one directly. Hopefully this will result in less vehicles with no arming checks whatsoever, presuming only one check is giving the user grief.

This, as a side effect, removes the difference between the ALL bit set and all non-ALL bits set (e.g. the latter disables IMU heater checks). It also ensures the user will get any new arming checks even if they have skipped one.

Developers who need to disable all current and future checks for e.g. bench testing can still do this efficiently by setting the parameter to -1, leveraging that this sets all bits in 2s complement arithmetic. But we will not obviously document this for users, it should be an annoyance!

A parameter conversion is included that skips no checks if the old ALL bit is set; otherwise it migrates the user's selected checks. If no checks were enabled, it disables all current and future checks.

Tested on the bench that it behaves logically. Fortunately the actual arming logic change is pretty trivial. I will write a wiki update for this change as well. Please see commit messages for various details and comments on the conversions I did in tree. Also did parameter conversion testing with the following commands:

  • python3 Tools/autotest/test_param_upgrade.py --vehicle arducopter --vehicle arduplane --vehicle ardusub --vehicle ardurover --vehicle blimp --param "ARMING_CHECK=3241->ARMING_SKIPCHK=0"
  • python3 Tools/autotest/test_param_upgrade.py --vehicle arducopter --vehicle arduplane --vehicle ardusub --vehicle ardurover --vehicle blimp --param "ARMING_CHECK=12->ARMING_SKIPCHK=2097138"
  • python3 Tools/autotest/test_param_upgrade.py --vehicle arducopter --vehicle arduplane --vehicle ardusub --vehicle ardurover --vehicle blimp --param "ARMING_CHECK=1->ARMING_SKIPCHK=0"
  • python3 Tools/autotest/test_param_upgrade.py --vehicle arducopter --vehicle arduplane --vehicle ardusub --vehicle ardurover --vehicle blimp --param "ARMING_CHECK=0->ARMING_SKIPCHK=-1"

Is it possible we could just drop the conversion (or re-enable all checks if ARMING_CHECK was 0) and make people fix their vehicles? :) decided not to

@andyp1per
Copy link
Contributor

I like this idea! Not totally convinced about the name, but the current behaviour is definitely sub-optimal

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm excited for this one!

Comment on lines +422 to +423
uint32_t(AP_Arming::Check::VOLTAGE) |
uint32_t(AP_Arming::Check::BATTERY))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should actually have a closer look at these - they may be historical and no-longer-needed

You can arm Copter without RC. Adding RC in here means you can see an RC and then lose it and still be able to arm. I don't know if that's desired behaviour

The voltage/battery checks are weird, too, as there shouldn't be a battery monitor set up by default.

@Williangalvani

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be happy to let Sub to default to all checks enabled if Willian approves.

On the other hand, doing that does break half the tests.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterbarker

The voltage/battery checks are weird, too, as there shouldn't be a battery monitor set up by default

We could use battery bit to allow user to skip arming voltage check (but maybe not low/critical) ex. for performing a lot of short missions on one battery.

You can arm Copter without RC. Adding RC in here means you can see an RC and then lose it and still be able to arm. I don't know if that's desired behaviour

That may be the case for some users ex. performing test hover prior to auto mission without RC control. This should would require 0-ing RC input state if it isn't seen when disarmed.

@IamPete1
Copy link
Member

This fixes #15326

Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be quite tempted to just skip the conversion and make people turn skip checks again manually if they really want to.

Comment on lines 35 to 36
VOLTAGE = (1U << 7),
BATTERY = (1U << 8),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now is the time to consolidate these if were doing param conversion anyway. Its not clear to me why we need both VOLTAGE and BATTERY.

BATTERY = (1U << 8),
AIRSPEED = (1U << 9),
LOGGING = (1U << 10),
SWITCH = (1U << 11),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename to SAFETY_STATE.

AIRSPEED = (1U << 9),
LOGGING = (1U << 10),
SWITCH = (1U << 11),
GPS_CONFIG = (1U << 12),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both GPS_CONFIG and GPS as separate items?

enum class Check {
ALL = (1U << 0),
// 0 used to be ALL, though it could be reused as the SKIPCHK conversion
// never sets it. check_mask would also need updating.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could shuffle everything down one. We only have a couple more before we run into float transport issues.

@rmackay9
Copy link
Contributor

As discussed Tridge and I think we should document that setting the param to -1 disables/skips all checks

Copy link
Contributor

@tridge tridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if they have ARMING_CHECK=0 and upgrade, then ARMING_SKIPCHK should be updated to -1

Was prototyped many years ago but never defined or called.
Was prototyped many years ago but never defined or called.
This is never called as the main `wscript` does not recurse into this
directory until build time. Even if it were called, it would update the
environment for all builds instead of just replay. Even if it did update
the environment, nobody reads that variable so there's no effect.
Now that we call the AP_Arming singleton's initialization method in
AP_Vehicle, we have to ensure an AP_Arming exists for all vehicles.
Otherwise we get a segfault.

This is nicer than disabling AP_ARMING_ENABLED for replay and causing a
full recompile. Also nicer than checking that the singleton is not
nullptr as this is zero overhead for all other vehicles.
This conversion was dropped for other vehicles in late 2024. This
conversion is in 4.0.0.
This conversion was dropped for other vehicles in late 2024. This
conversion is in 4.0.0.
The mentioned bug must have been fixed as the test works now without
doing any fiddling. The code never worked properly anyway, `1 ^ 25` is
nonsense and presumably should have been `1 << 25`.
In some cases the index can be more than a `uint8_t` so just use the
underlying type in the `ConversionInfo`.

This is a no compiler output change.
This lowers the effort required to turn off just one arming check.
Previously, a user had to disable the ALL bit and enable every check
except the undesired one. Now they can just disable that one directly.
Hopefully this will result in less vehicles with no arming checks
whatsoever, presuming only one check is giving the user grief.

This, as a side effect, removes the difference between the ALL bit set
and all non-ALL bits set (e.g. the latter disables IMU heater checks).
It also ensures the user will get any new arming checks even if they
have skipped one.

People who need to disable all current and future checks for e.g. bench
testing can still do this efficiently by setting the parameter to `-1`,
leveraging that this sets all bits in 2s complement arithmetic.

A parameter conversion is included that skips no checks if the old ALL
bit is set; otherwise it migrates the user's selected checks. If no
checks were enabled, it disables all current and future checks.
This lowers the effort required to turn off just one arming check.
Previously, a user had to disable the ALL bit and enable every check
except the undesired one. Now they can just disable that one directly.
Hopefully this will result in less vehicles with no arming checks
whatsoever, presuming only one check is giving the user grief.

This, as a side effect, removes the difference between the ALL bit set
and all non-ALL bits set (e.g. the latter disables IMU heater checks).
It also ensures the user will get any new arming checks even if they
have skipped one.

People who need to disable all current and future checks for e.g. bench
testing can still do this efficiently by setting the parameter to `-1`,
leveraging that this sets all bits in 2s complement arithmetic.

A parameter conversion is included that skips no checks if the old ALL
bit is set; otherwise it migrates the user's selected checks. If no
checks were enabled, it disables all current and future checks.
This lowers the effort required to turn off just one arming check.
Previously, a user had to disable the ALL bit and enable every check
except the undesired one. Now they can just disable that one directly.
Hopefully this will result in less vehicles with no arming checks
whatsoever, presuming only one check is giving the user grief.

This, as a side effect, removes the difference between the ALL bit set
and all non-ALL bits set (e.g. the latter disables IMU heater checks).
It also ensures the user will get any new arming checks even if they
have skipped one.

People who need to disable all current and future checks for e.g. bench
testing can still do this efficiently by setting the parameter to `-1`,
leveraging that this sets all bits in 2s complement arithmetic.

A parameter conversion is included that skips no checks if the old ALL
bit is set; otherwise it migrates the user's selected checks. If no
checks were enabled, it disables all current and future checks.
This lowers the effort required to turn off just one arming check.
Previously, a user had to disable the ALL bit and enable every check
except the undesired one. Now they can just disable that one directly.
Hopefully this will result in less vehicles with no arming checks
whatsoever, presuming only one check is giving the user grief.

This, as a side effect, removes the difference between the ALL bit set
and all non-ALL bits set (e.g. the latter disables IMU heater checks).
It also ensures the user will get any new arming checks even if they
have skipped one.

People who need to disable all current and future checks for e.g. bench
testing can still do this efficiently by setting the parameter to `-1`,
leveraging that this sets all bits in 2s complement arithmetic.

A parameter conversion is included that skips no checks if the old ALL
bit is set; otherwise it migrates the user's selected checks. If no
checks were enabled, it disables all current and future checks.
This lowers the effort required to turn off just one arming check.
Previously, a user had to disable the ALL bit and enable every check
except the undesired one. Now they can just disable that one directly.
Hopefully this will result in less vehicles with no arming checks
whatsoever, presuming only one check is giving the user grief.

This, as a side effect, removes the difference between the ALL bit set
and all non-ALL bits set (e.g. the latter disables IMU heater checks).
It also ensures the user will get any new arming checks even if they
have skipped one.

People who need to disable all current and future checks for e.g. bench
testing can still do this efficiently by setting the parameter to `-1`,
leveraging that this sets all bits in 2s complement arithmetic.

A parameter conversion is included that skips no checks if the old ALL
bit is set; otherwise it migrates the user's selected checks. If no
checks were enabled, it disables all current and future checks.
This lowers the effort required to turn off just one arming check.
Previously, a user had to disable the ALL bit and enable every check
except the undesired one. Now they can just disable that one directly.
Hopefully this will result in less vehicles with no arming checks
whatsoever, presuming only one check is giving the user grief.

This, as a side effect, removes the difference between the ALL bit set
and all non-ALL bits set (e.g. the latter disables IMU heater checks).
It also ensures the user will get any new arming checks even if they
have skipped one.

People who need to disable all current and future checks for e.g. bench
testing can still do this efficiently by setting the parameter to `-1`,
leveraging that this sets all bits in 2s complement arithmetic.

A parameter conversion is included that skips no checks if the old ALL
bit is set; otherwise it migrates the user's selected checks. If no
checks were enabled, it disables all current and future checks.
AIRSPEED check was inexplicably disabled before as well, but it's
compiled out so re-enabling it doesn't matter.
The meaning is the same as before, for better or worse.
These conversions were done by spirit rather than literally. Note that
the webots python params get several more checks enabled but the one
disabled now matches the comment.
The meaning is the same as before, for better or worse.

Some files only for older firmwares were not touched.
This also probably actually makes this parameter effective by removing
the ALL bit.
@tpwrules
Copy link
Contributor Author

Everything addressed except for the potential changes regarding the bits themselves.

@timtuxworth
Copy link
Contributor

This is great @tpwrules - is there a SKIPCHK for scripted arming checks? i.e. when disabling any other specific checks, can I also check a bit to disable all scripted arming checks?

@tpwrules
Copy link
Contributor Author

This is great @tpwrules - is there a SKIPCHK for scripted arming checks? i.e. when disabling any other specific checks, can I also check a bit to disable all scripted arming checks?

This should be covered by the AuxAuth bit (17), just like before.

@LupusTheCanine
Copy link

Regarding the name, how about ARMING_BPASS_CHK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants