Teleoperation with MAVROS

Teleoperate the real robot: Erle-Copter

Source code

REMINDER: configure your environment before starting this tutorial.

Download and compile the ROS node in your workspace

cd ~/simulation/ros_catkin_ws/src
git clone
cd ..
catkin_make --pkg ros_erle_teleoperation

This node is able to:

  • Override the RC
  • Change the mode of the copter

APM requires setup FCU param SYSID_MYGCS to match mavros system id. Set the parameter SYSID_MYGCS=1.

NOTE: Be carreful to use in automatic control because lack of safety mechanisms

source ~/simulation/ros_catkin_ws/devel/setup.bash
rosrun ros_erle_teleoperation ros_erle_teleoperation

This GUI shows the current flight mode and status (armed or disarmed). With the combo box is possible to change the flight mode (LOITER, STABILIZE, GUIDED, AUTO, ...). The other two widgets are the joystick, left joystick controls yaw and throttle and right joystick controls roll ad pitch. The following window will appear:

Figure 1 - Teleoperation ROS node

Check if the node is overriding the RC. Go to Initial Setup -> Mandatory Setup -> Radio Calibration

Figure 2 - Checking RC override in APM

Using MAVROS we are going to be able to override a 8 channel RC. Filling the 8 values of the array channels msg_override.channels[0].

# Override RC Input
# Currently MAVLink defines override for 8 channel

uint16 CHAN_NOCHANGE=65535

uint16[8] channels

In this code it shows how to override roll, pitch, throttle and yaw channels. The other 4 channels are not going to be override, this mean that this channels will get the value from the RC.

    msg_override.channels[0] = share_memory->getRoll();
    msg_override.channels[1] = share_memory->getPitch();
    msg_override.channels[2] = share_memory->getThrottle();
    msg_override.channels[3] = share_memory->getYaw();
    msg_override.channels[4] = 0;
    msg_override.channels[5] = 0;
    msg_override.channels[6] = 0;
    msg_override.channels[7] = 0;

Remember to publish the message in ROS


Get Erle-Copter at our store