The new Hardware Abstraction Layer (HAL) for working in robotic applications for Unmanned Aerial Vehicles (UAVs) in JdeRobot is based on using ROS/Gazebo and:
- PX4 as main flight control software.
- MavROS as MAVLink-based communication node between ROS and the PX4 flight stack. It also provides an UDP bridge for MAVLink Ground Control Stations
You can use this bash script for from dev.px4.io for setting up ROS Kinetic/Gazebo + PX4 + MavROS on Ubuntu 16.04 (Xenial). It also installs some common dependencies libraries and tools
Alternatively, it can be done step by step:
ROS must be installed first. Please follow the official instructions to install ROS Kinetic (that includes Gazebo 7 by default) in Ubuntu 16.04 (Xenial)
Install MavROS package and its required dependencies following these installation instructions. Binary installation (deb packages) is recommended.
Detailed instructions about the PX4 toolchain installation can be found here. In summary, you must first:
- Remove the Ubuntu modemmanager
- Install the Common Dependencies
- Install the Ninja Build System
- Install FastRTPS
After that, download the last PX4 Firmware from its Github repository:
git clone https://github.com/PX4/Firmware.git
Build the PX4 stack for SITL in Gazebo. You can find more info about building PX4 for different boards, models and variants here.
cd <Firmware>
make px4_sitl_default gazebo
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/sitl_gazebo
A default launch file for launching PX4 SITL + MavROS + Gazebo is included in the MavROS package:
roslaunch px4 mavros_posix_sitl.launch
It will load the default 3DR Iris model in Gazebo:
For launching the 3DR Solo model, use:
roslaunch px4 mavros_posix_sitl.launch vehicle:=solo
If you need to simulate a quadcopter with front RGB camera, you can launch the iris_fpv_cam model
roslaunch px4 mavros_posix_sitl.launch vehicle:=iris_fpv_cam
Note: Sometimes there are problems with launching the former vehicle, and Gazebo crashes. There is already a solutionn that would be addressed here in the near future.
This HAL is compatible with any UAVs including a Pixhawk flight controller or any other board flashed with the PX4 stack.