Skip to content
Till Hofmann edited this page Aug 16, 2018 · 5 revisions

Communicating with the RCLL refbox from Java

The Referee Box (refbox) controls, monitors, and evaluates the game. In order to communicate with the refbox, for example to receive the current game state, you need to use the protobuf_comm library. This tutorial explains how to get, import and use this library to communicate with the refbox from Java.

Set up the protobuf_comm_java library

This tutorial explains how to import the library into Eclipse. You can do this in two different ways, either add the compiled jar file to the Build Path of your project or import the source code as a new project. If you import the source code, you also have access to the examples used in the Usage tutorial. Both possibilities are explained in detail below.

Import the jar

If you only want to use the library and not modify it for your needs, download the protobuf_comm.jar from here. There you will also find the current version of Google's protobuf-java library, which you will need as we communicate with the refbox using protobuf messages.

To import both libraries, copy them into the folder of the project in which you want to communicate with the refbox. Then open Eclipse, right-click on your project in the Package Explorer and select "Properties". In the Java Build Path properties, open the Libraries tab and click on "Add JARs..." as shown in the picture below. (If you haven't copied the libraries into the project's folder in the workspace, select "Add External JARs..." instead.)

Extend your project in the hierarchy tree, find the jars and click ok.

After closing the Properties window, you are ready to use the protobuf_comm library as explained in the Usage tutorial.

Alternatively, after copying the libs into your project's folder, extend you project in the Package Explorer, right-click on the jars and select Build Path -> Add to Build Path.

Import the source code

To import the source code as a new project into Eclipse, you need to download protobuf_comm_java.zip from here. Extract the zip and move the resulting folder into your workspace. Or clone our git repository by executing the following command on the command line:

$ git clone git://git.fawkesrobotics.org/protobuf_comm_java.git

If you use the git repository instead of the zip file, you can stay up-to-date and always get the latest version. This can be achieved with the following command:

$ git pull

After extracting the zip or cloning our repository, open Eclipse and choose File -> Import... causing the following window to open.

Extend the General entry, choose "Existing Projects into Workspace" and click Next. Fill in the "Select root directory" field by clicking "Browse" and choosing the folder containing the source code. Make sure that the project is selected in the Projects list and click Finish. Now you should see the project in the Package Explorer.

In the org.robocup_logistics.llsf_example package you can find the two example classes used in the Usage tutorial. Read the tutorial for further instructions on using the library.

Usage

Clone this wiki locally