Skip to content

Commit

Permalink
feat: new setting to allow arming with executor
Browse files Browse the repository at this point in the history
  • Loading branch information
damien-robotsix committed Jul 5, 2024
1 parent 1ae6a38 commit debe3da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions px4_ros2_cpp/include/px4_ros2/components/mode_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ModeExecutorBase
struct Settings
{
bool activate_immediately{false}; ///< If set activate the mode (and executor) immediately. Only use this for fully autonomous executors that also arm the vehicle
bool is_allowed_to_arm{false}; ///< If set, the executor is allowed to arm the vehicle
};

enum class DeactivateReason
Expand Down
2 changes: 1 addition & 1 deletion px4_ros2_cpp/src/components/mode_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void ModeExecutorBase::vehicleStatusUpdated(const px4_msgs::msg::VehicleStatus::
_is_armed = msg->arming_state == px4_msgs::msg::VehicleStatus::ARMING_STATE_ARMED;
const bool wants_to_activate_immediately = _settings.activate_immediately && _was_never_activated;
const bool is_in_charge = id() == msg->executor_in_charge &&
(_is_armed || wants_to_activate_immediately);
(_is_armed || wants_to_activate_immediately || _settings.is_allowed_to_arm);
const bool changed_to_armed = !was_armed && _is_armed;

bool got_activated = false;
Expand Down

0 comments on commit debe3da

Please sign in to comment.