-
Notifications
You must be signed in to change notification settings - Fork 1
XABSL: Robot Behavior
To describe robot behavior in a concise manner, the Extensible Agent Behavior Specification Language is used (see this page for more information). Before you read any further, it is important to know that XABSL divides behavior into four separate concepts:
- Agents, which contains behavior models called options.
- Options are finite state machines which specify these behavior models.
- States of an option define the actions that are active, i.e. being executed.
- Decision trees handle state transitions.
In the behavior editor, Options are indicated by squares, States by circles.
Any option can ask to be called with arguments by indicating field variables with a '@'. For example:
option perform_omnidirectional_kick
{
/** Distance to the ball */
float @distance [mm];
}
This option can be called from any other option as
perform_omnidirectional_kick(distance = 190)
XABSL code is called iteratively. As it is a finite state machine, there are no while/for loops, just states and transitions.
The behavior receives in- and output through symbols. Each symbol declares variables (float, bool or enum) that correspond to variables or function calls in cpp files. By specifying whether these variables are input or output, XABSL will know whether to get the value of these variables beforehand, or if it has to send the value of these variables to a corresponding variable on cpp side. Note that in the XABSL-files input variables must never be set, and output variables may never be used in logic statements.
On the cpp side, the input and output variables are fed to XABSL on every iteration. Any variables that are used in XABSL must be registered on this side.
So, the process can be described like this:
iteration | CPP XABSL
t | -- input -->
| decisionmaking
| <-- output --
| framework
t+1 | -- input -->
The main agent is spl_play_soccer. This agent calls the option initial_ready_set_play, from where the lower-level behaviors are called. After initial calibration, the option _spl_decide_role specifies which robot should execute which behavior. It is in this option that the strategy can be altered without breaking the gamestate transitions.
To add custom options, follow these steps:
- Create a new .xabsl file (choose a fitting name for your option!) and save it in the correct folder - for example, goalie-related stuff goes in folder
Options/Soccer/Goalie
. - Make sure it is included in the agents.xabsl file.
- Call your option from higher-level options, as if it were a function (
<name>();
). - Compile the behavior! Note that reloading the agents.xabsl file may be necessary for changes to take effect.
See this page.