PX4 and MAVROS

Now that we already have ROS and Gazebo installed and since in this project we do not plan on making any modifications to PX4 and MAVROS, these can directly be installed using the binaries. However, as there are no binaries for PX4, we will have to build that from source.

To install MAVROS(and the GeographicLib dataset):

sudo apt-get install ros-kinetic-mavros ros-kinetic-mavros-extras
wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
./install_geographiclib_datasets.sh

For the PX4 Firmware, there are a few things we need to set up:

  1. Remove modemmanager
  2. Install the common dependancies
  3. Install Ninja
  4. Install FastRTPS

Now, it turns out that the instructions provided here do not set up our environment as required with ROS. A fix for this was proposed in issue #66 in the PX4 repository which works perfectly.

  1. Create a catkin workspace

     mkdir -p catkin_ws/src
     cd catkin_ws/src
    
  2. Clone and get the submodules for the PX4 firmware

     git clone https://github.com/PX4/Firmware.git
     git clone https://github.com/PX4/sitl_gazebo.git
     cd Firmware
     git submodule update --init --recursive
     cd ..
     cd sitl_gazebo
     git submodule update --init --recursive
     cd ../..
    
  3. Build and source the workspace

     catkin build
     source devel/setup.bash
    

Note: Aliases are pretty helpful shortcuts to source different workspaces.

If all of this went well without any errors, we have PX4 and MAVROS on our system. To test whether it works, after sourcing the workspace, run

roslaunch px4 mavros_posix_sitl.launch

Ideally this launches Gazebo and a simulated Iris drone with MAVROS as below:

gazebo_screenshot