Connecting with ROSΒΆ

Before attempting to connect with ROS, ensure that the physical serial cable connection and ArduPilot side parameters have been set as described on the appropriate companion computer page (RPi3, NVidia TX1, NVidia TX2 or Intel Edison).

The connection between ArduPilot running on the flight controller and ROS/MAVROS can be established with the following commands on the companion computer:

  • open up a terminal and type, “roscore”
  • open another terminal and start mavros as described here on the ros/mavros wiki. For example, the following instruction is appropriate for a TX2/APSync install with port 14855 opened (see “How flight controller data is routed to various programs” at the bottom of this page):
roslaunch mavros apm.launch fcu_url:=udp://:14855@

Test the flight controller is responding to mavros commands like mavsys (which can set the flight mode) and mavsafety (which can arm/disarm the vehicle):

rosrun mavros mavsys mode -c 0 (sets the vehicle to mode "0")
rosrun mavros mavsafety arm (to arm the vehicle)

Note

We are keen to improve ArduPilot’s support of ROS so if you find issues (such as commands that do not seem to be supported), please report them in the ArduPilot issues list with a title that includes “ROS” and we will attempt to resolve them as quickly as possible.