-
Notifications
You must be signed in to change notification settings - Fork 2
Using simswift
simswift is a rUNSWift build target which allows for the simulation of rUNSWift on a Linux PC. This is not a detailed explanation of simswift. Rather, this is a crash course in getting simswift up and running on Ubuntu 14.04.5 LTS 64-bit. This tutorial assumes that you have read Collette's (2017) thesis, which gives a detailed overview of simswift.
- Install Ubuntu 14.04.5 LTS 64-bit. At the time of writing, this is the rUNSWift supported distribution of Ubuntu. If, at the time of reading, this is different, you may try using a more recent version (at your own risk).
- Follow the instructions in Getting Started to setup rUNSWift on the distribution.
- In your rUNSWift directory, run the 'sim_setup' command (located in
${RUNSWIFT_CHECKOUT_DIR}/bin/sim_setup.sh
). If the script fails, debug accordingly.
simswift simulation is made up of three components:
- simswift - the simulator-friendly rUNSWift build target
- rcssserver3d - the actual simulator server being used by simswift
- RoboViz - a simulation monitor, which renders what is happening in the simulation
Running the 'sim_setup' command, previously mentioned, will install rcssserver3d and RoboViz if completed successfully. To build simswift itself, run the 'sim_build' command in your rUNSWift directory. NOTE: You can provide the '-j' argument to the sim_build command to parallelise the build, e.g. 'sim_build -j4'.
To run a simulation, do the following:
- Run the 'sim_build' command in terminal.
- Run the 'rcssserver3d' command in terminal
- Run the 'roboviz.sh' command in terminal
- In RoboViz, change the game state to 'beforeKickOff' by pressing 'o' and selecting 'beforeKickOff'.
- Run the 'sim_run' command (located at
${RUNSWIFT_CHECKOUT_DIR}/bin/sim_run.sh
) to start simswift instances. - In RoboViz, change the game state to 'GameOver' by pressing 'o' and selecting 'GameOver'
- Start GameController and begin a game.
- To finish, run the 'sim_kill' command (located at
${RUNSWIFT_CHECKOUT_DIR}/bin/sim_kill.sh
) to kill simswift instances.
The 'sim_run' command simply starts simswift instances on a specified team. The usage is sim_run [team] [number of robots]
. If no arguments are supplied, sim_run will start 5 robots on team 18. 'sim_kill' simply terminates these instances.
'sim_run' redirects simswift output to /dev/null, so no robot output will be seen in console. To see rUNSWift output messages, directly run simswift in your terminal by navigating to the build release folder (located at ${RUNSWIFT_CHECKOUT_DIR}/build_release/
) and running the command ./robot/runswift [-n num] [-T team]
where num
is the player number, and team
is the team number.
NOTE: If no arguments are supplied, the default team is team 19 (not rUNSWift, SPQR).
The game state dictates the 'rules' that apply to the simulation. For example, 'beforeKickOff' is the only game state where robots are able to beam to the correct places on the side of the field, but they are not allowed to kick the ball. The rules are usually not useful for rUNSWift simulation, so as soon as robots beam on to the field, just set the game state to 'GameOver'. NOTE: If the game state is not set to 'beforeKickOff' before the robots connect, they will spawn at the wrong spot on the field. If the game state is not changed from 'beforeKickOff' after robots connect, they will not be able to kick the ball or leave their half.
simswift has the same default activity as rUNSWift. As such, the 'GameController' skill is automatically loaded, which waits for instructions from GameController. When using GameController, be sure to use the same team number that the robots are using (supplied by 'sim_run' or 'runswift [-T team]'). If you don't want to use GameController, run simswift directly through terminal (described above) and use the [-S skill] command-line argument.
simswift also has offnao support. Each time a simswift instance is started, it will print the port on which it is listening for offnao connections. However, when using the 'sim_run' command, terminal output is silenced. To see the offnao port, run the simswift instance directly, or use the following formula to calculate the offnao port of an instance: 10125 + (team_number * 11) + player_number
. For example, for rUNSWift (team 18) player 2, the offnao port would be 10125 + (18 * 11) + 2 = 10325. NOTE: '11' in the above formula is the value of the MAX_NUM_PLAYERS constant, which may be subject to change in the future.
- rcssserver3d will often crash. When this happens, run the following command:
pkill -9 rcssserver3d; rcssserver3d
- simswift instances will sometimes start seizuring on the ground. This appears to be a random occurrence where the effector delay of the simulator changes, meaning simswift cannot correctly predict and actuate the joints. Restart simswift as a workaround.
- simswift Motion simulation is much slower, and less stable than rUNSWift on an actual robot. This means that the walk and getup do not work perfectly in simulation. Virtual robots will walk slower and may attempt a getup several times before they succeed.
simswift is ideal for developing non-environment facing code such as behaviours and localisation. Until the Motion simulation can be improved, avoid Motion development. As there are no cameras, avoid Vision development. You should always finely-tune your simulator behaviours on a physical robot.
Collette's (2017) thesis details suggested future work for simswift, including both development work and possible research projects.