Interfaces for controlling robots

The Java package org.jabotics.robot.en provides documented public interfaces and implementation classes for the creation of robot programs that can be executed on different robot hardware and within the Jabotics simulation tool. Apart from this English API there is a corresponding German API available (see German page). This page will give first hints for the usage of these interfaces and their documentation as well as for the creation of modified APIs by advanced users (e.g. to support further languages).

The HTML documentation for the package org.jabotics.robot.en can be found in the subdirectory docs/robot-en of the Jabotics installation path. The start page docs/robot-en/index.html gives an overview of the provided public interfaces and classes. The figure below has been taken from that page. As indicated in the figure, the class XRobot provides access to all control objects via its object factory. Your own robot classes will typically be derived from XRobot. Different options for the layout of robot classes will be presented on the following page in the context of class templates provided by Jabotics. A color code has been introduced in the HTML documentation to simplify the orientation for different user groups. Classes and methods have been marked with green, yellow or red dots reflecting their level of complexity and difficulty (see figure above with an excerpt from the index of the HTML documentation). Beginners will in general limit themself to the usage of elements marked in green.

fig interfaces en overview

It has been one goal in the design of the interfaces to allow for Java code, that can easily be read by beginners in the sense that it should not be necessary to read the documentation to get an idea about the function of a method call. Therefore it has been given preference to descriptive method names over more compact notations. For the same reason, enumerations are being used at times in method signatures instead of boolean parameters. To limit the typing effort, the class XRobot, which usually serves as a base class, provides abbreviating constants for the needed enumeration values (compare the following page on class templates).

Creation of modified APIs

If the provided interfaces do not serve one's needs, it is generally possible to create modified APIs. One possibility is to implement the new interfaces on top of the package org.jabotics.robot.en. This approach will result in additional programming code, which might be a problem on NXT robots due to their limited resources. Alternatively, experienced programmers could orient themselves by the implementation of org.jabotics.robot.en and to provide an implementation that directly accesses the packages org.jabotics.robot.core (core functionality for motor and sensor control) and org.jabotics.robot.adapter (see diagram below). It is important not to bypass the package org.jabotics.robot.adapter (e.g. to extend the range of functions) because otherwise robot programs will not be executable within the simulation tool.

fig interfaces en package dependencies