How to launch your Gazebo simulations in The Construct
So you have reached The Construct and signed up for an account. Wise move! Now it is the time to start simulating.
Probably you already have some simulations of yours that would like to run in The Construct. This post will teach you how to do it easily for the Gazebo/DRC simulators.
It all starts with a big bang…
Preparing the simulation files
In order to launch in The Construct your already existing simulation, you have first to pack the files of your Gazebo simulation into a zip file. OSRF (the creators of Gazebo) suggest the following precise directory structure (not mandatory):
/YOUROBOT_description * package.xml CMakeLists.txt /urdf YOUROBOT.urdf /meshes mesh1.dae mesh2.dae ... /materials /cad /YOUROBOT_gazebo * package.xml CMakeLists.txt /launch * main.launch * other.launch ... /worlds * YOUROBOT.world * /models world_object1.dae world_object2.stl world_object3.urdf /materials /plugins /ANY_OTHER_PACKAGE /launch ...
If you follow that structure everything will be more shareable and easy to find bugs, but it is not required to have such structure to work in The Construct.
We recommend that you check that your simulation packages compile in your local system, using the same ROS version that you will use in The Construct. Again, it is not mandatory because you can debug errors later in The Construct.
Once you have all the files and directories prepared, compress them into a zip file. Now your simulation is ready to be executed on the cloud.
Example zip file
For the rest of the tutorial we recommend you to use the simulation example that we have prepared. Use this zip file as an example. The zip file is a complete example containing most of the features you may need in any simulation including the definition of models, the description of a robot which requires controllers, kinect camera with its plugin publishing in ROS topics, and a couple of extra required packages to make the robot move. The file contains all the packages and files required for the following simulation.
Have a look at the file and keep it as a reference for your future projects in The Construct.
Upload your simulation
To upload your zip file to The Construct, go to sw.theconstructsim.com, sign in, and select World icon at the top of the screen. The following screen must appear.
On that screen, select the Plus icon that appears on the left hand side, and then select the zip file to start uploading the file. It will store the simulation file in your zone at The Construct. After that, your uploaded world will appear as available to be launched in a simulator.
Choose a simulator
Next step is to select one of the Gazebo simulations available. For this, select the Home icon at the top of the screen. The following screen will appear.
For this example, select the Gazebo 4.0. Press over the simulator cube and then press Run Simulator on the screen that will appear with the simulator details. After a while an empty world of Gazebo will appear.
At this time you can start creating a new simulation from scratch by using the Gazebo Menu Panel. We will explore it in following posts, but for now, you are going to load the simulation you stored in your zone.
In order to launch a world, go to the scroll down menu on the top right corner, that says Your Worlds. Press there and the scroll down menu will display.
Launching a world
The scroll down menu contains a full list of worlds, separated in two groups: My Worlds (the worlds you have uploaded) and Gazebo Worlds (a list of worlds provided by Gazebo that you can launch). Scroll until you find the world you want to launch (in this case, the iri_wam world).
Once you have selected the world, press the Red Play button to launch that world. A pop up will appear on the screen asking you to select which launch file should be launched. Select main.launch from the iri_wam_gazebo package.
The following screen should appear.
IMPORTANT: Now press the Gray Play button of the simulation screen to start it (by default, the example provided starts paused. You can configure it otherwise later).
Using the console
If you have included extra packages or extra launches you can launch them manually using the provided web console. The web console is directly connected to the computer that runs your simulation. You can interact with it in the same way as you do in your local computer. You can launch other packages, you can record topics, you can modify your simulations.
Now we are going to use the console to launch a demo that will make the robot move between the two bowls. For this purpose, just open the console pressing the red button at the top of the screen.
Then type the following command (be sure that the simulation is not paused before issuing this command, i.e. that you pressed the Gray Play button):
> roslaunch iri_wam_aff_demo start_demo.launch
At this point you should see the robot moving like in the following video:
Change the simulation and relaunch
It may happen that you want to change parameters or situations in your already running simulation. You can perform your modifications directly in The Construct.
To perform modifications, you have two options:
- Just use the Linux console you opened above to perform your changes in the files. Navigate to the proper files through the directories and perform the changes.
- Use the integrated IDE (see picture). This IDE allows you to move through the directories and edit and save your mods.
Once your packages have been changed at your will, use the red button Reloads the current world to relaunch the simulation with your applied changes. By pressing that button, your whole simulation will be recompiled (if required) and then relaunched.
Terminate a simulation
THIS IS VERY IMPORTANT: in order to finish your simulation you must terminate it. In order to terminate a simulation, select the red button Terminate Simulation
Just doing Log Out or closing the web browser will not terminate your simulation. If you only do that, then your simulation will keep running in our servers and you simulation time will still be running. Hence, depending on your plan, you may consume all your allocated hours (there is though an system that will switch off your simulation after 30 minutes of inactivity).
This post indicates how to launch one of your already existing Gazebo simulations. You can also interact with the running simulation through a web console or IDE and create one simulation from scratch.
It may happen that you need specific ROS packages for your simulation that are not included in the current cube. If that is your case, do not hesitate to contact us for including them as quick as possible.