|
AutoAPMS
Streamlining behaviors in ROS 2
|
PX4 mode executor that runs an AutoAPMS behavior in-process when put in charge by the FMU. More...
#include <auto_apms_px4/behavior_mode_executor.hpp>
Public Types | |
| enum class | CompletionReaction { HOLD , RTL , LAND , DISARM , COMPLETE , NONE } |
| Reaction performed when a behavior terminates or fails, using the in-charge executor API. More... | |
Public Member Functions | |
| BehaviorModeExecutor (BehaviorOwnedMode &owned_mode, const px4_ros2::ModeExecutorBase::Settings &settings, std::function< Config()> config_provider, auto_apms_behavior_tree::GenericTreeExecutorNode &engine) | |
| Constructor. | |
| void | onExecutionResult (ExecutionResult result) |
| Handle the termination of the behavior running on the in-process executor. | |
Static Public Member Functions | |
| static CompletionReaction | reactionFromString (const std::string &str) |
| Parse a string into a CompletionReaction. | |
PX4 mode executor that runs an AutoAPMS behavior in-process when put in charge by the FMU.
When the owned mode is selected (RC switch, GCS or ActivateImmediately), PX4 puts this executor in charge and onActivate() starts the configured behavior on the in-process behavior tree executor (engine). A pilot override or failsafe triggers onDeactivate(), which halts the behavior. When the behavior finishes, a configurable in-charge reaction (hold/RTL/land/disarm/complete/none) is performed.
The behavior itself is built from standard AutoAPMS nodes and drives the vehicle through the regular PX4 skills. Before starting, the executor publishes its VehicleCommand source component on the global blackboard (under the key configured via the AUTO_APMS_PX4_SOURCE_COMPONENT_GLOBAL_KEY compile definition) so that ownership-aware nodes (e.g. SendCmdSetNavState) can attribute their commands to the executor.
Definition at line 90 of file behavior_mode_executor.hpp.
|
strong |
Reaction performed when a behavior terminates or fails, using the in-charge executor API.
Definition at line 96 of file behavior_mode_executor.hpp.
| BehaviorModeExecutor | ( | BehaviorOwnedMode & | owned_mode, |
| const px4_ros2::ModeExecutorBase::Settings & | settings, | ||
| std::function< Config()> | config_provider, | ||
| auto_apms_behavior_tree::GenericTreeExecutorNode & | engine ) |
Constructor.
| owned_mode | Placeholder mode owned by this executor. |
| settings | PX4 mode executor settings (activation policy). |
| config_provider | Callable returning the current Config. It is invoked once here and again at the start of every activation so runtime parameter changes take effect on the next run (see onActivate). It must stay valid for the lifetime of this executor and is expected to keep any underlying parameter listener alive. |
| engine | In-process behavior tree executor used to run the behavior. |
Definition at line 50 of file behavior_mode_executor.cpp.
|
static |
Parse a string into a CompletionReaction.
| std::invalid_argument | if the value is not a valid reaction. |
Definition at line 77 of file behavior_mode_executor.cpp.
| void onExecutionResult | ( | ExecutionResult | result | ) |
Handle the termination of the behavior running on the in-process executor.
Translates the tree execution result into a px4_ros2::Result and performs the configured completion reaction. Intended to be called from the owning node's TreeExecutorBase::onTermination override.
| result | Final result of the tree execution. |
Definition at line 62 of file behavior_mode_executor.cpp.