ServiceSim ships with an example scenario ready to be used, but it also provides a mechanism for generating custom scenarios as desired.
A scenario is defined by a combination
.launch files. The following explains how to generate new files based on a config.yaml file.
Follow these steps to locally generate and use a scenario.
sudo apt-get update sudo apt-get install ruby2.3 ruby2.3-dev
Create a directory to hold the scripts and world files:
mkdir ~/servicesim_worlds cd ~/servicesim_worlds
Copy the necessary script:
Run the script:
bash scenario.bash -d -p my_scenario
The -d flag tells the script to download files. You just need to use this the first time you run the script or if you need to download updated templates.
This script should have generated two files, you can run the following to check:
find `pwd` -name "my_scenario.*"
And the output should be something like:
To use the generated file, set the
customflag to true and pass the path prefix to the launch file, for example:
roslaunch servicesim servicesim.launch custom:=true custom_prefix:=/home/<user>/servicesim_worlds/my_scenario
Editing the configuration
The script downloaded a local copy of
config.yaml for you, you can check its contents with:
That file exposes several parameters to configure the competition scenario, such as the target rooms, the guest identity and configuration for guest drift. Check the parameters that can be changed in
config.yaml file here
Let's change the robot start location. First, open the config file:
targets: robot_start property to
BackEntrance, save and close.
Now run the following to generate a new scenario based on the new config:
bash scenario.bash -p back_entrance
Now use that scenario and see how the robot starts near the back entrance:
roslaunch servicesim servicesim.launch custom:=true custom_prefix:=/home/<user>/servicesim_worlds/back_entrance
scenario.bash script is calling the service.world.erb template. It accepts the following options:
- s: Pass a seed to the random generator
- f: Set to true to generate only a floorplan of the world (no movable objects)
- d: Set to true to generate a world with debug visuals
- urdf_launch: Pass name of launch file which will spawn the robot URDF (
scenario.bashdoes this for us)
You can directly call
erb, or pass arguments to
scenario.bash so they are forwarded to the template.
For example, fix the seed at 100 and generate debug visuals:
erb s=100 d=true urdf_launch=debug_100.launch service.world.erb > debug_100.world
See all the parameters which can be configured in the yaml file on this page.