Tuesday, June 26, 2018

Overview

*Still a work in progress

For those of you interested in learning to develop similar Gazebo simulations, I will enumerate a rough roadmap of what needs to be done.  This will definitely take more than an hour to figure out, and probably more than 8 hours for most people.  But hey, it took me months to understand this all, so it's gotta be better than that right?

1. Ubuntu 18.04


While most of our initial testing was done on Ubuntu 16.04 and later Ubuntu 17.04 (which isn't worth it, stick to LTS - "Long Time Service" - distos), from here on out (June 2018), we used Ubuntu 18.04.  No, I have not tried to make this work on Windows and Mac, but this is why I am giving you this rough guide so that you can figure it out yourself if you want.

2. Install the components required to run SITL


SITL ("Software in the Loop") is a special simulator that is designed to simulate autonomous quadcopters, planes, and rovers.  It is able to simulate not only the quadcopter's behavior, but also certain aspects pertaining to the environment that the quadcopter is in (things like wind speed and direction).

In order to run SITL and interface it with Gazebo, you will need to start by installing 3 pieces of software

Ardupilot

Mavproxy

Dronekit-Python


Be sure to run several Dronekit-Python examples to make sure that these programs are properly installed before moving on.


3. Install Gazebo


I recommend installing Gazebo-9 for this particular project.  I started using Gazebo-7 when I started, but upgraded to 9 because it comes pre-installed with a wind plugin that is extremely for simulating realistic wind for our quadcopter.  I also feel that Gazebo-9 has many more prebuilt models available (including many cars).  I am not entirely sure that Gazebo-7 doesn't have these same models, but why risk it?  It is easy enough to install Gazebo-9 over older versions, as there are tutorials online to do so.

Important things to know when installing Gazebo:
*The location of the 'worlds' folder.  In my case it was in /usr/share/gazebo-9/worlds.  This is important because it will have plenty of .world files that you can modify to create your environment.

*The location of your models.  Mine was in my home folder /home/.gazebo/models.

4.  Test Running SITL on Gazebo


At this step, I am assuming that you have a Dronekit-Python script already designed to move the quadcopter, allowing you to see if the connection between SITL and Gazebo is working.  You can use one of the examples from the dronekit-python GitHub if you wish.

You will need 4 terminals to run  all the parts required

Starting Gazebo

Starting Ardupilot

Starting Mavproxy

Starting Dronekit-Python


Example Bash Script


Here is an example bash file to run all 4 commands:

#######################################################################
GAZEBO_RESOURCE_PATH="$GAZEBO_RESOURCE_PATH:/usr/share/gazebo-9/worlds" gazebo --verbose /usr/share/gazebo-9/worlds/$uofu.world &

sleep 10

xterm -e python ~/ardupilot/Tools/autotest/sim_vehicle.py -v ArduCopter -f gazebo-iris --console -L $UofU -m --mav10 -I0 &

sleep 15

xterm -e mavproxy.py --master=udp:127.0.0.1:14550 --out=udpout:192.168.0.100:14550 --out=udpout:127.0.0.1:14552 --out=udpout:127.0.0.1:14553 &

sleep 15

xterm -e python ~/dronekit-python/examples/SimMission/SimMission.py --connect 127.0.0.1:14552 &

#######################################################################

The sleep statements allow me to see the status of each individual program, looking for errors before the next one starts.

Once you can connect SITL to Gazebo, you can move on to the next step.


5. Create your Gazebo Environment


This is probably the reason that you are looking at this blog in the first place: inserting a real-world location into Gazebo for simulation is pretty cool, and what sets this simulation apart from others.

The trick to getting these worlds into Gazebo is to find DEM (Digital Elevation Model) files and turn them into matching .dae and .stl files using Blender.  Currently, this is a very hands-on process, but I am currently in the process of automating it using Java.  I will write a post detailing it when I get the chance.

DEM Files

Blender

Blender to Gazebo



6. Useful Applications of your new Gazebo World

Great!  You got your Gazebo World set up.  What do you do now?

Recording Videos

Actors

Multiple Quadcopters

Wind Plugin


7. Useful Skills

These are several topics that could prove useful for those seeking to develop their own version of this simulator.

Modifying Gazebo Worlds

Docker

SITL commands

Basics on Blender



8. Future Plans

These are things that I want to look into and get done before December.

Automation

ROS

Integration with BRECCIA

No comments:

Post a Comment