3D Simulation

Overview

Simulation allows for safe, quick testing of experimental code and settings, and can help you practice using the code without having to leave your desk.

3D Simulation can be used for developing
  • Behaviours

  • Motion

  • Localisation

  • Support Tools

It cannot be used for developing
  • Vision

Tip

Breaking simulated robots is a lot cheaper than breaking real ones!

Installing Simulator

Run $RUNSWIFT_CHECKOUT_DIR/bin/setup-simulation.sh in a terminal.

Running the Simulator

Running the simulator (RCSSServer3d)

To start the simulation server, in a new terminal, run rcssserver3d

Note

the following errors will show and can be ignored.

(Light) ERROR: OpenGLServer not found
(Light) ERROR: OpenGLServer not found
(Material2DTexture) ERROR: cannot find TextureServer
(Material2DTexture) ERROR: OpenGLServer not found.
(Material2DTexture) ERROR: cannot find TextureServer
(Material2DTexture) ERROR: OpenGLServer not found.
(Material2DTexture) ERROR: cannot find TextureServer
(Material2DTexture) ERROR: OpenGLServer not found.
(Material2DTexture) ERROR: cannot find TextureServer
(Material2DTexture) ERROR: OpenGLServer not found.
(Material2DTexture) ERROR: cannot find TextureServer
(Material2DTexture) ERROR: OpenGLServer not found.
(Material2DTexture) ERROR: cannot find TextureServer
(Material2DTexture) ERROR: OpenGLServer not found.
(Material2DTexture) ERROR: cannot find TextureServer
(Material2DTexture) ERROR: OpenGLServer not found.
(Material2DTexture) ERROR: cannot find TextureServer
(Material2DTexture) ERROR: OpenGLServer not found.
(Material2DTexture) ERROR: cannot find TextureServer
(Material2DTexture) ERROR: OpenGLServer not found.
(Material2DTexture) ERROR: cannot find TextureServer
(Material2DTexture) ERROR: OpenGLServer not found.
(sparkgui.rb)  sparkRegisterMonitorCmdParser TrainerCommandParser
(InputControl) ERROR: no FPSController found at '/usr/scene/camera/physics/controller'

Running the visualiser (RoboViz)

To start the simulator visualier, in a new terminal run roboviz.sh. A window should pop up, with a soccer field.

Note

If you run into a Exception in thread "main" java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper you may find this helpful: https://askubuntu.com/a/723503

Runing simswift (single robot)

  1. Run build-relwithdebinfo-2.1.sh runswift in a new terminal to compile simswift. It is important to close the server and visualiser, to speed up the compilation. This step can be skipped if no re-compilation is required.

  2. Launch robot by running simswift. Runswift commandline arguments can be used, such as simswift -T 18 -n 1.

  3. To kill the robot, use Ctrl+C.

Running simswift (team)

  1. build-relwithdebinfo-2.1.sh runswift to compile. Skip this step if you don’t have to re-build.

  2. sim_run to launch a whole team. This starts five robot agents.

  3. sim_kill, to terminate all agents.

Running with Offnao

  1. Run simswift in a new terminal. In the terminal, look for the following message and take note of the port number rUNSWift running in SIMULATION mode. DO NOT RUN THIS ON A NAO.    Listening for Offnao on port 10241.

  2. Run offnao, and go File -> Connect To Nao (Ctrl+N). Enter 127.0.0.1 in first textbox, and the port number in the second textbox.

  3. Click on the first textbox, and press Enter.

  4. Click on the red circle button at the bottom left of the offnao window to start recording.

Tip

The port number is calculated from the team number and player number of the agent.

Speeding up the server

  1. Run export SPARK_FAST_TIME=true in a new terminal.

  2. In the same terminal, run rcssserver3d. This lets the server run as fast as your CPU can handle.

Tip

Run export SPARK_FAST_TIME=false to disable the speed-up.

How It Works

3D Simulation consists of
_images/Simulator_Structure.png

rcssserver3d

3D soccer simulation server running on top of simspark simulation system. Developed by the RoboCup 3D Simulation League. rUNSWift modifications are made in rUNSWift’s fork. More information can be found at Simspark Wiki.

simswift

simswift is the rUNSWift build target on a Linux PC, and is the agent that connects to the simulation server. Refer to Collette’s (2017) thesis for more info.

RoboViz

User-friendly visualiser for the simulator. Provides a graphical interface to interact with the simulator, such as moving the ball and robots. rUNSWift modifications are made in rUNSWift’s fork. More information can be found at magmaOffenburg/RoboViz GitHub.

Making changes

Recompiling changes

SimSpark

  • To re-compile Spark, run spark_build from anywhere.

  • To re-compile rcssserver3d, run rcs_build from anywhere.

Note

spark_build, rcs_build are located in simspark/bin/

Pushing changes

Making changes to SimSpark / RCSS

  1. Gain push access to rUNSWift’s Simspark Fork

  2. Create pull request with a branch with changes.

Making changes to Roboviz

  1. Gain push access to rUNSWift’s RoboViz Fork

  2. Create pull request with a branch with changes.

Note

For GitHub push access, please Contact us.

rUNSWift Modifications

This is a list of what rUNSWift has modified in the SimSpark and RoboViz. This list should be kept up to date so we know what to preserve when incorporating changes made in the original open-source projects.

SimSpark / RCSS Modifications

100FPS

  • To match the speed of the motion of the SoftBank NAO V5, the simulator’s FPS was changed from 50FPS to 100FPS.

SPARK_FAST_TIME

  • This is an environment variable that was added to affect multiple settings to allow speed-ups in the simulator

rcssserver3d/bin

  • rcs_build and spark_build scripts were added in rcssserver3d/bin for easy compiling of the simulator.

Disabling Autoref

  • Autoreffing has been disabled, as it is not needed.

FieldFeatures

  • A significant modification rUNSWift has made to rcssserver3d, is the addition of “FieldFeatures” (corners, t-junctions, centre circles, etc).

  • This is a modification to allow the “orientation” of a fieldfeature to be recognised (such as a corner) by the agent in the simulator

  • To view the list of fieldfeatures refer to simspark/rcssserver3d/data/rsg/agent/nao/soccer.rsg

RoboViz Modification List

Goal and Penalty Box Size

  • Goal and Penalty Box Size were modified to meet SPL requirements

Known issues

  • rcssserver3d will sometimes crash, and keep running in the background. This can happen especially if you disconnect/connect agents very quickly. When this happens, run the following command: pkill -9 rcssserver3d; rcssserver3d

  • Some movements such as the getup have not been tuned in the simulator.