Running multiples drones in a simulation


#1

HI.

I’m new with sphinx and I’m trying to start a simulaition with 2 drones but I can’t connect to them after the simulation starts. I’m using python for that purpose.
I read the documentation and it’s says that I have to set in the .drone file the ip 192.164.42.1 for the stolenInterface parameter, but I don’t understand how can I have multiples drones with the same ip.
So my questions are:
is it possible to have multiples drones ina a simulation using sphinx? and in case that the answer is yes, can someone give me an example of the .drones files for that case?

Thanks.


#2

To simulate multiple drones, you must make sure that each drone has a unique name and its own network interface (or no interface at all). For instance, this will starts sphinx with two Bebop 2 named bebop2 and other, one that steals wlan0, and one that does not have any interface:

sphinx /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone
/opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone::name=other::stolen_interface=

If you have multiple wifi interfaces available, you can set the stolen_interface parameter of the second drone. For example:

sphinx /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone
/opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone::name=other::stolen_interface=wlan1:eth0:192.168.42.2/24

#3

if I just have one wifi interface can I control the 2 drones?
I’m using python with pyparrot to connect to the drones in the simulation but i find only one.of them.


#4

No, you must have two wifi interfaces to control two drones in the same world with pyparrot because it only supports WiFi and BLE interfaces. However, if you use Parrot SDK, you can also connect to the virtual interface (whose IP is provided by the instance property debug_ipaddr):

$ fdc get_property instances <instance_name> debug_ipaddr

The default address is 10.202.0.1 (then 10.202.0.2 for the second drone, …).


#5

How to connect to two bebop2 simultaneously using bebop_autonomy?
I have two interfaces. When I run Sphinx with only one drone using any of my interfaces, it is ok - I can easily run bebop_driver. When I run it with two drones, I cannot access to any of them. In bebop_node.launch file I have two IP addresses and two namespaces.
It seems like gazebo makes trouble, like there is some conflict. Maybe I have to create namespaces for each drone? Of course I put different names in .drone files.
What should I do?


#6

Hi,

I don’t know about bebop_autonomy, but in sphinx, you should at least rename one of the drones and use different pose and stolen_interface parameters or deactivate stolen_interface like so:

sphinx /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone::name=other::stolen_interface=::pose="5 0 0.2 0 0 0"

You may also want to try without the front camera for the second drone as it may cause issues:

sphinx /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone::name=other::stolen_interface=::pose="5 0 0.2 0 0 0"::with_front_cam=false

#7

Thanks for reply!
I have two separate wifi interfaces, in .drone files I have different names, poses, interfaces and stolen_interfaces. I also deactivate front camera for both drones.
When I run simulation with only one drone (using first or second file) everything is ok. But when I run both drones I have trouble.

This is the output from sphinx:

bqla@bqla-Lenovo:~$ sphinx  /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2_local.drone  /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2_local2.drone
Sphinx simulator version 0.29.1

connecting to firmwared version: 0.29.1
Gazebo multi-robot simulator, version 7.0.1
Copyright (C) 2012-2015 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 7.0.1
Copyright (C) 2012-2015 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 127.0.0.1
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 127.0.0.1
[Msg] created parameter server on http:8383
[Msg] connected to firmwared
[Msg] Preparation of firmware http://plf.parrot.com/sphinx/firmwares/ardrone3/milos_pc/latest/images/ardrone3-milos_pc.ext2.zip
[Msg] Preparation of firmware http://plf.parrot.com/sphinx/firmwares/ardrone3/milos_pc/latest/images/ardrone3-milos_pc.ext2.zip
[Msg] firmware /usr/share/firmwared/firmwares//ardrone3-milos_pc.ext2.zip.a3223a5b-4bd8-9583-54ad-cb89d0a34087.firmware supported hardwares: 
[Msg] 	milosboard
[Msg] Selected params to build .sdf file for bebop_leader:
	param flir_pos = tilted
	param kalamos_clip_far = 35
	param kalamos_clip_near = 1.5
	param low_gpu = 0
	param with_flir = 0
	param with_front_cam = 0
	param with_hd_battery = 1
	param with_kalamos = false
[Msg] Selected params to build .sdf file for bebop_follower_1:
	param flir_pos = tilted
	param kalamos_clip_far = 35
	param kalamos_clip_near = 1.5
	param low_gpu = 0
	param with_flir = 0
	param with_front_cam = 0
	param with_hd_battery = 1
	param with_kalamos = false
[Wrn] [BaseCameraSensor.cc:412] vertical_camera: parameter 'num_buffers' is now deprecated.
[Wrn] [BaseCameraSensor.cc:412] vertical_camera: parameter 'num_buffers' is now deprecated.
[Err] [ContactManager.cc:282] Filter with the same name already exists (default/body)! Aborting
I shd: omniscient_bebop_leader: created: generation=2 sample_count=4000 sample_size=184 sample_rate=1000 metadata_size=1083
I shd: time_bebop_leader: created: generation=2 sample_count=4000 sample_size=24 sample_rate=1000 metadata_size=128
I shd: battery_bebop_leader: created: generation=2 sample_count=4000 sample_size=8 sample_rate=1000 metadata_size=48
I shd: gps_bebop_leader: created: generation=2 sample_count=4000 sample_size=48 sample_rate=1000 metadata_size=245
I shd: omniscient_bebop_follower_1: created: generation=2 sample_count=4000 sample_size=184 sample_rate=1000 metadata_size=1083
I shd: time_bebop_follower_1: created: generation=2 sample_count=4000 sample_size=24 sample_rate=1000 metadata_size=128
I shd: battery_bebop_follower_1: created: generation=2 sample_count=4000 sample_size=8 sample_rate=1000 metadata_size=48
I shd: gps_bebop_follower_1: created: generation=2 sample_count=4000 sample_size=48 sample_rate=1000 metadata_size=245
[Msg] Drone bebop_leader[69abecfe09af8446a4f4aea6681b376cfae59839] loaded
[Msg] Drone bebop_follower_1[680158ee8c5108d80902c2a64a89e324a26b5cd8] loaded
[Msg] WEB DASHBOARD IS ACCESSIBLE at http://localhost:9002
[Msg] Instance efficacious_adelina[69abecfe09af8446a4f4aea6681b376cfae59839] started
[Msg] Instance garrulous_bellatrix[680158ee8c5108d80902c2a64a89e324a26b5cd8] started
[Msg] All drones instantiated
[Wrn] [IioObjectPrivate.hh:299] request for sample already ongoing!
[Wrn] [IioObjectPrivate.hh:299] request for sample already ongoing!
[Err] [ImuSensor.cc:475] WaitUntilQueueEmpty: Firmware has not asked for samples for more than 10 secs.
[Err] [ImuSensor.cc:477] 37, 0, 5
[Wrn] [IioObjectPrivate.hh:299] request for sample already ongoing!
[Wrn] [IioObjectPrivate.hh:299] request for sample already ongoing!
[Err] [ImuSensor.cc:475] WaitUntilQueueEmpty: Firmware has not asked for samples for more than 10 secs.
[Err] [ImuSensor.cc:477] 28, 0, 5
[Wrn] [IioObjectPrivate.hh:299] request for sample already ongoing!
[Wrn] [IioObjectPrivate.hh:299] request for sample already ongoing!
[Err] [ImuSensor.cc:475] WaitUntilQueueEmpty: Firmware has not asked for samples for more than 10 secs.
[Err] [ImuSensor.cc:477] 19, 0, 5

Simulation starts, there are two drones, but I cannot connect to them using bebop_autonomy.
As you can see I’ve got some errors that still occur… What do you think about it?


#8

I solve this problem by downloading previous version of bebop2 firmware (v. 4.4.2).
I can connect to both drones with bebop_driver, everything works fine except of front cameras - probably because of my hardware…


#9

Do you remember the version number of Bebop 2 that you were using when it failed? I’ll try to reproduce your issue but it may also have been an issue with bebop_autonomy.


#10

It failed with: latest version, 4.7.1, 4.7.0.
It works with 4.4.2. I didn’t try to run with older versions.