Tutorials/CloudSim/1.0/start simulation

Introduction === This tutorial covers:
 * logging in the Cloudsim web app
 * launching and terminating virtual simulation machines in the cloud
 * starting and stopping ROS and the DRC simulator on the virtual machine
 * connecting to the simulation machine using rviz

Prerequisites === This tutorial assumes that you have a Google email account that has been granted access to a running CloudSim instance.

On the local machine, install the drcsim package. This will install the Atlas robot meshes on your local machine, as well as the rviz tool. Don't forget to source the setup.sh file if it is not executed in your ~/.bashrc. (see installation guide)

sudo apt-get install drcsim openvpn . /usr/share/drcsim/setup.sh

Log in to Cloudsim ===

Point your browser to the CloudSim instance. You should land on the login page.



Following the login link should bring you to the OpenID page where you can choose the provider. At this time, only Google is supported.



Once you have entered your credentials at Google, you should be redirected to the version page. Follow the "Console" link to get to the web app.



This is what the Cloudsim console looks like for normal users when no simulations are running. The top widget section allows you to launch a variety of simulation configurations (only one for CloudSim 1.0), while the lower section, constellations, shows the running instances.

Cloudsim is capable of launching multiple machines that work together for during a single simulation campaign. Cloudsim uses the term constellation for this concept. In CloudSim, Machines can only be launched within the context of a constellation, so it is possible to encounter constellations that only contain a single machine.



Launch a DRC cloud simulation machine ===

In the "Launch a machine constellation" section, selct "drc_sim_latest" from the drop down menu and press the "Launch" button. After a few seconds, you should see a new section appear inside the "Constellation" section. Here's what happens then:


 * A constellation with a unique name is created. It contains one simulator machine.
 * A new virtual machine with GPU is started with Ubuntu 12.04 precise
 * X and OpenGl are configured for the GPUs (with the current NVidia drivers)
 * Packages for VPN, ROS, Gazebo and DRC simulator are installed
 * The machine has rebooted

The whole process can take up to 15 minutes. Once done, the machine state should indicate "running" with a blue dot. X and GL should also indicate "running" with a blue dot. The graph shows latency measures between the CloudSim virtual machine and the simulator machine instance. It is updated periodically.



Start and stop a Gazebo simulation using ROS === The widget above the graph allows you to start and stop a ROS package from CloudSim. It is used to start the DRC simulator and Gazebo. Type in the package, launch file and arguments and press the "Start" button.



After a few seconds, the red dot should turn blue, indicating that Gazebo is running.



Connecting to the simulator instance ===

It is possible to connect to the simulator machine with a terminal using ssh. You can also establish a VPN connection with the simulator and connect via ROS. Both these connections need keys to be installed on your local machine. You can download these keys (as well as useful scripts) by following the link "Download keys". This should save zip file on your local machine (in the ~/Downloads/simulator_c_05fe3f08.zip in this example). Extract the content in a directory in your local machine.

mkdir cloudsim_start_tutorial cd cloudsim_start_tutorial unzip ~/Downloads/simulator_c_05fe3f08.zip

. ./simulator_c_05fe3f08/ssh.sh

In a separate terminal window, launch the VPN (Virtual Private Network): cd simulator_c_05fe3f08 sudo openvpn openvpn.config

Wait until you see the completion message:

Fri Dec 7 15:39:20 2012 Initialization Sequence Completed

You can now launch ROS nodes such as rviz from your local machine. If you're going to work with drcsim, you should have already sourced the appropriate setup file (e.g., `. /usr/share/drcsim-1.1/setup.sh`). That will ensure that your local ROS nodes have access to drcsim-specific resources such as visual meshes that are used in rendering the robot model.

Before running ROS node, you should source the `ros.sh` file provided in the zip file for the simulation machine; it will configure your local ROS environment to communicate with the remote ROS master over the VPN link. E.g., to run rviz locally:

. simulator_c_05fe3f08/ros.sh rosrun rviz rviz



Now you can do the same things that you can do when running the simulation locally, such as visualizing and logging sensor data.

TODO: gzclient (needs GAZEBO_MASTER_URI setting in some .sh file)

Terminate the constellation and its machines ===

Press the "Terminate" button on the top left corner of the Constellation section. Within a few seconds, you should see the Machine state dot turn to orange and the "running" will change to "shutting down".



Once the state of every machine indicates "terminated", the constellation will not appear if the browser window is refreshed.