wiki:RCLLSimulationSetup

Version 30 (modified by kiranchhatre, 6 weeks ago) (diff)

Update repository URLs in wiki #45

RoboCup Logistics League Simulation Setup

These instructions describe the setup of the RoboCup Logistics League Simulation. The simulation is also used for the Planning Competition for Logistics Robots In Simulation.

Please use the fawkes development mailing list to discuss questions and improvements, and the ICAPS Planning Competition Google Group for questions specific to that competition.

Requirements

Prepare your machine according to the instructions on FawkesOnFedora or FawkesOnUbuntu. At this time we have tested the simulation with Fedora 23 and later as well as Ubuntu 14.04. We have tested the ROS extensions with ROS Indigo and later (the simulation may or may not work with older versions of any of these components).

Setup Robotino Simulation

The simulation requires these principal components:

  • Gazebo (version 5 or later)
  • RCLL-specific models and plugins gazebo-rcll
  • Fawkes RCLL release 2015 or 2016. If you have access, you can also clone the repository instead:
    $ git clone --recurse-submodules git@git.fawkesrobotics.org:fawkes-robotino.git
    
  • Optional: ROS Indigo or later, integration packages are available

Fawkes

NOTE: If you have problems with compiling/linking check pkg-config --libs/--cflags 'gazebo' for single -l/-I and remove them.

Gazebo Models and Plugins

You can find the models and plugins we use for gazebo here: https://github.com/robocup-logistics

# read-write access
git clone git@github.com:robocup-logistics/gazebo-rcll.git
# if you don't have permissions, use this for read-only access
git clone https://github.com/robocup-logistics/gazebo-rcll.git

Build the plugins:

cd gazebo-rcll/plugins
make -j8

Refbox

Install the package gecode-devel to be able to build the mps_placing_clips library of the refbox:

$ sudo dnf install gecode-devel

Checkout the refbox compile it. Make sure you have installed the prerequisites as described in the RefBox wiki. You will need the path to the directory below for setting up the environment variables.

git clone https://github.com/robocup-logistics/rcll-refbox.git
cd rcll-refbox
make -j4

The default configuration is properly setup to be used in simulation.

You may also have to set the team-name and crypto-key in the config. This depends on how your robots are configured. The crypto-key has to match the key in fawkes-robotino/cfg/conf.d/clips-agent.yaml under clips-agent/llsf2015/crypto-key.

If you want to use the MongoDB logging feature make sure that it has been compiled. Then set /llsfrb/mongodb/enable: true.

Environmental Variables

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

export FAWKES_DIR=~/fawkes-robotino
export GAZEBO_RCLL=~/gazebo-rcll
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:$GAZEBO_RCLL/plugins/lib/gazebo
export GAZEBO_MODEL_PATH=$GAZEBO_RCLL/models
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$GAZEBO_RCLL/models/carologistics

export LLSF_REFBOX_DIR=~/llsf-refbox
export GAZEBO_WORLD_PATH=~/gazebo-rcll/worlds/carologistics/llsf.world

ROS move_base (2017+)

Since 2017 a custom setup of the ROS move_base is used for navigation purposes. Follow the next steps to enable the usage of move_base within the RCLL Simulation.

Note: This requires permissions to clone the repository git.fawkesrobotics.org:carologistics-ros!

  1. Make sure to have the latest ROS distribution installed as described in FawkesOnFedora (or FawkesOnUbuntu accordingly). In particular, make sure to have the ros-kinetic-desktop_full-devel package installed.
  1. In addition, install the following dependencies:
    $ sudo dnf install ros-kinetic-move_base_msgs orocos-bfl-devel suitesparse-devel
    
  1. Install the g2o package:
    $ sudo dnf copr enable nlimpert/libg2o
    $ sudo dnf install g2o
    
  1. Create a catkin workspace
    $ mkdir -p ~/catkin_ws/src
    $ cd ~/catkin_ws
    $ catkin_make
    $ echo 'source ~/catkin_ws/devel/setup.bash' >> ~/.bashrc
    $ source ~/.bashrc
    
  1. Clone the carologistics-ros repository:
    $ cd ~/catkin_ws/src
    $ git clone git@github.com:carologistics/carologistics-ros.git
    
  1. Run the update.sh script to automatically clone additional repositories and build the workspace:
    $ ~/catkin_ws/src/carologistics-ros/update.sh
    

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.

Start the Simulation

Using the scripts

You can use scripts to start the simulation quickly. There are three scripts in etc/scripts which are linked in the bin folder:

gazsim.bash

Atomatically starts or ends a whole simulation with everything needed.
gazsim.bash -h for more details.
Example how to start a full RCLL Game:

./gazsim.bash -x start -n 1 -r -a

Set the -n parameter to the number of robots to run (1 to 3). The -r flag enables ROS support. If you compiled without, remove it. Finally, the -a flag loads the default agent, remove it to load your own agent (cf. -m flag in help with -h flag).

gazsim-schedule.bash

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

gazsim-startup.bash

Starts a specified programm for the simulation.
gazsim-startup.bash -h for more details.

Running a Game

To run a game a few steps are necessary.

  1. Verify terminals: once gazsim.bash finishes you should have a terminal with at least 6 tabs (it is five tabs plus one for each robot, so 6 for a single simulated robot). The tabs are (in order): gazebo, roscore, refbox, refbox-shell, fawkes (robot), fawkes (comm).

If you get less than six tabs (for a single robot), edit the profile settings of the terminal (right click in terminal -> profiles -> profile preferences). Go to the second tab "Command" and choose "Hold the terminal open" for "When command exits". This will allow you to see the error message there. A typical issue is that the refbox-shell complains about insufficient lines. In that case, reduce the font size of your terminal.

To reduce the size of the gazebo window, go to the window and press the F11 key twice. Afterwards gazebo will be a regular window to resize and move.

  1. Set the teams: go to the fourth tab (refbox-shell). Press F4, in the appearing dialog choose "Cyan" and then "Carologistics" (or later the team color and team name you want to set, but this is the setting to bootstrap the simulation). After a short while you should see the robots appearing, e.g. R-1 of Carologistics if running with a single robot.
  1. Start the game: press the "space" key in the refbox shell. The game phase will change to SETUP and the state to RUNNING. The lights of the machines in the upper right corner will toggle. The machines will now be instantiated in the simulation. This takes some time, wait about 15 seconds.

Check on the fifth terminal (Fawkes for first robot). You will see some messages of the form "ColliThread?: LaserInterface? writer has been inactive for too long (1.094230 > 0.500000)". This is fine, it is because the simulation instantiates the machines. However, if you see this stop, and then reappear counting again up the time it took too long, the simulation has a hiccup. Close the terminal and start over again. This is a bug we are currently investigating. It happens typically in about one run out of ten.

  1. Switch phase: you can start the game without waiting for the SETUP phase to complete. Do this after the markers appear properly on the machines (after about 30 sec). Then go to the refbox-shell and press F3. Select "EXPLORATION" in the appearing dialog.

The robot(s) will now start to move and to explore the machines (assuming you run the agent with the -a parameter of gazsim.bash). The simulation has been started successfully.

Advanced Features

These are features that you do 'not' need usually, but that can be helpful, e.g. when debugging. Do not bother to read unless someone suggested this could be helpful.

Running the Simulation manually

Start Gazebo

gazebo $GAZEBO_WORLD_PATH

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?.

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.

Distributing the simulation over multiple machines

Described here