Tutorials/CloudSim/tips

By default, cheats (aka "development aids"), such as teleporting the robot and magically pressing on the pedals in the utility vehicle, are enabled. These tools should not be available during competitions. If you want to use them (for practice), you need to set the VRC_CHEATS_ENABLED environment variable. This must be done on the Simulation machine, which is where Gazebo will be launched.
 * 1) How to enable cheats

To disable this:

1. ssh to the Simulation machine. 1. Open `~/cloudsim/sim_setup.bash` in an editor 1. Find the VRC_CHEATS_ENABLED line, which should look like this:

export VRC_CHEATS_ENABLED=1

Prefix that line with `#`, so that it looks like this:

# export VRC_CHEATS_ENABLED=1

1. Save the file.

All future simulation launches performed via CloudSim will have cheats disabled.

For certain tasks (during a competition for example), Gazebo should be configured to not accept connections from anywhere other than the Simulation machine. This will stop you from running the `gzclient` GUI (or tools like `gztopic` or `gzstats`). The `gzclient` access can be enabled by adding your OCU's IP address to the whitelist that is used for access control. This must be done on the Simulation machine, which is where Gazebo will be launched.
 * 1) How to enable and disable OCU gzclient access

To disable access to gzclient, add a whitelist environment directive:

1. ssh to the Simulation machine. 1. Open `~/cloudsim/sim_setup.bash` in an editor 1. Uncomment the line that sets `GAZEBO_IP_WHITE_LIST`, which should look like this:

export GAZEBO_IP_WHITE_LIST=127.0.0.1

You can append, with a comma separator, the IP address of your OCU's VPN connection, which is 11.8.0.2, so that is looks like this:

export GAZEBO_IP_WHITE_LIST=127.0.0.1, 11.8.0.2

If the GAZEBO_IP_WHITE_LIST environment variable is not set, gzclient connection is allowed from any IP

All future simulation launches performed via CloudSim will allow `gzclient` (and other `gz` tools) to access Gazebo from the OCU machine.

You can install your own custom environments for testing purposes. To do this, you need to create a new ROS package containing your world and launch files, put that ROS package on the Simulation machine, then adjust the `ROS_PACKAGE_PATH` that will be used when launching simulation to include your new ROS package.
 * 1) How to install custom worlds for testing

Here's one way to do this:

1. On your OCU, create a ROS package with a dependency on `drcsim_gazebo`:

. /usr/share/drcsim/setup.sh       roscreate-pkg my_custom_worlds drcsim_gazebo

1. In your new package, create a `.world` file, say, `myworld.world`, that defines the environment that you want to test in. You'll probably want to start by copying one of the official Practice worlds, such as `/usr/share/drsim-2.6/worlds/vrc_task_1.world`.

**Note:** The VRC Scoring Plugin determines what world is being used by the name of the world, specified in the `world` tag in the `.world` file. For scoring to work, the world should be named `vrc_task_1`, `vrc_task_2`, or `vrc_task_3`.

1. Also in your new package, create a `.launch` file, say, `mylaunch.launch`, that will use your new `.world` file. You'll probably want to start by copying one of the official Practice launches, such as `/usr/share/drcsim-2.6/ros/atlas_utils/launch/vrc_task_1.launch`. Change the default value of the `gzworld` argument to point to your `.world` file, e.g.:



1. Put your new package on the Simulation computer. You can do this via `scp`, using the Simulation key, e.g.:

scp -r -i ~/Downloads/sim_OSRF_VRC_Constellation_01/key-sim.pem my_custom_worlds ubuntu@10.0.0.51:

1. ssh to the Simulation machine and open `start_sim.bash` in an editor (e.g., `vim start_sim.bash`). Just before the `roslaunch` line, add a line that appends the path to your package to `ROS_PACKAGE_PATH`, e.g.:

eval export ROS_PACKAGE_PATH=~/my_custom_worlds:\$ROS_PACKAGE_PATH

Save the file.

Now you can create tasks that refer to your custom world. E.g., in the task creation dialog box, you would specify the **ROS package** as `my_custom_worlds` and the **Launch file** as `mylaunch.launch`.

To get maximum flexibility, you take advantage of patch releases with bug fixes and/or performance improvements. If you wish to upgrade the versions of the software that you're using in your constellation, you need to ssh into all 4 machines (Router, Simulation, Field 1 and 2), and use `apt-get` to install newer versions. To avoid potential version mismatches, be sure to update all 4 machines at the same time.
 * 1) How to upgrade software

To do this:

1. ssh to the Simulation machine. 1. Perform the upgrade:

sudo apt-get update sudo apt-get install -y drcsim gazebo sandia-hand osrf-common

Repeat the above steps for the Router and the field computers.


 * 1) How to switch to the nightly binary packages


 * Warning:** nightly binary packages are less reliable than official releases. You should normally be using the official releases, switching only to the nightly builds to try out a fix that hasn't been officially released yet.

If you wish to switch to the nightly builds of the software that you're using in your constellation, you need to ssh into all 4 machines (Router, Simulation, Field 1 and 2), and use `apt-get` to install newer versions. To avoid potential version mismatches, be sure to update all 4 machines at the same time.

To do this:

1. ssh to the Simulation machine. 1. Perform the switch:

sudo apt-get update sudo apt-get install -y drcsim-nightly gazebo-nightly sandia-hand-nightly osrf-common-nightly

Repeat the above steps for the Router and the field computers.

To switch back to the official releases, just do a normal upgrade.