wiki:RCLLSimulationSetup

Version 43 (modified by tviehmann, 4 weeks ago) (diff)

Adapt Wiki to Fedora 31 setup

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.

Some features of both fawkes and the Refbox utilize rapidJSON. It can be obtained via:

sudo dnf install rapid-json-devel

In order to run make-check:

 sudo dnf install clang yamllint parallel  

This guide assumes an installation of all components into the base directory

cd

Robotino Simulation Overview

The simulation requires these principal components:

  • Gazebo with RCLL-specific models and plugins (gazebo-rcll)
    # 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
    

  • RCLL Refbox (Refbox)
    git clone https://github.com/robocup-logistics/rcll-refbox.git  
    
  • Fawkes RCLL release 2019. If you have access, you can also clone the repository instead:
    $ git clone --recurse-submodules git@github.com:carologistics/fawkes-robotino.git
    

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=~/rcll-refbox
export GAZEBO_WORLD_PATH=~/gazebo-rcll/worlds/carologistics/llsf.world

Refbox

Follow the installation instructions in the RefBox wiki.

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.

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

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 and that the ROS setup path is sourced, e.g., by running
     echo 'source usr/lib64/ros/setup.bash' >> ~/.bashrc
     source ~/.bashrc
    
    and install ROS via:
    sudo dnf install ros-desktop_full-devel
    
  1. In addition, install the following dependencies:
     sudo dnf install ros-move_base_msgs ros-tf2 ros-tf2_geometry_msgs ros-pcl_conversions ros-pcl_ros-devel orocos-bfl-devel suitesparse-devel ros-move_base_msgs-devel                     
     sudo dnf install python2-rospkg                                                 
     sudo dnf install python2-wstool
     sudo dnf install eigen3-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:fawkesrobotics/fawkes_msgs.git
     git clone git@github.com:carologistics/carologistics-ros.git
    
    and check out the branch for ROS melodic:
     cd carologistics-ros/
     git checkout nlimpert/melodic-dirty
     cd ..
    
    Now, run:
     ~/catkin_ws/src/carologistics-ros/update.sh
     cd ..
     catkin_make
    

Fawkes

  • For the pddl-robot-memory plugin:
     sudo dnf install ctemplate-devel
    
  • To run make check:
     sudo dnf install clang yamllint parallel
    
  • For MongoDB, make sure the driver is installed:
     sudo dnf install mongo-cxx-driver
     sudo dnf install mongo-cxx-driver-devel
     sudo dnf install mongo-c-driver
     sudo dnf install mongo-c-driver-devel
    

Install MongoDB version 4.0 by enabling the rpm. For x86_64 architecture this can be done via:

sudo bash -c 'echo "[mongodb-org-4.0]                                           
name=MongoDB Repository                                                         
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.0/x86_64/           
gpgcheck=1                                                                      
enabled=1                                                                       
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc" > /etc/yum.repos.d/mongodb-org-4.0.repo'

For other architectures adapt the baseurl accordingly.

Install MongoDB:

 sudo dnf install mongodb-org

Now the fawkes rcll software stack can be built via:

 cd ~/fawkes-robotino
 make

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

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.

Webview

Webview2 is a useful GUI to obtain information at runtime. After following the installation instructions in the wiki, it can be used by typing localhost:808 i, where i is a robot number from 1 to 3 while the simulation is running.

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

It may be useful to start the robots separately from the GUI to decrease the load on startup. To do so, add the -l flag. The GUI can be started later via calling

 gzclient

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