Trajectory generation and control algorithms using AI for UAVs with ROS wrapping.
This repository provides the code associated to the paper :
Esteban Carvalho, Pierre Susbielle, Ahmad Hably, Jilles Dibangoye, Nicolas Marchand. Neural Enhanced Control for Quadrotor Linear Behavior Fitting ICUAS 2022 - IEEE International Conference on Unmanned Aircraft Systems, Jun 2022, Dubrovnik, Croatia hal-03650833v1.
If you use this code, please quote the following publication :
@inproceedings{carvalho:hal-03650833,
TITLE = {{Neural Enhanced Control for Quadrotor Linear Behavior Fitting}},
AUTHOR = {Carvalho, Esteban and Susbielle, Pierre and Hably, Ahmad and Dibangoye, Jilles and Marchand, Nicolas},
URL = {https://hal.archives-ouvertes.fr/hal-03650833},
BOOKTITLE = {{ICUAS 2022 - IEEE International Conference on Unmanned Aircraft Systems}},
ADDRESS = {Dubrovnik, Croatia},
PUBLISHER = {{IEEE}},
YEAR = {2022},
MONTH = Jun,
PDF = {https://hal.archives-ouvertes.fr/hal-03650833/file/Neural_Enhanced_Control_for_Quadrotor_Linear_Behavior_Fitting.pdf},
HAL_ID = {hal-03650833},
HAL_VERSION = {v1},
}
This project uses external software such as Mavros, PX4 or Gazebo. Below are the links directing to their documentations:
For the installation, you need to have ROS melodic (or kinetic) installed, a catkin workspace and Gazebo. Follow the online documentation to set up your environement.
Install mavros
sudo apt install ros-melodic-mavros ros-melodic-mavros-extras
Mavros request the GeographicLib datasets, install it by running the install_geographiclib_datasets.sh script
wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
chmod +x install_geographiclib_datasets.sh
sudo ./install_geographiclib_datasets.sh
Install libgstreamer
sudo apt install libgstreamer1.0-dev
Initialize rosdep and update it
sudo rosdep init
rosdep update
Clone sitl_gazebo and PX4 Firmware
cd ~/catkin_ws/src/
git clone --recursive https://github.com/PX4/sitl_gazebo
git clone --recursive https://github.com/PX4/Firmware px4
or to replicate paper results, we recommand you to use a specific version of px4 using the following line code :
git clone --recursive -b kakutef7_ekf_v1.11.3 https://github.com/gipsa-lab-uav/PX4-Autopilot.git
Note: If you have troubles installing the different packages, it is recommended to read the related documentation.
Clone the uav_control_ai repository
cd ~/catkin_ws/src/
git clone https://github.com/gipsa-lab-uav/uav_control_ai
Install the required Python packages:
pip install -r requirements.txt
sudo apt-get install python3-pil python3-pil.imagetk
To finish the installation run:
cd ..
catkin_make
Then source your setup.bash:
source devel/setup.bash
In a terminal, run the following line:
roslaunch uav_control_ai example.launch
Three windows must appear :
- A gazebo window with the iris
- A window displaying live information sush as the thrust, position, etc.,
- A window with the desired generated trajectory.
If everything works fine,the iris quadcopter should takeoff and start the trajectory.
Note : QGroundControl can be open in parallel to check if everything is interfacing correctly.
-
[Trajectory] Design the desired trajectory using 'trajectory_gen.py' file. Examples and explanations are available in the file comments.
-
[Controller] Use 'simu_params.yaml' to specify :
- mass and hover compensation coefficient,
- control gains on the position loop and attitude loop,
- select 'clin' as controller type for linear control (proportional derivative).
- [Simulation] Run:
roslaunch uav_control_ai example.launch
-
[Data] Data are stored in 'StateCommandData.msg' available in rosbag folder.
-
[Learning] To learn error dynamics you can use learning_error_dynamics node:
rosrun uav_control_ai learning_error_dynamics.py
At the end of the process, you can save the DNN model in nodes/dnn_model.
- [Simulation with AI] Modify the 'simu_params.yaml' to specify :
- 'clin_ai' to use the DNN Enhanced Linear Cascaded controller_rates
- The DNN selected model path
Then run again :
roslaunch uav_control_ai example.launch