This pakcage implements a PID-based trajectory tracking controller for PX4-based autonomous robots.
Author: Zhefan Xu, Computational Engineering & Robotics Lab (CERLAB) at Carnegie Mellon University (CMU).
If you find this work helpful, kindly show your support by giving us a free ⭐️. Your recognition is truly valued.
This repo can be used as a standalone package and also comes as a module of our autonomy framework.
This repo has been tested on ROS Melodic with Ubuntu 18.04 and ROS Noetic with Ubuntu 20.04 and it depends on mavros ROS package. Use the following commands for installtion:
# install dependency
sudo apt install ros-[melodic/noetic]-mavros* # mavros
cd ~/catkin_ws/src
git clone https://github.com/Zhefan-Xu/tracking_controller.git
cd ~/catkin_ws
catkin_make
For tracking a circular trajectory, please run the following commands. Note that the tracking circle function is a part of autonomous_flight package and please install it before running. Also, for simulator, you can either use the original PX4 simulator or use our PX4-based uav_simulator package:
# start PX4 simulator
roslaunch uav_simulator px4_start.launch
# launch the tracking node function with the tracking controller
roslaunch autonomous_flight takeoff_and_track_circle.launch
The example results of running the above command can be visulized as below:
tracking_controller_demo.mp4
The implemented controller follows the structure shown below:
![controller_diagram](https://private-user-images.githubusercontent.com/55560905/291733488-b3a68c70-fb1a-4ec2-be29-3cb769670490.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3MDgwNDEsIm5iZiI6MTcyMzcwNzc0MSwicGF0aCI6Ii81NTU2MDkwNS8yOTE3MzM0ODgtYjNhNjhjNzAtZmIxYS00ZWMyLWJlMjktM2NiNzY5NjcwNDkwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE1VDA3NDIyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRmMWMxMGZkNmRlMmMyODRiNzEzOTFhYzZlM2JiMTViYzI0NTlhNGQ3ZmI3ZTg4OWMyMTk0YzFkZmIxZmVjYjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.lLfcEMMsf3xHjOlWoTCdIpZvW1lx56W5X99UoNP7-QE)
The related paper can be found on:
Dario Brescianini, Markus Hehn, Raffaello D'Andrea, Nonlinear Quadrocopter Attitude Control, ETH Zurich, 2013. [paper]
The controller parameters can be edited and modified in tracking_controller/cfg/controller_param.yaml
.
Here lists some important ROS topics related to the controller:
-
Subscribing Topics:
/mavros/local_position/odom
: The robot odometry./mavros/imu/data
: The robot IMU data./autonomous_flight/target_state
: The desired target states.
-
Publishing Topics:
/mavros/setpoint_raw/attitude
: The command to the PX4 flight controller./mavros/setpoint_raw/local
: The command to the PX4 flight controller./tracking_controller/robot_pose
: The robot current pose./tracking_controller/trajectory_history
: The robot historic trajectory./tracking_controller/target_pose
: The target current pose./tracking_controller/target_trajectory_history
: The target historic trajectory./tracking_controller/vel_and_acc_info
: The robot state information.