REPOSITORY IS UNDER MIGRATION PROCESS. IT IS BEING MIGRATED FROM LEGACY VERSION TO SIMPLIFY THE WHOLE ARCHITECTURE. LEGACY VERSION: https://github.com/froxec/AdaptiveDroneLegacy.
This repository contains:
- Docker compose configuration for Ardupilot SITL simulation with Gazebo (ardupilot_gazebo image)
- Automonous system based on ROS2 (autonomous_system image).
It is assumed that drone mass can change during exploatation. The goal of a control system is to adapt to these changes.
Autonomous system implements Model Predictive Control algorithm which is aided by Gaussian Process to estimate current drone mass.
- Install VSCode and with Dev Containers extension.
- While in repository working directory press Ctrl+Shift+P and run Dev Containers: Reopen in Container.
You have to do this both for ardupilot_gazebo and autonomous_system images.
In ardupilot_gazebo container you have to run both ardupilot and gazebo.
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON -m "--out udp:localhost:6788"
In the 2nd terminal run:
gz sim -v4 -r iris_runway.sdf
Voilà, simulation should be running and you should be seeing gazebo GUI with Iris quadcopter.
Configure environment by running:
./run_entrypoint.bash
Then reload terminal or run:
source ~/.bashrc
Run the following command on HOST machine:
xhost +local:docker
In autonomous_system container run:
ros2 launch mavros apm.launch fcu_url:=udp://:[email protected]
When you look at topics list you should see /mavros/* topics.
ros2 topic list
Build package
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug
Then use visual studio code with launch configuration:
{
"version": "0.2.0",
"configurations": [
{
"name": "Ros2 node debug",
"type": "ros",
"request": "launch",
"target": "/home/rosdev/ws/mpc_control/launch/mpc_node_launch.py"
},
]
}
If colcon build throws stderr SetuptoolsDeprecationWarning then you should downgrade setuptools as described HERE.
You can interact with Ardupilot by reading messages from /mavros topics and calling /mavros services.
Important services:
- /mavros/set_mode -> Setting quadcopter mode -> e.g. custom_mode='GUIDED'
- /mavros/cmd/arming -> arming command -> True/False
For easy gui topic/service development run RQT GUI:
rqt
To setup Visual Studio Code for effective development follow instructions from the article "ROS 2 and VSCode" by Giovanni Remigi.