Software Install
Install ROS2
Section titled “Install ROS2”Follow these instructions to get the MRover ROS2 install done.
We still need more packages:
sudo apt install ros-dev-tools net-tools v4l-utils ffmpegClone Drone Repository
Section titled “Clone Drone Repository”mrovercd ../Running pwd should tell you you’re in the folder ros2_ws/src
After confirming this, clone the repository:
git clone git@github.com:umrover/mrover-drone.git --recurse-submodules mrover_drone && cd mrover_droneRun the following commands to ensure the dependencies are at the correct versions:
cd ~/ros2_ws/src/mrover_drone/depscd PX4-Autopilotgit checkout v1.15.4cd ../px4_msgsgit checkout release/1.15cd ../px4-ros2-interface-libgit checkout 1.4.0If submodules / dependencies change:
git submodule update --recursiveInitialize ROS2 Dependencies (Non-MacOS only)
Section titled “Initialize ROS2 Dependencies (Non-MacOS only)”Initialize ROSDEP:
sudo rosdep initrosdep updateInstall Dependencies:
cd ~/ros2_wsrosdep install --from-paths src --ignore-src -r -yIf this fails, try:
sudo apt upgrade && sudo apt updateExtra step for MacOS users
Section titled “Extra step for MacOS users”Follow these instructions before proceeding to building external dependencies.
Build External Dependencies
Section titled “Build External Dependencies”Based on PX4 Build Guide
Manual Build
Section titled “Manual Build”Manual build process copied from the above link
Build PX4
Section titled “Build PX4”cd ~/ros2_ws/src/mrover_drone/deps/If on Ubuntu, run:
bash ./PX4-Autopilot/Tools/setup/ubuntu.shIf on Mac, run:
sh ./PX4-Autopilot/Tools/setup/macos.shpip3 install -r ./PX4-Autopilot/Tools/setup/requirements.txtIgnore errors about not being able to do a ‘—user install’.
Continue:
cd PX4-Autopilot/export CMAKE_POLICY_VERSION_MINIMUM=3.5make px4_sitlIf this doesn’t work, install the following python dependencies:
pip3 install --user pyros-genmsg jsonschema kconfiglib futureBuild uXRCE-DDS-Agent
Section titled “Build uXRCE-DDS-Agent”cd ~/ros2_ws/src/mrover_drone/deps/Micro-XRCE-DDS-Agentmkdir buildcd buildcmake ..makesudo make installsudo ldconfig /usr/local/libDownload QGroundControl
Section titled “Download QGroundControl”Download QGroundControl v4.4.0-rc1. Move to your desired folder, then make it an executable:
chmod +x QGroundControl.AppImageTest Installation
Section titled “Test Installation”Start by running the DDS agent. In a new terminal, run:
cd ~/ros2_ws/src/mrover_drone/deps/PX4-Autopilotsource /opt/ros/humble/setup.zshMicroXRCEAgent udp4 -p 8888This will start a MicroXRCE DDS agent on port 8888.
We can now start the PX4-sitl (“software in the loop”) simulator.
This will start a uXRCe-DDS client automatically on localhost port 8888.
In a new terminal, run the following command:
cd ~/ros2_ws/src/mrover_drone/deps/PX4-Autopilotmake px4_sitl gz_x500You should now see output in the DDS agent terminal, and Gazebo should launch.
Install MAVROS
Section titled “Install MAVROS”MAVROS should be added by rosdep. However, you must run the following to download a required dataset:
cd ~/ros2_ws/src/mrover_dronechmod +x ./scripts/install_geographiclib_datasets.shsudo ./scripts/install_geographiclib_datasets.shIf this refuses to download, do:
cd ../..rosdep install --from-paths src --ignore-src -r -yPX4_MSGS
Section titled “PX4_MSGS”ROS messages and services that reflect the PX4 uORB topics.
As of Jan. 13th there was a build issue (https://github.com/PX4/PX4-Autopilot/issues/23736). The fix seems to have been included in the 1.15 release, but if using an older one you can manually edit the build file and remove the errant comment on line 719 as specified in the bug report.
Build this package (using colcon):
cd ~/ros2_wscolcon build --packages-select px4_msgsROS2_PX4 Interface Library
Section titled “ROS2_PX4 Interface Library”This is a (relatively new) way to interface between ROS2 and PX4 which takes advantage of a shared data distribution layer.
Build this package (using colcon):
cd ~/ros2_wscolcon build --packages-select px4_ros2_cppLast Steps / Final Configuration
Section titled “Last Steps / Final Configuration”Add the following to your ~/.zshrc file: (nano ~/.zshrc)
alias drone="cd ~/ros2_ws/src/mrover_drone"