Ask Your Question
0

Controlling multiple drones using ardrone_autonomy

asked 2018-03-27 09:30:23 -0500

oha gravatar image

Hi all, I am using ROS Kinetic on Ubuntu 16.04 and am trying to fly and control multiple drones at the same time running a single script using ardrone_autonomy. I manage to connect to the two drones, and get 2 separate nodes created for 2 separate instances of ardrone_driver.

My problem is that the different topics of ardrone_autonomy only have a single instance. This means that all my drones read off of the same topics (i.e. all drones read off of the same /ardone/takeoff topic) and thus get the same commands. I would like to have a way to give each drone a different command, either by having 2 separate takeoff topics and cmd_vel topic and land topics and so on, or by any other means possible.

All the posts I can find are from 2014 or older, and I am not sure if any significance changes have been made since, and where this stands now.

Has anyone gotten this working? Any help would be greatly appreciated.

edit retag flag offensive close merge delete

Comments

Hi man,

I am trying to do the same thing for a school project. I am new to ROS and I honestly do not know where to start. Would you be able to share what you did?

Thanks in advance!

melhazzouri gravatar imagemelhazzouri ( 2018-06-25 13:07:05 -0500 )edit

For what I did to get the multiple drones working I tried to explain the best I could in the answer below. I will be glad to tell you how I got started in general and recommend some things, but I will need you to post a question so I am not limited on characters and stuff when answering.

oha gravatar imageoha ( 2018-06-26 00:37:53 -0500 )edit

Link your post here or tell me the numb er of the post (you can see it in the URL) so that I can find it.

oha gravatar imageoha ( 2018-06-26 00:38:46 -0500 )edit

Hi, https://answers.ros.org/question/2953... The question is called "Controlling multiple drones using ROS and the number is 295383. Thank you!!

melhazzouri gravatar imagemelhazzouri ( 2018-06-26 10:30:47 -0500 )edit

hi oha ! can yoou please send me your current code in which all the drones follow the same command? because im currently at this initial stage and want to have any sort of code for multi drones to work in swarm...pl send me all the files(codes) including launch file and others too. thx in advance :)

ahmad abid gravatar imageahmad abid ( 2018-08-22 14:25:06 -0500 )edit

I guide I made with some code can be found here: https://gitlab.com/ohanoch/MSS_Guides... and code I used to implement it can be found here: https://gitlab.com/ohanoch/MSS_drone_...

oha gravatar imageoha ( 2018-08-23 10:55:56 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-04-10 06:40:44 -0500

oha gravatar image

updated 2018-04-10 07:01:09 -0500

Ok, so I have an answer - remap! There is an option inside the launch file to remap one topic to a different name. Here is an example of how I remapped /ardrone/takeoff to /ardrone1/takeoff:

<remap from="/ardrone/takeoff" to="/ardrone1/takeoff"/>

I put this line before the node initialization line: <node ...&gt;<="" p="">

Using remap I could now remap all the topics I wanted for the first drone to change "ardrone" to "ardrone1" and for the second drone remap again, but this time to "ardrone2" - thus getting two separate topics for the two drones, namely for /ardrone/takeoff example we get:
/ardrone1/takeoff
/ardrone2/takeoff

Now I had a problem that I wanted to do this for ~30 topics. As far as I can tell there is no way to just change /ardrone/ with /ardrone1/ and thus with a single remap changing all the topics at once. I looked around and found some github issues mentioning that it is not supported, and in any case I couldn't figure it out. Sadly this meant I had to manually remap the 30 topics (if someone found a better way I would be very happy to see it).

But I do not want to manually edit 30+ topics every time I want to add another drone, its not fun and it looks terrible. So what I ended up doing is have a BASH script that had a for loop for the amount of drones I want and ran the launch file that many times. In order for this to work I now needed to change my launch file and add the following lines:

<arg name="droneip" default="192.168.1.1" />
<arg name="drone_name" default="ardrone"/>

In order to accept in arguments for the drone name and IP. Then in my remap commands I needed to change ardrone1 with $(arg drone_name) to look like the following:

<remap from="/ardrone/takeoff" to="/$(arg drone_name)/takeoff"/>

and when initializing my node I need to make the node name change with name="$(arg drone_name)_driver1" and the ip change args="-ip $(arg droneip)" so my node initialization looks as follows:

<node name="$(arg drone_name)_driver1" pkg="ardrone_autonomy" type="ardrone_driver" output="screen" args="-ip $(arg droneip)">

My BASH script is short and looks as follows:

#!/bin/bash
for (( i=1; i<=$1; i++))
do
    roslaunch launch_multi_drone.launch drone_name:=ardrone$i droneip:=192.168.1.$i &
    sleep 15
done

Now everything seems to work.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-03-27 09:30:23 -0500

Seen: 461 times

Last updated: Apr 10 '18