Skip to content

froxec/AdaptiveDrone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adaptive drone

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:

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.

Run containers from VSCode

  1. Install VSCode and with Dev Containers extension.
  2. 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.

Ardupilot Software in the Loop simulation with gazebo

In ardupilot_gazebo container you have to run both ardupilot and gazebo.

Run ardupilot_sitl

sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON -m "--out udp:localhost:6788"

Run gazebo

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.

Troubleshooting

Gazebo doesn't find models run

Configure environment by running:

./run_entrypoint.bash

Then reload terminal or run:

source ~/.bashrc

Gazebo cannot connect to display :0 (Qt.xcb error)

Run the following command on HOST machine:

xhost +local:docker

Autonomous system

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

Running node

Debug mode

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"
        },
    ]
}

Troubleshooting

If colcon build throws stderr SetuptoolsDeprecationWarning then you should downgrade setuptools as described HERE.

Interacting with ArduPilot

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

RQT GUI

For easy gui topic/service development run RQT GUI:

rqt

Visual Studio Code setup for ROS2 project development

To setup Visual Studio Code for effective development follow instructions from the article "ROS 2 and VSCode" by Giovanni Remigi.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published