Skip to content
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

feat: new setting to allow arming with executor #45

Merged
merged 5 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
damien-robotsix marked this conversation as resolved.
Show resolved Hide resolved
};

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
Loading