Skip to content

General

Zichong Li edited this page Feb 15, 2023 · 1 revision

Behavior Control

The behavior is implemented as a hierarchy of state machines. Each state machine is called option, each option consists of at least one state and each state has a transition- and an action-part. This custom library (introduced by B-Human) is based on the sequential function chart (SFC).

The behavior control parameters are configured in Config/Locations/Default/behaviorControl.cfg. The top-level state machines are configured in field roots. All the lower level state machines (options) are implemented in Src/Modules/BehaviorControl/Options.

Change GameState with SimRobot

If SimRobot is used with a simulated robot, then the game states can be changed via the game controller. Enter in the console of SimRobot following command:

    gc initial | ready | set | playing | finished | kickOffHome | kickOffAway | kickInHome | kickInAway | cornerKickHome | cornerKickAway | freeKickHome | freeKickAway | goalFreeKickHome | goalFreeKickAway | freeKickComplete

When using a real robot it is possible to change the game states via the console of SimRobot by changing the GameInfo representation:

    get representation:GameInfo

change now state = X to:

state state =
initial 0
ready 1
set 2
playing 3
finished 4

Coordinate Systems

There are two coordinate systems, the global and the relative frame. The global coordinate system has its origin in the middle of the field, with x axis towards the opponents goal and y axis to the left. The relative frame is on the robot CoM, x coordinate points forward from the robot. All distances are in millimeters, angles are in radians.

image

We have written two functions to convert variables from either system to the other, extremely useful to manage all sort of information:

  • Global coordinate to relative coordinate

     Vector2<> gloToRel(Vector2<> target)
    
  • Relative coordinate to global coordinate

     Vector2<> relToGlo(Vector2<> target)
    
Clone this wiki locally