This ROS package contains a PyQt GUI (see screenshot below) whose job is to publish the GameState
message, which all robot soccer teams (and the soccersim Gazebo simulator) will consume.
Inspired by the Chicken McThuggets Command Center.
Dependencies:
The Referee uses PyQt4 to render the GUI. Because of this, you must install this dependency. On Linux:
$ sudo apt-get install python-qt4
See the wiki for an understanding of how and in which settings to use the different functional schemes of the Robot Soccer Referee.
The message definition contains the following:
int32 home_score # score of the home/away team
int32 away_score #
int32 home_bot_count # how many robots will the home/away team be playing with?
int32 away_bot_count #
int32 remaining_seconds # how many more seconds are remaining in this half?
bool play # Play/Pause -- robots should freeze in place when false
bool reset_field # Robots should go to their home positions and freeze while true
bool home_penalty # If reset_field is true and my team (home/away) receives a penalty,
bool away_penalty # then this will be true and my team should reset to penalty mode
bool second_half # Second half of match. Robots should switch sides.
To access the GameState
message in your own ROS package, you must add this package to your catkin_ws
workspace folder. This will also allow you to run the soccerref
on your own during testing (see below).
Start by cloning this repo into your catkin_ws/src
directory. It is best to git clone
the code so that as changes are released you can simply git pull
to update.
$ cd catkin_ws/src
$ git clone https://github.com/embeddedprogrammer/soccerref.git
Your catkin_ws/src
directory should look like:
catkin_ws/
src/
soccerref
your_team_package/
CMakeLists.txt
package.xml
Next, you will want to edit your team's CMakeLists.txt
and package.xml
so that catkin knows that your package depends on soccerref
:
# CMakeLists.txt
find_package(catkin REQUIRED COMPONENTS
roscpp
...
soccerref
)
...
catkin_package(
CATKIN_DEPENDS roscpp ... soccerref
)
<!-- package.xml -->
<buildtool_depend>catkin</buildtool_depend>
...
<build_depend>soccerref</build_depend>
...
<run_depend>soccerref</run_depend>
Now that your package knows it needs soccerref
, you can run catkin_make
to generate the ROS message for GameState.msg
:
$ catkin_make # make sure you are in 'catkin_ws' and not 'catkin_ws/src'
Use roslaunch
:
$ roslaunch soccerref simref.py
Occasionally, when you press Start Game
on the soccerref
GUI, you might see an error message like this:
This error typically happens when there is already another instance of Gazebo (gzserver
) still running in the background. To solve this, you can run the following commands:
$ ps aux | grep gz # Find any process that has 'gz' in it (like 'gzserver' and 'gzclient')
$ sudo kill <pid> # the second column has the 5ish-digit process id (pid)
Now you can try pressing Start Game
again.
The main soccerref
GUI:
The soccerref
GUI refereing a simulated match: