Running multiples drones in a simulation

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.

1 Like

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
2 Likes

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.

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, …).

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?

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
1 Like

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?

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…

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.

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.

1 Like

How exactly did you modify the .drone file? I downloaded the v4.4.0 firmware but sphinx crashed when I attempted to run sphinx. The downloaded firmware is in .plf format, while the original firmware is in .ext2.zip format.

The plf file is for a real drone. Here is how one can use v4.4.0 instead of the latest version:

sphinx /opt/parrot-sphinx/usr/share/sphinx/drones/bebop2.drone ::firmware=http://plf.parrot.com/sphinx/firmwares/ardrone3/milos_pc/4.4.0/images/ardrone3-milos_pc.ext2.zip

Thanks! I am able to download different version of firmware now. When I apply other version of firmware and run multiple bebops in the same scene, it gives segmentation fault. What might be the cause?

“bqla” said that he/she was using a Bebop2 4.4.2 firmware successfully with two simulated drones.
Have you tried with that firmware version?
Do you have any backtrace of this segmentation fault that you could share here?

In any case, please note that multiple drones in the same simulation is an advanced/experimental/may-be-unstable feature.

Regards
Nicolas

I solved the crashing issue by adding “::with_front_cam=false” at the end of one of the sphinx command like this: “sphnix <.drone file>::with_front_cam=false”. Not sure why, but it works!

I am having an issue when running two drones on the same simulation, basically gazebo is launched successfully but I can’t connect to any of the drones. Does anybody know what could be happening here?
The error that I got is

[Err] [ContactManager.cc.282] Filter with the same name already exists (default/body)! aborting

This error message does not show up when I open the simulator with one drone, that is why I believe it’s the reason.

My drones files are:
<?xml version="1.0" encoding="UTF-8"?>

<machine_params
low_gpu=“false”
with_front_cam=“false”
with_hd_battery=“false”
with_flir=“false”
flir_pos=“tilted”/>
-5 -5 0.8 0 0 0
eth3

<stolen_interface>wlx503eaa7a5259:eth1:192.168.42.1/24</stolen_interface>

And

<?xml version="1.0" encoding="UTF-8"?>
<drone
  name="bebop2"
  firmware="http://plf.parrot.com/sphinx/firmwares/ardrone3/milos_pc/latest/images/ardrone3-milos_pc.ext2.zip"
  hardware="milosboard">
  <machine_params
    low_gpu="false"
    with_front_cam="false"
    with_hd_battery="false"
    with_flir="false"
    flir_pos="tilted"/>
  <pose>default</pose>
  <interface>eth1</interface>
  <!-- 'wlan0' may need to be replaced the actual wifi interface name -->
  <stolen_interface>wlan0:eth0:192.168.42.1/24</stolen_interface>
</drone>

I am running the simulation like this:

sphinx bebop2.drone bebop2_2.drone

First drone is:

<?xml version="1.0" encoding="UTF-8"?>
<drone
  name="bebop2_2"
  firmware="http://plf.parrot.com/sphinx/firmwares/ardrone3/milos_pc/latest/images/ardrone3-milos_pc.ext2.zip"
  hardware="milosboard">
  <machine_params
    low_gpu="false"
    with_front_cam="false"
    with_hd_battery="false"
    with_flir="false"
    flir_pos="tilted"/>
  <pose>-5 -5 0.8 0 0 0</pose>
  <interface>eth3</interface>
  <!-- 'wlan0' may need to be replaced the actual wifi interface name -->
  <stolen_interface>wlx503eaa7a5259:eth1:192.168.42.1/24</stolen_interface>
</drone>

Sorry for the bad formatting

Try downloading firmware 4.4.2 from http://plf.parrot.com/sphinx/firmwares/index.html and modify all .drone files - you have to change firmware to correct path to file, e.g.:

firmware="/home/username/firmware/ardrone3-milos_pc.ext2.zip"

It worked for me.

Hi! Thanks for your experience. I tried to download the firmware 4.4.2 and used it in the .drone file. I could launch (two drones) in the sphinx successfully. However, when I tried to connect to the drone using bebop_driver, I always got an error:
[ERROR] [1584316039.436036190]: [ARDISCOVERY_Connection] 00:47:19:436 | ARDISCOVERY_Connection_ControllerInitSocket:669 - connect() SO_ERROR: 111 Connection refused
[ERROR] [1584316039.436087379]: [ARDISCOVERY_Device] 00:47:19:436 | ARDISCOVERY_Device_NewARNetworkAL:243 - error: Socket access permission denied
[ERROR] [1584316039.436104709]: [ARCONTROLLER_Network] 00:47:19:436 | ARCONTROLLER_Network_New:355 - error: Error during the getting of the ARNETWORKAL_Manager from the device

When I changed the firmware to the latest version, I did not get the connection error, but I failed to launch two drones in sphinx. Do you have any clue how to solve the problem?

Hi!
Can you run at least one bebop_driver (connect to one drone) when you are running sphinx with two drones? What IP addresses are you using for drones? Remember that if you want to connect to two drones you have to got two interfaces (for example wifi and eth).
When I was running it I used separate launch file for each drone driver.
I think it would be easier to help you when you show your .drone and .launch files… :thinking: