The behaviour subsystem includes walk planning, soccer strategies, get up detection, head behaviour, script running and tuning, and kick behaviour.
Walk Behaviour
The Direct Walk Controller sends messages to the walk engine. It can send a message to enable or disable the walk engine, stop the walk engine, or send a WalkCommand
message to the walk engine.
Keyboard Walk
The keyboardwalk module is used for testing and demonstration purposes. Keyboard walk can use any of the walk engines in the codebase, and acts as an interface for any one of them.
Keyboard walk uses keyboard inputs to control the robot. The inputs available are detailed in the following table.
Command | Description |
---|---|
e | Toggles the walk on and off. Initially it is off. |
w | Adds 0.01 to the walk command x-value. This value is in meters/second. |
s | Adds -0.01 to the walk command x-value. This value is in meters/second. |
a | Adds 0.01 to the walk command y-value. This value is in meters/second. |
d | Adds -0.01 to the walk command y-value. This value is in meters/second. |
z | Adds 0.1 to the walk command rotational value. This value is in radians/second. |
x | Adds -0.1 to the walk command rotational value. This value is in radians/second. |
, | Runs the kick with the left foot. |
. | Runs the kick with the right foot. |
g | Runs the get up. |
← | Head turns to the left. |
→ | Head turns to the right. |
↑ | Head turns upwards. |
↓ | Head turns downwards. |
r | Resets keyboardwalk. Head rotation is set to 0. Walk command is set to 0. |
q | Quits keyboardwalk. |
To use KeyboardWalk, build the keyboardwalk role and run the binary.
The fake/keyboardwalk role uses HardwareSimulator, and is useful for when you don't want to run keyboard walk on the robot.
PS3 Walk
The PS3 walk module is an interface for testing and demonstrating the walk and other functionalities using a PS3 controller.
The module connects to the PS3 controller using bluetooth (or USB) and reacts based on joystick or button input.
Command | Description |
---|---|
Left Joystick Horizontal | Adds rotational speed to the walk command. |
Left Joystick Vertical | Adds x speed to the walk command. |
Right Joystick Horizontal | Changes the head yaw. |
Right Joystick Vertical | Changes the head pitch. |
TRIANGLE | Toggles walking on/off. |
SQUARE | Toggles locking of the head. |
R2 | Right kick. |
To use this module, build the PS3Walk role and run the binary. Plug the PS3 controller into the robot using a USB cable. When the controller is connected to the robot, it will be paired, and you can remove the cable.
Script Runner
ScriptRunner is a module in the behaviour subsystem. It takes the name of one or more script files as arguments and attempts to run the scripts. It does not take file paths, only the file name/s of the script/s to execute. Any role with the ScriptRunner module must also contain the ScriptEngine module.
When ScriptRunner is executed, it stores the script file names passed to it as a vector of strings. When the green button on the robot is pushed, the scripts are executed in order of appearance, one after the other. ScriptRunner also provides an option to set a delay before the execution of the first script, as well as a delay between the execution of each script.
An example of using ScriptRunner to run a script called Stand.yaml
is:
./scriptrunner Stand.yaml
Script Tuner
ScriptTuner is a module in the behaviour subsystem. Using a command-line argument, it can either create a new script or open an existing script for editing. It uses curses to create a user interface in the terminal. Through this user interface, YAML files are created or edited that specify a script that can then be used by other modules.
A script consists of frames (also called targets) which specify the position of one or more servos at a given time. The ScriptTuner interface allows for stepping through and modifying those frames. When a frame is selected in ScriptTuner, a ServoCommand for that frame will be emitted to the robot. By stepping through multiple frames, the entire script can be played back on the robot, allowing the user to preview changes to the script.
ScriptTuner also allows for "locking" and "unlocking" servos on the robot. When a servo is "locked", its position can only be changed in ScriptTuner. When it is "unlocked", the servo can be moved physically on the robot, which will update the position value in the script. Locking a servo involves emitting a ServoCommand for the current position of the servo. Unlocking the servo involves emitting a ServoCommand with zero torque and gain.
To learn how to use ScriptTuner, read the ScriptTuner guide.