ROS2 and Gazebo
This page links resources to learn ROS 2 basics and explains how to get started with the quadrotor
Learn ROS2
There are lots of available resources for learning ROS2
- ROS 2 from Scratch by Edouard Renard
- ROS2 Official tutorials
- MAGICC Lab tutorials
- ROS2 Docker tutorial
- ROS2 For Beginners
Learn Gazebo
- MAGICC Lab tutorials
- Multi-Vehicle Simulation with Gazebo
- Gazebo Simulation
- ros_gz_project_template (A template project integrating ROS 2 and Gazebo simulator)
Quadrotor ROS2 Set-up
The following set-up information is repeated from the README in the src directory. It explains how to set up the proper environment to use the code in this repository. See the README for explanations of each ROS2 package.
Install PX4 Autopilot
To Install PX4 run this code
Run this script in a bash shell to install everything
You will now need to restart your computer before continuing
Install ROS2 Jazzy
To install ROS2 Jazzy follow the steps here
Install Dependencies
Install Python dependencies as mentioned in the PX4 Docs with this code
Build Micro DDS
As mentioned in the PX4 Docs run this code in order to build MicroDDS on your machine
git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
cd Micro-XRCE-DDS-Agent
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig /usr/local/lib/
Clone in Repo and Packages
Run this code to clone the repo
We need the px4_msgs package. Our ROS2 nodes rely on the message definitions in this package in order to communicate with PX4. Read here for more information.
Be sure you're in the src directory of the workspace and run this code to clone in the px4_msgs repo
I couldn't get this to work in jazzy without also including px4_msgs_old and the translation_node packages. To copy these packages, make sure you are in your workspace directory and have installed PX4-Autopilot in your root directory. Run the following code
Clone in all required packages before building the workspace
Build the Workspace
Source the ROS2 installation, build the workspace within the workspace directory (not in src), and source the workspace
Your directory should now look similar to the following
.
├── .github
├── docs
├── build
├── install
├── log
├── src
│ ├── px4_offboard
│ ├── other_ros_packages
│ ├── px4_msgs
│ ├── px4_msgs_old
│ ├── translation_node
├── .gitignore
├── mkdocs.yml
├── README.md
Running the code
Follow the instructions for each package to run the code