Skip to content
Open
Changes from all commits
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
10 changes: 6 additions & 4 deletions src/examples/offboard/offboard_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ class OffboardControl : public rclcpp::Node {
auto timer_callback = [this]() -> void {

if (offboard_setpoint_counter_ == 10) {

// Arm the vehicle
this->arm();

// Change to Offboard mode after 10 setpoints
this->publish_vehicle_command(VehicleCommand::VEHICLE_CMD_DO_SET_MODE, 1, 6);

// Arm the vehicle
this->arm();
}

// offboard_control_mode needs to be paired with trajectory_setpoint
Expand Down Expand Up @@ -133,7 +135,7 @@ class OffboardControl : public rclcpp::Node {
* @brief Send a command to Arm the vehicle
*/
void OffboardControl::arm() const {
publish_vehicle_command(VehicleCommand::VEHICLE_CMD_COMPONENT_ARM_DISARM, 1.0);
publish_vehicle_command(VehicleCommand::VEHICLE_CMD_COMPONENT_ARM_DISARM, VehicleCommand::ARMING_ACTION_ARM);

RCLCPP_INFO(this->get_logger(), "Arm command send");
}
Expand All @@ -142,7 +144,7 @@ void OffboardControl::arm() const {
* @brief Send a command to Disarm the vehicle
*/
void OffboardControl::disarm() const {
publish_vehicle_command(VehicleCommand::VEHICLE_CMD_COMPONENT_ARM_DISARM, 0.0);
publish_vehicle_command(VehicleCommand::VEHICLE_CMD_COMPONENT_ARM_DISARM, VehicleCommand::ARMING_ACTION_DISARM);

RCLCPP_INFO(this->get_logger(), "Disarm command send");
}
Expand Down