Servers by jDrones

Multi systems patrol simulations


(Khancyr) #1

Hello everyone,

I am often asked about what can be done with ArduPilot or with ROS, and my answers are always : you can do just about anything you’d like to do! ArduPilot is not just an autopilot for drones, it is also a well-grown robotic platform ! It is not the same as ROS, in the sense that ROS concentrates more on the high level tasks, whereas ArduPilot focuses on low-level vehicles control ! Both have strengths and drawbacks. And by using both, you will be able to create incredible robots !

During my PhD, I tried to focus my work on multi-robots systems, which are also known as swarms (from an academic perspective, swarms are just a special case of multi-robots systems). ROS by itself can excel for single robot design, but is difficult to use on multi-robots systems and flying robots like multi-rotors. On the other hand, ArduPilot allows to use multi-rotors more simply, and with safe behaviors.

In order to demonstrate the usefulness of multi-robots systems and be able to evaluate the global performance of the system, I set up some identical simulations with ROS and ArduPilot. The goal was to demonstrate the performance of a multi-robot system with various numbers of quadcopters, and rovers on patrolling tasks. I then simulated systems with 1 to 20 quadcopters, and 1 to 20 rovers and system with the same number of quadcopters and rovers. Those were simulated with SITL from ArduPilot, and I will detail at the end the few modifications that I made and that I am pushing into ArduPilot. The patrolling task was done with ROS. Each vehicle got a Mavros instance (that is, a ROS program that makes the bridge between ROS language and MAVLink), a simple python script that handles the patrolling behavior, and a master python script that controls the group. But that was too simple ! So I implemented 3 patrolling behavior, that are quite simple :

  • Random patrol (RANDOM). It is a decentralized algorithm. Each robot will go at a random patrolling point

  • Reactive patrol (HIGHEST). It is a centralized algorithm. When a robot arrived at his destination, it notifies the master script (like a base) and gets the next patrol point.

  • Cyclique patrol (CYCLE). It is a decentralized algorithms. At start, each robot create a patrol cycle.

For the full detail of the simulation models and hypothesis, please refer to my PhD manuscript and/or directly the code !

The results were those graphs for 1 hour of patrolling on this field, the number represent the patrol points :

For copter only:

For rover only:

For rover and copter :

All on same graphs :

You can see a video here of the patrolling :

I won’t discuss the results here, but you should be worried by SKYNET ^^ as the group behavior outperform largely the single robot patrolling ! But what it was really interesting, it is that I could make all those simulation on my own laptop : just a i5 + 8go RAM and with simulation accelerated 10 times ! Right ! (If I find the budget to build 20 quads and 20 rovers, I would be able to confirm the simulation with the real platform)

ArduPilot allows to simulate entire fleets of robots with the same code that will be embedded and at a small cost ! That is right, for those kind of behavior, you don’t need to use big simulator like Gazebo on big 32 cores servers. Simulate simply with SITL !

I don’t say that you should use Gazebo or other well known robotic simulator, but when it comes to simulate only behavior without worrying about collision, SITL with excel !

All these were permitted thanks to OPEN SOURCE and numerous contributions ! PR welcome !


Where is your code :

Github ardupilot and branch PhD on my fork : I am currently getting back those changes into ardupilot master.

Modifications done :

  • allow to set sysid at the start of SITL (PR in master)

  • disable mavlink routing on a channel. Finally I didn’t use this, this was intend to prevent mavlink spam on a broadcast channel for the monitor. I still believe that we need a way to stop mavlink routing explicitly on some channel, as on swarm configuration, there is to much spam.

  • clear battery failsafe : I didn’t use this, I got another code that I will push to allow to refill the battery and clear the failsafe. On my code, the ROS part is monitoring the battery and decide when to go on base to change the battery.

  • disable MSG_POSITION_TARGET_GLOBAL_INT sending, as there is a bug in MAVROS. It has been reported and I need to make a fix on MAVROS.

  • Disable some stream and unused features. This won’t be push back on master.

  • Prevent switching in guided is EKF is not ready for Rover. (Need a PR)

  • disarm rover at the end of RTL : I am not sure we want this into master, maybe with a parameter.

  • correct battery estimation for rover : PR done.


I want to do the same with Gazebo :

If you need only a 3d visualization see . This can be adapted to any 3D framework you want.

To use the gazebo plugin : . Beware, the simulation of rover isn’t simple yet as the ground contacts are a pain and the friction gives a hard time to make a skid steering rover.

Why use ArduPilot over PX4:

PX4 don’t support rover and surface vehile like boat and sub. Moreover, the governance of ArduPilot is open whereas PX4 is money dronecode driven

I don’t understand anything but the colors were nice :

Thanks you.

(Sean Erickson) #2

That is excellent! I am interested in helping you realize this in the real world.

I did something similar on a closed source platform a couple of years ago.

I own 5 Arduplane capable aircraft, and would like to work with you on the coordination of all of them flying and doing a coordinated mapping mission. I could easily field another 5-10 aircraft.

Please contact me to discuss.
UAVSean(at) g mail. com

(Khancyr) #3


Sorry, I didn’t respond you properly, I was busy with my PhD defence.
Unfortunately, won’t have time to setup a real demo, but I could assist you on some part if you need !

(ppoirier) #4

Félicitations Pierre It is great to see your thesis in action, one of the few that is totally opened and relatively easy to replicate, thank you for that

(Sean Erickson) #5

Hello Pierre,
Thank you for your response! I’ll apologize in advance for my n00b questions.
To keep it simple, I’d like to duplicate your setup while I learn (by following your lead).
(I have SITL setup on Win10 with MAVProxy, and Mission Planner, so I am slightly familiar with the SITL setup).
It looks like you are running in a Linux environment:
1.) Linux - Which version of Linux do you recommend (I see QGndCtl has a minimum of [Ubuntu Linux 14.04 LTS], Or, did you go with Lubuntu 18.04? You mentioned you were able to get all of these instances up and running on an i5 and only 8GB RAM, which is awesome.
2.) .sh scripts - I see you have some “Opening/Starting/Setting” .sh scripts, and you are passing parameters to them (like 5 copters and 5 rovers). I am a novice at writing .sh scripts, would you be willing to share these - Did you put these over in your Git Repo (sorry if I didn’t see them, could you tell me which files to look for?)
3.) MAVROS - I am not familiar at all with this, would you be able to point me to a recommended setup (websites/how to’s/tips)? Please forgive my naiveté! I am currently looking at [].
4.) Companion Computer - So, (when I do this with actual machines - not simulated) in order to run MAVROS, I will need to have a companion computer onboard each of my vehicles - I am currently planning on the RPi3a - will that have enough outputs (it only has one USB port)? Or should I go up to the RPi3b (four USB ports)? Or some other?
5.) Companion Computer OS - What OS would you run on the Companion Computer?- I am currently planning on running Raspbian.
6.) Companion Computer Python - It looks like you have running on each instance (vehicle). Again, please forgive me if I missed these, but could you please point me to these Python scripts?
7.) - I presume this script is pulling the Battery voltage (and other things) from the Pixhawk/Arducopter (via telem2 port) with a MAVlink request, and then monitoring the voltage until it gets low (preventing the FailSafe from executing), and then telling the that it needs to RTL for a Battery Swap, correct?
8.) - Would you be willing to share this code? (again, I may have overlooked this).
9.) Reports - Your reports are excellent, I like the roll call, and monitoring all of the metrics that you did.
10.) Gazebo - It sounds like you did not use gazebo for your simulated MAVROS environment, correct? I looked at your Gazebo ReadMe in Git, but I am unfamiliar with Gazebo. I will follow your Readme, and set it up and see how it works. You state above that it is processor intensive (32 core Servers), that’s pretty heavy!

Last, but not least, could you please email/link your PhD manuscript? I think it would be a very interesting read.

I know you are very busy, and I understand if you are not able to respond in full. Regardless, your information shared up to now has helped me to see possibilities that I was unaware of and unfamiliar with - my sincere Thank You.

I am looking forward to getting these off the ground! When I do, you’ll have to come and see!

C’est vraiment gentil de votre part, merci!

P.S. I agree with Monsieur PPoirier (@ppoirier) - Never too old to hack!