Git Product home page Git Product logo

multi_uav_simulator's Introduction

Mavswarm: A Lightweight Multi-Aerial Vehicle Simulator

Mavswarm is a lightweight and fast Multi-Aerial Vehicle simulator based on ROS (Robot Operating System). It supports simulating heterogenous quadrotor swarms of upto 10 robots on a single desktop with physics. Mavswarm also supports quadrotor control, trajectory optimization and receding horizon planning (RHP). Currently, the internal controller uses the Lee's geometric tracking controller [3] and it is tuned for two different quadrotor models out of the box. In addition you can extend the swarm simulation with more quadrotor models by simply adding the new quadrotor model parameters through a yaml configuration file.

Consider citing our work [1][2] if you find this code helpful for your publications.

Cover Image
A hetergenous swarm of 5 quadrotors stabilizing from an upside-down initialization

Mostly Automated Installation

A Makefile has been compiled to install ros, install dependancies and/or create and build a catkin workspace, and build the entire uav simulator package.

Note: This package currently runs with ROS1 which is only compatible on older linux distros - for example, it is not supported on anything later than Ubuntu 20.04

To get the makefile, run:

wget https://gist.githubusercontent.com/matteovidali/caab443e66425e260b6a1c1bd842d28c/raw/188effd1f7e5c4a49cf636abd96bc325a9ac9bd9/Makefile

Then, if you wish to do a full desktop installation of ROS1, this can be done with:

make ros_desktop_install

To get and install the required dependancies, run:

make deps

To create and initialize a NEW catkin_ws with all required packages First in the makefile, change the value of 'CATKIN_WS_NAME' from '../catkin_ws' to the path where your workspace should exist. Then, run:

make wstool-new

If you have a PRE-EXISTING catkin workspace you would like to build this module into, First change the 'CATKIN_WS_NAME' variable to the path of your catkin workspace, then run:

make wstool-exists

Finally, if you would like to run a catkin build, you may run:

make build

This will build the entire catkin space, so be sure to customize this if necessary

After building, you can launch the simulator with

make launch

Manual Installation

Install dependencies

Install Eigen, Armadillo and GNU Science Library (GSL) before you continue.

Install eigen-coversions (make sure to change the ROS version name i.e.; melodic, kinetic).

sudo apt install ros-noetic-eigen-conversions

Building the simulator

Create a new catkin workspace and use wstool to download the multi_uav_simulator package.

mkdir catkin_ws
wstool init src
cd src/
wstool set --git multi_uav_simulator [email protected]:malintha/multi_uav_simulator.git -y
wstool update

Mavswarm uses ethz-asl/mav_trajectory_generation package to generate trajectories for the robots. Use therosinstall/dependencies.rosinstall file to download the required dependencies.

wstool merge multi_uav_simulator/rosinstall/dependencies.rosinstall
wstool update

This will clone the following packages to the workspace automatically : catkin_simple, eigen_catkin, eigen_checks, glog_catkin, mav_comm, mav_trajectory_generation, nlopt.

Now build the simulator.

cd ../
catkin build multi_uav_simulator

Run the simulator.

source devel/setup.bash
roslaunch multi_uav_simulator simu.launch

This will open an Rviz window and show 5 drones flip from an upside-down initialization.

Publishing Goals

Mavswarm supports Receding Horizon Planning (RHP) and trajectory optimization out of the box. You can publish a new desired goal position using rostopics for any drone to see it navigating. To do so, open a new command window and publish the following message.

rostopic pub /robot_1/desired_state geometry_msgs/Point '{x: 4, y: -1, z: 3}'

Each drone listnes to its desired_state topic which uses the ROS standard geometry_msgs/Point message type to recieve new goal locations. The command above simply adds the goal {x: 4, y: -1, z: 3} into the first drone's goal list. To See RHP in working, publish a different goal before the drone reaches the previous goal. This will recalculate a new trajectory to match the robot's current speed and acceleration to ensure smooth transitions between rapidly changing goal locations.

Adding a new drone to the environment

Mavswarm uses xacro to spawn new models into the simulation environment. Out of the box, it has 5 drones in the environment and two separate quadrotor models to choose from; namely, Bigquad (the quadrotor model from [2]) and Crazyflie. If you want to add a sixth drone to the environment, simply follow the steps below.

  1. In the launch/simu.launch file, add a new line with the corresponding drone id. Make sure to change <param name> and the robot_id accordingly. For example,

     <param name="robot_6" command="$(find xacro)/xacro $(find multi_uav_simulator)/cf_description/crazyflie.urdf.xacro robot_id:=6" />
    

    This adds a new Crazyflie model to the environment. If you want a larger quadrotor model, you can use bigquad_description/bigquad.urdf.xacro instead.

  2. Now add the following block to bind a quadrotor instance to the URDF model. Here we pass the robot_id and the internal controller's frequency as arguments to the quadrotor instance. In addition, we use rosparam to specify the quadrotor's model parameters and the controller gains. The parameters for the Bigquad and the Crazyflie can be found in config/bigquad_params.yaml and config/crazyflie_params.yaml files respectively.

     <group ns="robot_6">
         <node name="drone" pkg="multi_uav_simulator" type="multi_uav_simulator" output="screen" args="6 $(arg controller_frequency)">
           <rosparam file="$(find multi_uav_simulator)/config/crazyflie_params.yaml"/>
         </node>
       </group>
    
  3. In order to specify the initial conditions for the new drone add a new block to the config/initial_conditions.yaml file as below.

     robot_6:
         position: [2, 4, 0]
         velocity: [0, 0, 0]
         rotation: [1, 0, 0, 0, -0.9995, -0.0314, 0, 0.0314, -0.9995]
         omega: [0, 0, 0]
    

    The rotation and omega stands for the initial rotation matrix (3x3) and the angular velocity (3x1) of the rigid body. Here, we initialize the drone up-side down. To make it right way up, change the rotation matrix to identity: [1, 0, 0, 0, 1, 0, 0, 0, 1].

  4. Finally, to visualize the newly added drone, add a robot_model visualization type to RViz. Change its description to corresponding param name of the newly added element in the launch file. i.e.: "robot_6".

[1] Our work based on this controller:

@inproceedings{fernando2019formation,
title={Formation control and navigation of a quadrotor swarm},
author={Fernando, Malintha and Liu, Lantao},
booktitle={2019 International Conference on Unmanned Aircraft Systems (ICUAS)},
pages={284--291},
year={2019},
organization={IEEE}
}

[2] Mean-Field flocking control of UAVs (Find the complete code at: https://github.com/malintha/mean_field_flocking):

@INPROCEEDINGS{9560899,
author={Fernando, Malintha},
booktitle={2021 IEEE International Conference on Robotics and Automation (ICRA)}, 
title={Online Flocking Control of UAVs with Mean-Field Approximation}, 
year={2021},
volume={},
number={},
pages={8977-8983},
doi={10.1109/ICRA48506.2021.9560899}
}

[3] Geometric tracking controller:

@inproceedings{lee2010geometric,
title={Geometric tracking control of a quadrotor UAV on SE (3)},
author={Lee, Taeyoung and Leok, Melvin and McClamroch, N Harris},
booktitle={49th IEEE conference on decision and control (CDC)},
pages={5420--5425},
year={2010},
organization={IEEE}
}

multi_uav_simulator's People

Contributors

malintha avatar matteovidali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

multi_uav_simulator's Issues

Need to add examples

It would be good to have some example codes on python/C++ on simulating some trajectories with the drones.

Missing Waypoint.h file

While attempting the catkin_make as instructed by the document, it gives the fatal error of not having simulator_utils\Waypoint.h

Add indepedent node control

This will let each node to be controlled independently instead of centralized control through a single simulation node.

Add higher order control inputs

The drones should be able to accept velocity/acceleration control inputs. Since the Lee's controller accepts only the positional inputs, this needs to be catered from the dynamical system front. I.e., Integrating the differentially flat model with the given control input and use the resulting coordinates to optimize the trajectories.
This can also handle stochastic dynamics, by adding a Gaussian noise to the integration.

rostopic pub

image
When I try to formulate the drone to fly towards a fixed point, the program reminds me that the rostopic package conflicts with the currently installed package with. The current installation package is installed according to readme.txt

Makefile to build and launch

Hey,
I have made a Makefile for this project that will handle the dependencies required as well as the build process. This is the first version of the Makefile, and it works on a fresh install of Ubuntu 20.04.5, Kernel: 5.15.0-67-generic.

To use this file, first download the gist, and place it the directory where you would like your catkin_ws to be made.
Then run make deps to install dependencies required. This will only work on distros and versions that support ROS1, and I have only tested it on 1 machine, so it will be updated as required.

Next, run make build to build the multi_uav_simulator.
Finally, run make launch to launch the simulation, and an Rviz window should open.

Included is a make clean command, to remove the entire catkin_ws.

Please leave comments either here and mention me (@matteovidali) with updates, or place requests on the gist itself.

Required package not found while building 'mav_trajectory_generation' during catkin build.

I'm trying to get the example described in the main README file working. I'm inside a docker container on ubuntu 20.02 focal. I'm using the ros-noetic-robot container file to start with. After getting catkin working, and all prereqs installed, i manged to get through the build process, up until the 'mav_trajectory_generation' step. Then I get a somewhat unhelpful message about a missing package;

...
Starting  >>> eigen_checks                                                                         
Finished  <<< geo_controller                           [ 0.3 seconds ]                             
Finished  <<< eigen_checks                             [ 0.2 seconds ]                             
Starting  >>> mav_trajectory_generation                                                            
___________________________________________________________________________________________________
Errors     << mav_trajectory_generation:cmake /catkin_ws/logs/mav_trajectory_generation/build.cmake.004.log
CMake Warning (dev) at CMakeLists.txt:2 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    CMAKE_PROJECT_VERSION
    CMAKE_PROJECT_VERSION_MAJOR
    CMAKE_PROJECT_VERSION_MINOR
    CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
  CMakeLists.txt:19 (pkg_check_modules)


cd /catkin_ws/build/mav_trajectory_generation; catkin build --get-env mav_trajectory_generation | catkin env -si  /usr/bin/cmake /catkin_ws/src/mav_trajectory_generation/mav_trajectory_generation --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/catkin_ws/devel/.private/mav_trajectory_generation -DCMAKE_INSTALL_PREFIX=/catkin_ws/install; cd -

...................................................................................................
Failed     << mav_trajectory_generation:cmake          [ Exited with code 1 ]                      
Failed    <<< mav_trajectory_generation                [ 1.0 seconds ]                             
Abandoned <<< multi_uav_simulator                      [ Unrelated job failed ]                    
[build] Summary: 8 of 10 packages succeeded.                                                       
[build]   Ignored:   7 packages were skipped or are skiplisted.                                    
[build]   Warnings:  None.                                                                         
[build]   Abandoned: 1 packages were abandoned.                                                    
[build]   Failed:    1 packages failed.                                                            
[build] Runtime: 3.1 seconds total.     

Up to this point, I was getting the occasional dependency errors (libtools), but they were easy to resolve. The error message made me think it was an issue with pulling/merging the dependency mentioned in the walkthrough, so I reran those steps, but the error persisted.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.