The future of robotics development, including drones, is powerful simulation, which makes it possible to achieve faster development and better performance by reducing the "trial and error" process of testing everything with physical machines. The Dronecode projects have long used a number of powerful drone-specific simulators, including both "hardware-in-the-loop" (HITL) and "software-in-the-loop" (SITL) programs.
But as drone simulation goes beyond simply simulating the drone itself and extends to simulating an entire robotic system, including swarming, pathfinding, environmental awareness and autonomous mapping and navigation without GPS, you need even more powerful tools.
The gold standard for advanced robotics simulation is the ROS/Gazebo package, which is now supported by ArduPilot as part of the Dronecode project (ROS is the Robot Operating System, created by the Open Source Robotics Foundation, which is part of Dronecode).
The APM Dev wiki now has a great page on how to use it. Here's a sample, but click through for the whole thing.
ROS and Gazebo are a well-known and respected robotics framework and simulator:
- The ROS framework contains many “packets” of software for performing robotics tasks. It allows you to model the environment (including indoor environments with walls, doors etc) and run your own control algorithms for autonomous flight.
- Gazebo supports several different Copter models (at time of writing there are 6 URDF models in the rotors_simulator package). These can be extended to include support for additional sensors and other behaviours.
Tip:The ROS/Gazebo is particularly useful for defining autonomous indoor flights.This article shows how you can replace the default SITL Copter simulation with one supplied by Gazebo and control the autopilot using the ROS framework (instead of Mavproxy or some other Ground Control System).
An architectural overview of how ROS/Gazebo integrate with SITL is shown below:
Comments
Hello Chris,
Now the ArduCopter has been supported for HILS test?
Thanks
This thread is a bit old now but...
I am researching what our options are for building an autonomous rover. I am trying to reduce our workload and and avoiding writing anything from a blank page as much as possible.
Currently I am thinking a combination of Ardupilot and ROS is the best way to go as I have a functioning pixhawk used to build a quad. We are going to adapt it to our rover vehicle and use Ardurover assuming this is the best choice.
I would also like to make use of some ROS packages.
This link you provided for architectural overview of how ROS/Gazebo integrate with SITL is now dead. It is something I would like to look at if I could.
Cheers
Alex
@Aurelien
Thanks for the installation scripts, really helped me get up and running on ROS quickly! I wanted to focus on path planning algorithms and SLAM so decided to extend the RotorS package with my own simulated control systems and hold off on the ArduPilot integration for now. I documented all my code as well as posted it on github. It's all written up here:
http://wilselby.herokuapp.com/sample-page/research/arducopter/ros-i...
or there's these videos:
- Developing attitude and position controllers, an autonomous waypoint navigation mode, and simulating a camera sensor for FPV flight
https://www.youtube.com/watch?v=4he7mPV41Xc
- Using a simulated Kinect to create a 2d map of an office environment, then using the ROS navigation stack to localize and navigate using that map to avoid obstacles.
https://www.youtube.com/watch?v=vAkZesdNtoc
- Using the simulated Kinect to create a 3d map of a kitchen environment using the ROS MoveIt! framework, then using MoveIt! to develop 3D desired trajectories to navigate and avoid obstacles.
https://www.youtube.com/watch?v=NRzeQD_Etog
Will try to get this integrated with my quadrotor next now that I understand the basics of path planning/sensing/obstacle avoidance using the ROS architecture.
Thanks again for providing the ground work.
- Wil Selby
@Sj
Hi Sj !
We finished at last :-) (better late than never)
We posted it on DIY with a video : New ArduPilot plugin for Gazebo
In the message there are github links to the source code.
However there is not yet the link to the DroneAPI python code.
We will update the installation/usage tutorial in coming weeks.
Hopefully it will be useful for you!
Hi @Aurelien ROY
Any updated regarding your work?
@Sj
For the moment I am working on the interface between ArduCopter and ROS/Gazebo. I'll propose my code on Ardupilot's github soon (maybe within 2 weeks). Since I do not have my hands on an Odroid I have not yet looked at dronekit.
The ROS/Gazebo simulation involves MavProxy as one of its end terminals to type in flight commands (arm, ...).
From a first glance at the Odroid / dronekit connection to Ardupilot, it may be possible to connect dronekit to the simulation MavProxy (just some IP/ports to modify) and it would work out-of-the box for flight commands.
However if you have a camera, or any other sensors, handled by your Odroid / dronekit, in order to simulate it you would have to create a new interface between dronekit and ROS/Gazebo. I don't know if anybody is working on it. However with the growing popularity of Odroids aboard drones, and with the first interface between ArduCopter and ROS layed down, the interface between dronekit and ROS/Gazebo may arrive in a couple of months. Maybe you can post on Ardupilot's forum/github to request for this feature, it may make it come out sooner.
If I have any news, I'll post you a link on this page.
@Aurelien ROY
Oh okay. Yeah it would be awesome!
When you say "still under development", how far ahead would you say it is at the moment and how can I stay up-to-date with its development? Thanks!
Patrick,
Sorry I cannot help you with the HIL mode.
Maybe you can try to post your questions on the APM forum
About the "Connection Refused", "sleeping" message, I am unable to pinpoint the source of the problem without more infos/debug. And since it is not your priority, then maybe we shall debug it later when you will get back to Gazebo.
Good luck for the HIL !
Aurelien, I am running Ardupilot on my Pixhawk. I am really struggling with two things: 1) Setting the Pixhawk into HIL mode and 2) Writing a waypoint to the Pixhawk. Once I have these in place, I can probably figure out how to arm and start the mission and watch my simulation environment respond.
As far as running the SITL stuff, I am running the command exactly as you wrote it. And you are correct that my line 314 is "pushd $VEHICLEDIR"
In all honesty, I was only trying the SITL setup to see if I could gain any insights into how I could get HIL working. Like I said above, I am really struggling with basically talking to the pixhawk.
@Sj
Unfortunately not yet, or at least nothing published on it.
And the ROS/Gazebo simulation for ArduCopter is still under development.
Nevertheless when the dronekit-python will be incorporated in the simulation, it will indeed be awesome.