MAVLink extendable communication node for ROS with proxy for Ground Control Station (e.g. QGroundControl).
ROS API documentation moved to wiki.ros.org.
- Communication with autopilot via serial port, UDP or TCP (e.g. PX4 Pro or ArduPilot)
- Internal proxy for Ground Control Station (serial, UDP, TCP)
- mavlink_ros compatible ROS topics (Mavlink.msg)
- Plugin system for ROS-MAVLink translation
- Parameter manipulation tool
- Waypoint manipulation tool
- PX4Flow support (by mavros_extras)
- OFFBOARD mode support.
Only for linux. Depends on Boost library >= 1.46 (hydro on 12.04). Catkin build system required (tested with ROS Hydro Medusa, Indigo Igloo and Jade Turtle).
This package are dependent on ros-*-mavlink build from mavlink-gbp-release. Since 2014-06-19 it exists in Hydro and Indigo package index (so you can install via rosdep). Since 2015-02-25 exists for Jade too.
Connection defined by URL, you can use any supported type for FCU and GCS.
Supported schemas:
- Serial:
/path/to/serial/device[:baudrate]
- Serial:
serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
- UDP:
udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
- TCP client:
tcp://[server_host][:port][/?ids=sysid,compid]
- TCP server:
tcp-l://[bind_host][:port][/?ids=sysid,compid]
Note:
- Ids from URL overrides value given by system_id & component_id parameters.
- bind_host - default
0.0.0.0
- i.e. IP4 ANY - UDP default ports: 14555 @ 14550
- UDP remote address updated every time with incoming packet on bind port.
- TCP default port: 5760
MAVROS does translate Aerospace NED frames, used in FCUs to ROS ENU frames and vice-versa. For translate airframe related data we simply apply rotation 180° abount ROLL (X) axis. For local we apply 180° about ROLL (X) and 90° about YAW (Z) axes. Plase read documents from issue #473 for additional information.
All the conversions are handled in src/lib/uas_frame_conversions.cpp
and src/lib/uas_quaternion_utils.cpp
and tested in test/test_frame_conversions.cpp
and test/test_quaternion_utils.cpp
respectively.
Related issues: #49 (outdated), #216 (outdated), #317 (outdated), #319 (outdated), #321 (outdated), #473. Documents: Frame Conversions, Mavlink coordinate frames.
Main node. Allow disable GCS proxy by setting empty URL.
Run example (autopilot connected via USB at 921600 baud, GCS running on the host with IP 172.16.254.1):
rosrun mavros mavros_node _fcu_url:=/dev/ttyACM0:921600 _gcs_url:=udp://@172.16.254.1
Allows you to add a channel for GCS. For example if you need to connect one GCS for HIL and the second on the tablet.
Example (SITL & QGroundControl):
rosrun mavros mavros_node _gcs_url:='udp://:[email protected]:14551' &
rosrun mavros gcs_bridge _gcs_url:='udp://@172.16.254.129'
Launch files are provided for use with common FCUs, in particular Pixhawk:
- px4.launch -- for use with the PX4 Pro flight stack (for VTOL, multicopters and planes)
- apm.launch -- for use with APM flight stacks (e.g., all versions of ArduPlane, ArduCopter, etc)
Examples:
roslaunch mavros px4.launch
roslaunch mavros apm.launch fcu_url:=tcp://localhost gcs_url:=udp://@
Since v0.5 that programs available in precompiled debian packages for x86 and amd64 (x86_64).
Also v0.9+ exists in ARMv7 repo for Ubuntu armhf.
Just use apt-get
for installation:
sudo apt-get install ros-jade-mavros ros-jade-mavros-extras
Use wstool
utility for retriving sources and catkin
tool for build.
sudo apt-get install python-catkin-tools python-rosinstall-generator
# 1. unneded if you already has workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin init
wstool init src
# 2. get source (upstream - released)
rosinstall_generator --upstream mavros | tee /tmp/mavros.rosinstall
# alternative: latest source
rosinstall_generator --upstream-development mavros | tee /tmp/mavros.rosinstall
# 3. latest released mavlink package
# you may run from this line to update ros-*-mavlink package
rosinstall_generator mavlink | tee -a /tmp/mavros.rosinstall
# 4. workspace & deps
wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src
rosdep install --from-paths src --ignore-src --rosdistro jade -y
# 5. finally - build
catkin build
Build error. if you has error with missing mavlink_*_t
or MAVLINK_MSG_ID_*
then you need fresh mavlink package.
You may update from ros-shadow-fixed (binary installation) or redo script from step 3.
Important. The current implementation of mavlink does not allow to select dialect in run-time,
so mavros package (and all plugin packages) have compile-time option MAVLINK_DIALECT
, default is 'aurdupilotmega'.
If you want change dialect change workspace config:
catkin config --cmake-args -DMAVLINK_DIALECT=common
- Fork the repo:
- Clone the repo (
git clone https://github.com/mavlink/mavros.git
); - Create a remote connection to your repo (
git remote add <remote_repo> [email protected]:<YourGitUser>/mavros.git
); - Create a feature/dev branch (
git checkout -b <feature_branch>
); - Add the changes;
- Apply the changes by commiting (
git commit -m "<message>"
orgit commit -a
and then write message; if adding new files:git add <path/to/file.ext>
); - Check code style
uncrustify -c ${ROS_WORKSPACE}/mavros/mavros/tools/uncrustify-cpp.cfg --replace --no-backup <path/to/file.ext>
; - Fix small code style errors and typos;
- Commit with description like "uncrustify" or "code style fix". Please avoid changes in program logic (separate commit are better than mix of style and bug fix);
- Run tests:
- with
catkin_make
, issuecatkin_make tests
and thencatkin_make run_tests
; - with
catkin tools
, issuecatkin run_tests
;
- If everything goes as planned, push the changes (
git push -u <remote_repo> <feature_branch>
) and issue a pull request.
- GCS — Ground Control Station
- FCU — Flight Control Unit (aka FC)
- OBC — OnBoard Computer (your odroid or raspberry)
- MAVLink -- communication protocol
- mavlink_ros -- original ROS node (few messages, no proxy)
- Pixhawk -- Reference hardware platform
- PX4 -- Reference implementation in the academic community
- ArduPilot -- tested autopilot APM:Plane (default command set)
- QGroundControl -- tested ground control station for Android, iOS, Mac OS, Linux and Windows
- mavros_extras -- extra plugins & node for mavros