wiki:Carologistics/Gazsim-Setup
Last modified 4 years ago Last modified on 06/26/15 21:28:50

Gazebo Simulation Setup for fawkes-robotino

If you have some problems, please use the fawkes-devel mailing list.

The installation instructions have been particularly well tested on Fedora 20 as it currently is the main development platform of the Carologistics RoboCup Team. But in general the instructions should also work on other systems like Ubuntu. Note that if you intend to use ROS for visualization or to integrate your own components, that we currently use ROS Fuerte. Newer versions will most likely not work. We can provide a working version for Fedora 20 (use the mailing list to request it). We intend to upgrade to a newer ROS version in August/September 2015.

Please note the general installation instructions for the various systems that detail how to get the required dependencies.

Install Gazebo

Ubuntu

sudo apt-get install gazebo

Fedora

sudo yum install gazebo-devel tinyxml-devel

Compile from Source

Fedora needs the following packages:
PyOpenGL boost-devel cegui-devel cmake console-bridge-devel doxygen freeimage-devel gperftools-devel gtest-devel gts-devel libccd-devel libtool-ltdl-devel libXext-devel libxml2-devel ogre-devel protobuf-devel qt-devel tbb-devel tinyxml-devel urdfdom-headers-devel urdfdom-devel texlive-multirow texlive-sectsty texlive-tocloft texlive-xtab libtar-devel

Follow the instructions from here

Setup Robotino Simulation

Fawkes Plugins and Models

Go to your fawkes-robotino directory and compile with make -j8 all gui (adjust -j8 according to the number of cores in your system).
NOTE: If you have problems with compiling/linking check pkg-config --libs/--cflags 'gazebo' for single -l/-I and remove them.

Checkout our custom models. You will need the path to the directory below to setup the environment variables.

git clone http://git.fawkesrobotics.org/gazebo-models.git

Refbox

Checkout the refbox simulation branch with time synchronization and compile it. You will need the path to the directory below for setting up the environment variables.

git clone http://git.fawkesrobotics.org/llsf-refbox.git
cd llsf-refbox
make -j4

Set the config values in cfg/config.yaml so that the refbox works with the simulation. It should be enough to change the following fields.

  comm:
    protobuf-dirs: ["@BASEDIR@/src/msgs"]

    server-port: !tcp-port 4444
    
    public-peer:
      host: !ipv4 127.0.0.1
      #port: !udp-port 4444
      send-port: !udp-port 4444
      recv-port: !udp-port 4445

    cyan-peer:
      host: !ipv4 127.0.0.1
      #port: !udp-port 4441
      send-port: !udp-port 4441
      recv-port: !udp-port 4446

    magenta-peer:
      host: !ipv4 127.0.0.1
      #port: !udp-port 4442
      send-port: !udp-port 4442
      recv-port: !udp-port 4447

  simulation:
    #synchronize refbox time with the time of a simulation 
    time-sync:
      enable: true
      #estimate time by using the last given simulation time speed (helps reducing the amount of messages to send)
      estimate-time: true

You may also have to set the team-name and crypto-key in the config. This depends on how your robots are configured.
If you have problems with mongodb (not installed/not started) and you don't need it, you can also turn it off in the refbox-config.

Environmental Variables

Setup the environmental variables in your .bashrc (or similar for other install locations):

export FAWKES_DIR=~/fawkes-robotino
# adapt the first part according to the path to the Gazebo standard plugins
export GAZEBO_PLUGIN_PATH=/usr/lib64/gazebo-3.1/plugins:$FAWKES_DIR/lib/gazebo
# This is the path where you cloned the gazebo models repository
export GAZEBO_MODEL_PATH=~/gazebo-models
# This is the path where you cloned the LLSF refbox repository
export LLSF_REFBOX_DIR=~/llsf-refbox
# The default world to load in gazebo
export GAZEBO_WORLD_PATH=~/gazebo-models/llsf_world_two_teams/llsf.world

Start the Simulation

You can use scripts to start the simulation quickly. The gazsim.bash script automatically starts or stops a simulation run with everything needed (gazsim.bash -h gives detailed usage instructions)

To start an LLSF game, do the following:

cd fawkes-robotino/bin
./gazsim.bash -x start -m gazsim-meta-clips

To use ROS (if available) add the -r flag. To limit the number of robots use the argument -n N, where N is the number of robots from 1 to 3.

Manual Startup

If you want to run the individual pieces individually for more control (recommended only for advanced users) you can do so as follows. First, start Gazebo:

gazebo $GAZEBO_WORLD_PATH

Then start Fawkes with the default configuration in fawkes-robotino/bin

./fawkes -c gazsim-configurations/default/robotino1.yaml -p gazebo

Now you can start the needed simulation plugins and all other plugins as usual. A list of all simulation Plugins can be viewed here.

Advanced Issues

The following is relevant only for advanced users to have individual configurations, to perform automated runs or to replay recordings.

Configuration

It is possible to define multiple overall-strategy configurations for different simulation runs. These are represented by the folders in cfg/gazsim-configurations. Every overall-strategy has seperated configurations for each of the three Robotinos. Every configuration consists of the robotinoX.yaml, which replaces the default config.yaml, and the host_robotino_X.yaml, which acts as an host.yaml and overrides config values defined in cfg/conf.d/. If you want to create a new overall-strategy, you have to link the host_robotino_X.yaml in the robotinoX.yaml.

Automated runs

gazsim-schedule.bash runs multiple simulations automatically with multiple configurations, keeps statistics and records the games.
You can configure the automated runs in cfg/gazsim-configurations/automated-competition-conf.bash.

Replay

If you recorded a game you can replay it with

gazebo -p path-to-replay/state.log

If the file is corrupt you may have to add '</gazebo_log>' at the end.