Controlling a UAV using ROS 2
We are now ready to implement our first ROS 2 application to control a simulated UAV. As previously mentioned, the interface between Gazebo and ROS 2 mimics that of a real autopilot. This means the program presented in this chapter will work the same way with a real robot. The goal of this example is to demonstrate how to perform basic UAV operations. Specifically, we will implement the following functions:
- Arm: Start the propellers spinning.
- Disarm: Stop the propellers from spinning.
- Take off: Lift the UAV to an altitude of 5 meters at its current position.
Additionally, during these operations, the ROS 2 system will monitor the UAV’s local position in Cartesian space. After takeoff, the user will be able to specify a target position for the UAV to reach. The UAV will then plan and execute a time-sampled trajectory from its current position to the specified goal. To achieve this, we need to select the OFFBOARD control...