Arming and Vehicles Modes with MAVROS

Arming and Vehicles Modes with MAVROS#

Alt text

MAVROS is ros2 package to bridge MAVLINK protocol to ros2 environment. Ardusub have many control mode available like MANUAL, STABILIZE, and ALT_HOLD that we can command from ROS2 environment.

Arming and Disarming#

The process to Arming and Disarming is available trough ros2 service:

  • Arming

    ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: true}"
    
  • Disarming

    ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: false}"
    

Changing Mode#

  • Manual

    ros2 service call /mavros/set_mode mavros_msgs/srv/SetMode "{base_mode: 0, custom_mode: 'MANUAL'}"
    
  • Stabilize

    ros2 service call /mavros/set_mode mavros_msgs/srv/SetMode "{base_mode: 0, custom_mode: 'STABILIZE'}"
    

Just change the custom_mode value to the mode we want to change:

Available Modes:

  • MANUAL

  • ALT_HOLD

  • STABILIZE

NOTE: The yaw behavior of the ALT_HOLD and STABILIZE mode is that it will maintain the heading angle the mode started in and during operation the heading angle after the pilot’s last yaw control input (after a bit of settling time)