-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commander: COM_MODE_ARM_CHK parameter to allow mode registration while armed #24249
base: main
Are you sure you want to change the base?
Conversation
…med with COM_MODE_ARM_CHK
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 192 byte (0.01 %)]
px4_fmu-v6x [Total VM Diff: 80 byte (0 %)]
Updated: 2025-01-24T13:21:14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, makes sense
@@ -370,7 +370,7 @@ void ModeManagement::update(bool armed, uint8_t user_intended_nav_state, bool fa | |||
_failsafe_action_active = failsafe_action_active; | |||
_external_checks.update(); | |||
|
|||
bool allow_update_while_armed = false; | |||
bool allow_update_while_armed = _external_checks.allowUpdateWhileArmed(); | |||
#if defined(CONFIG_ARCH_BOARD_PX4_SITL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this ifdef and set the param for sitl?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkueng removed the ifdef and thanks for the pointer with the param for sitl, I wanted to keep the sitl exception.
Is this file adequate to set the sitl param?
param set-default IMU_INTEG_RATE 250 |
@@ -109,4 +110,7 @@ class ExternalChecks : public HealthAndArmingCheckBase | |||
uORB::Subscription _arming_check_reply_sub{ORB_ID(arming_check_reply)}; | |||
|
|||
uORB::Publication<arming_check_request_s> _arming_check_request_pub{ORB_ID(arming_check_request)}; | |||
DEFINE_PARAMETERS( | |||
(ParamInt<px4::params::COM_MODE_ARM_CHK>) _param_com_mode_arm_chk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(ParamInt<px4::params::COM_MODE_ARM_CHK>) _param_com_mode_arm_chk | |
(ParamBool<px4::params::COM_MODE_ARM_CHK>) _param_com_mode_arm_chk |
/** | ||
+ * Allow external mode registration while armed. | ||
+ * | ||
+ * By default disabled. 0: Mode registration is not allowed while armed. 1: Mode registration is allowed while armed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ * By default disabled. 0: Mode registration is not allowed while armed. 1: Mode registration is allowed while armed. | |
+ * By default disabled for safety reasons |
src/modules/commander/HealthAndArmingChecks/checks/externalChecks.hpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Beat Küng <[email protected]>
Co-authored-by: Beat Küng <[email protected]>
Co-authored-by: Beat Küng <[email protected]>
Co-authored-by: Beat Küng <[email protected]>
@bkueng Thank you for the review! I'm open for parameter name suggestions and maybe we can consider to update this comment for consistency, "
|
@@ -4,6 +4,9 @@ | |||
# Simulator IMU data provided at 250 Hz | |||
param set-default IMU_INTEG_RATE 250 | |||
|
|||
# For simulation, allow registering modes while armed for developer convenience | |||
param set-default COM_MODE_ARM_CHK 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved the sitl exception here
Solved Problem
A new parameter
COM_MODE_ARM_CHK
is defined to allow mode registrations while vehicle is armed. In the current implementation, by default, external mode registrations are only allowed while disarmed and therefore parameter default is set to reject mode registrations while armed.Fixes #{Github issue ID}
Solution
allow_update_while_armed
variable was previously hard-coded and disabled. To provide users the option to allow -external- mode registrations while vehicle is armed, this variable is parameterized asCOM_MODE_ARM_CHK
, a boolean PX4 parameter under commander group.Changelog Entry
For release notes:
Alternatives
We could also ...
Test coverage
Context
Related links, screenshot before/after, video