<aside> 💡

This is for the ROS project in the second semester of 2024. For more information and latest version of PX4-Autopilot, please visit https://docs.px4.io/main/en/ros2/user_guide

</aside>

PX4-Autopilot is a package that we’ll be using in order to control the drone with ROS2. The image below will make a lot of sense of what this means.

architecture_xrce-dds_ros2.DXSOuyOh.svg

Pixhawk is a microcontroller that goes into our drones. We call it a flight controller. It’s in charge of controlling the drone itself and it is essentially one of the brains of the drone. With no instructions given, Pixhawk is in charge of making sure that the drone does not fall from the sky and that it follows all the instructions without issues.

Now in order to control the Pixhawk, it receives the messages from ROS2 and only understands a “language” called uORB topic. In order to send the commands reliably and safely, we use a transporting protocol or a middleware called uXRCE-DDS. It’s also responsible for translating the ROS2 messages into uORB topics. The PX4-Autopilot folder that we’ll be installing today is an on-board firmware that goes inside the Pixhawk but we need it in our computers since we need it for the simulation. We’ll also be installing the DDS middleware in this tutorial as well.

Since this is a very complicated, while very important topic, please do not hesitate to reach out for questions or issues.

First, we’ll be installing the PX4-Autopilot package. Please keep in mind that installing this will take around 15 minutes or so depending on your computer specs!

https://docs.px4.io/main/en/ros2/user_guide

Please go to this site and scroll down to Installation & Setup.

Open up a new terminal and make sure that it’s at home. You can do this with one command.

cd ~

After that, follow the instructions while reading the page carefully.

Skip the ROS2 installation as it should already be downloaded.

Follow along Setup Micro XRCE-DDS Agent & Client.