modes: make available modes user selectable with a registration option

Some modes should only be run within the context of a mode executor and the user should not be able
to select them in the GCS. With this change, the external component registration request can be
used to set if a mode is selectable or not.
This commit is contained in:
Michael Schaeuble
2025-11-26 10:04:53 +01:00
committed by Beat Küng
parent 276cab8d3c
commit a2299b02c8
9 changed files with 155 additions and 3 deletions
@@ -0,0 +1,15 @@
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 request_id # ID from the request
char[25] name # name from the request
uint16 px4_ros2_api_version
bool success
int8 arming_check_id # arming check registration ID (-1 if invalid)
int8 mode_id # assigned mode ID (-1 if invalid)
int8 mode_executor_id # assigned mode executor ID (-1 if invalid)
uint8 ORB_QUEUE_LENGTH = 2
@@ -0,0 +1,24 @@
# Request to register an external component
uint32 MESSAGE_VERSION = 0
uint64 timestamp # time since system start (microseconds)
uint64 request_id # ID, set this to a random value
char[25] name # either the requested mode name, or component name
uint16 LATEST_PX4_ROS2_API_VERSION = 1 # API version compatibility. Increase this on a breaking semantic change. Changes to any message field are detected separately and do not require an API version change.
uint16 px4_ros2_api_version # Set to LATEST_PX4_ROS2_API_VERSION
# Components to be registered
bool register_arming_check
bool register_mode # registering a mode also requires arming_check to be set
bool register_mode_executor # registering an executor also requires a mode to be registered (which is the owned mode by the executor)
bool enable_replace_internal_mode # set to true if an internal mode should be replaced
uint8 replace_internal_mode # vehicle_status::NAVIGATION_STATE_*
bool activate_mode_immediately # switch to the registered mode (can only be set in combination with an executor)
uint8 ORB_QUEUE_LENGTH = 2