A Linear PID Controlled UAV with ROS + Gazebo
The repository fdcl-uav/gazebo_uav_control is a basic example for using ROS and Gazebo to position control a quadrotor UAV, using C++. A simple PID controller (not the internal ROS controller) is used as the controller. The objective here is for someone new to the UAV control with ROS + Gazebo to figure out where to start.
There are two main modules here:
- uav_gazebo
- uav_control
The uav_gazebo
includes all the necessary file to create and launch a Gazebo environment with the UAV.
The uav_control
includes the control plugin that will act as the PID controller, and the relevant custom messages.
The default behavior is as follows:
- When the Gazebo environment is launched, the UAV will start at the origin.
- Desired position is defined inside the
control_plugin.cpp
. - The UAV controller will wait for 2 seconds for the system to settle in.
- Then, the UAV forces and torques will be set using the PID controller such the UAV converges to the desired position.
- After the convergence, the UAV will stay there.
The gains, desired position, and other physical parameters are hard-coded. Again, the objective here is to familiar with the followings:
- Reading states of the UAV in the Gazebo environment
- Defining a basic PID controller
- Transformation of desired forces and torques to the coordinate frame defined in the Gazebo environment
If are already familiar with the basics and you want to have a more interactive and in-depth ROS + Gazebo UAV control, please check fdcl-gwu/uav_simulator.