Purpose

Documentation for each purpose module in the main NUbots codebase
Updated 25 Aug 2024

AllRounder

Description

Play soccer in the all rounder position, which is a multi-purpose position for when only one robot is active. Either bypass GameController and force play, or uses GameController information to decide what to do.

In the ready state, makes a Ready subtask.

In the playing state (for both normal game mode and penalty shootout), finds the ball, fixates on the ball, walks to the ball, and kicks the ball.

In other states, stands still.

Usage

Add this module to play as a all rounder in soccer!

Consumes

  • message::input::GameState to get information about the state of the game
  • message::input::GameState::Data::Phase to get specific information about the current game phase (initial, ready, set, playing, etc).
  • message::strategy::AllRounder a Task requesting to play as a AllRounder
  • message::strategy::NormalAllRounder a Test requesting to play as a AllRounder in the normal game state
  • message::strategy::PenaltyShootoutAllRounder a Task requesting to play as a AllRounder in the penalty shootout game state

Emits

  • message::strategy::NormalAllRounder a Task requesting to play as a AllRounder in the normal game state
  • message::strategy::PenaltyShootoutAllRounder a Task requesting to play as a AllRounder in the penalty shootout game state
  • message::strategy::Ready a Task requesting to walk to the ready position
  • message::strategy::StandStill a Task requesting to stand still and not move
  • message::strategy::FindBall a Task requesting to look and move around to find the ball
  • message::strategy::LookAtBall a Task requesting to look at a known ball
  • message::strategy::WalkToBall a Task requesting to walk to a known ball
  • message::strategy::AlignBallToGoal a Task requesting to align the robot to face the goal with the ball infront of it
  • message::planning::KickToGoal a Task requesting to kick the ball towards the goal

Dependencies

Defender

Description

Play soccer in the defender position. Either bypass GameController and force play, or uses GameController information to decide what to do.

In the ready state, walks to a position on the field.

In the playing state for normal game mode, finds the ball, fixates on the ball, walks to the ball if the ball is in the defenders bounded box defensive area, and kicks the ball.

If ball is outside bounded box area and ball is in opposition half, defender is clamped to the edge of bounding box closest to ball.

If ball is outside bounded box area and ball is in own half, defender is clamped to the edge of bounding box closest to ball and position itself 1 meter behind the ball.

Usage

Add this module to play as a defender in soccer!

Consumes

  • message::input::GameState to get information about the state of the game
  • message::input::GameState::Data::Phase to get specific information about the current game phase (initial, ready, set, playing, etc).
  • message::purpose::Defender a Task requesting to play as a Defender

Emits

  • message::strategy::WalkInsideBoundedBox a Task requesting to stay within a bounded area on the field.
  • message::strategy::StandStill a Task requesting to stand still and not move
  • message::strategy::FindBall a Task requesting to look and move around to find the ball
  • message::strategy::LookAtBall a Task requesting to look at a known ball
  • message::strategy::WalkToBall a Task requesting to walk to a known ball
  • message::strategy::AlignBallToGoal a Task requesting to align the robot to face the goal with the ball in front of it
  • message::planning::KickToGoal a Task requesting to kick the ball towards the goal

Dependencies

Goalie

Description

Play soccer in the goalie position. Either bypasses GameController and force playing, or uses GameController information to decide what to do.

In the ready state, walks to the goals.

In the playing state (for both normal game mode and penalty shootout), finds the ball, fixates on the ball and dives if the ball is close.

Usage

Add this module to the role and emit a Goalie Task.

Consumes

  • message::input::GameState to get information about the state of the game
  • message::input::GameState::Data::Phase to get specific information about the current game phase (initial, ready, set, playing, etc).
  • message::strategy::Goalie a Task requesting to play as a Goalie
  • message::strategy::NormalGoalie a Test requesting to play as a Goalie in the normal game state
  • message::strategy::PenaltyShootoutGoalie a Task requesting to play as a Goalie in the penalty shootout game state

Emits

  • message::strategy::NormalGoalie a Task requesting to play as a Goalie in the normal game state
  • message::strategy::PenaltyShootoutGoalie a Task requesting to play as a Goalie in the penalty shootout game state
  • message::strategy::StandStill a Task requesting to stand still and not move
  • message::planning:::LookAround a Task requesting to look around for the ball
  • message::strategy::LookAtBall a Task requesting to look at a known ball
  • message::strategy::DiveToBall a Task requesting to dive to the ball if it is close enough
  • message::strategy::WalkToFieldPosition Task requesting to walk to position on field

Dependencies

KeyboardWalk

Description

Starts the Director graph for the KeyboardWalk scenario.

Keyboard walk uses keyboard inputs to control the robot. The inputs available are detailed in the following table.

CommandDescription
eToggles the walk on and off. Initially it is off.
wAdds 0.01 to the walk command x-value. This value is in meters/second.
sAdds -0.01 to the walk command x-value. This value is in meters/second.
aAdds 0.01 to the walk command y-value. This value is in meters/second.
dAdds -0.01 to the walk command y-value. This value is in meters/second.
zAdds 0.1 to the walk command rotational value. This value is in radians/second.
xAdds -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.
gRuns the get up.
Head turns to the left.
Head turns to the right.
Head turns upwards.
Head turns downwards.
rResets keyboardwalk. Head rotation is set to 0. Walk command is set to 0.
qQuits keyboardwalk.

Usage

Include this in your role to start the Director tree to run KeyboardWalk.

Consumes

Emits

  • message::strategy::StandStill to make the robot still while not walking
  • message::behaviour::state::Stability to set the robot's initial stability state
  • message::strategy::FallRecovery to enable getting up when fallen
  • message::skill::Kick to kick with left/right leg
  • message::skill::Look to look in desired direction
  • message::skill::Walk to walk with desired velocity

Dependencies

Script Runner

Description

Allows scripts to be run from the command line.

Usage

ScriptRunner will attempt to run each command line parameter as a script. Once the first script has completed it will run the next, and so on until all are finished at which point it terminates the program.

Consumes

  • NUClear::message::CommandLineArguments containing the list of scripts from the command line

Emits

  • message::actuation::LimbsSequence through the Script utility, which populates the requested Script/s into LimbsSequences.

Dependencies

Script Tuner

Description

Provides a curses interface for creating, editing and tweaking scripts.

Usage

The program must be started with the name of a script file to edit as its sole command line argument. If the file does not exist then a new blank script is started and the file will be created when it is saved.

The keyboard controls are as follows:

  • Up/Down arrow: Select servo
  • Left/right arrow: Select angle or gain
  • , (comma): Go to previous frame
  • . (period): Go to next frame
  • Enter: Edit selected field
  • Space: Toggle motor lock
  • : (colon): List available commands
  • A: Save script as
  • G: Allows multiple gain edits at once
  • I: Delete current frame
  • J: "jump" to frame without the robot moving
  • M: Mirror script - flip about sagittal plane
  • N: Insert a new frame before the current frame
  • R: Refresh the view
  • S: Save script
  • T: edit frame duration
  • X: Shutdown powerplant/stop binary

Consumes

  • NUClear::message::CommandLineArguments containing the name of the script to edit
  • module::behaviour::tools::LockServo (internal to this class only) to trigger servo lock event
  • message::platform::RawSensors to get position of specific servo when locking it

Emits

  • message::actuation::ServoTarget to control currently selected servo when locked or unlocked
  • message::actuation::ServoTargets to control all servos when transitioning between frames
  • message::actuation::LimbsSequence to play the script
  • module::behaviour::tools::LockServo (internal to this class only) to trigger servo lock event

Dependencies

  • libncurses is used for the user interface

Soccer

Description

Starts the Director graph for the soccer scenario. If the robot is penalised, it will make it stand still. Otherwise, it will emit the Task corresponding to the soccer position specified in configuration.

If the configuration is set to "dynamic" it will choose the appropriate position out of Defender and Striker. The robot listens for the positions of other robots and makes its decision.

Possible positions are Striker, Goalie and Defender.

Usage

Include this in your role to start the Director tree to play soccer.

Consumes

  • message::purpose::FindPurpose to find the right purpose to emit
  • message::input::Robocup to dynamically determine the robot's purpose
  • message::localisation::Ball to determine the robot's distance to the ball, for comparison with other potential strikers
  • message::input::Sensors to transform the ball from world to robot space
  • message::input::GameEvents::Penalisation to find out if the robot has been penalised and should stop moving
  • message::input::GameEvents::Unpenalisation to find out if the robot has been unpenalised and can play again
  • message::input::ButtonMiddleDown to force play with a middle button press

Emits

  • message::purpose::FindPurpose a Task to request to find the robot's soccer playing purpose, to start the Director graph to play soccer
  • message::purpose::Purposes to inform the other robots of their purposes
  • message::strategy::StandStill to make the robot still while penalised
  • message::platform::ResetWebotsServos to reset the servos in Webots when penalised
  • message::behaviour::state::Stability to set the robot's initial stability state to standing
  • message::strategy::FallRecovery a Task to request the robot to manage falling
  • message::purpose::Striker a Task to request the robot acts as a striker
  • message::purpose::Goalie a Task to request the robot acts as a goalie
  • message::purpose::Defender a Task to request the robot acts as a defender

Dependencies

Striker

Description

Play soccer in the striker position, which is an offensive position. Either bypass GameController and force play, or uses GameController information to decide what to do.

In the ready state, makes a Ready subtask.

In the playing state (for both normal game mode and penalty shootout), finds the ball, fixates on the ball, walks to the ball, and kicks the ball. It will not approach the ball if it is not in its own bounding box, and instead will stand nearby.

In other states, stands still.

Usage

Add this module to play as a striker in soccer!

Consumes

  • message::input::GameState to get information about the state of the game
  • message::input::GameState::Data::Phase to get specific information about the current game phase (initial, ready, set, playing, etc).
  • message::strategy::Striker a Task requesting to play as a Striker
  • message::strategy::NormalStriker a Test requesting to play as a Striker in the normal game state
  • message::strategy::PenaltyShootoutStriker a Task requesting to play as a Striker in the penalty shootout game state

Emits

  • message::strategy::NormalStriker a Task requesting to play as a Striker in the normal game state
  • message::strategy::PenaltyShootoutStriker a Task requesting to play as a Striker in the penalty shootout game state
  • message::strategy::Ready a Task requesting to walk to the ready position
  • message::strategy::StandStill a Task requesting to stand still and not move
  • message::strategy::FindBall a Task requesting to look and move around to find the ball
  • message::strategy::LookAtBall a Task requesting to look at a known ball
  • message::strategy::WalkToBall a Task requesting to walk to a known ball
  • message::strategy::AlignBallToGoal a Task requesting to align the robot to face the goal with the ball infront of it
  • message::planning::KickToGoal a Task requesting to kick the ball towards the goal
  • message::strategy::WalkInsideBoundedBox a Task requesting that the robot stays within a defined bounded box

Dependencies

Tester

Description

This module allows the user to select various combinations of strategies and planners with different priorities for testing purposes. For example, you may want to only test walking to the ball and kicking, which can be achieved by only enabling the WalkToBal and KickTo tasks in the config.

Usage

Add this module and enable/disable strategies and planners in the config which you wish to test.

Consumes

Emits

If enabled in the config the module emits the following.

  • message::strategy::StandStill a Task requesting to stand still and not move
  • message::strategy::FindBall a Task requesting to look and move around to find the ball
  • message::strategy::LookAtBall a Task requesting to look at a known ball
  • message::strategy::WalkToBall a Task requesting to walk to a known ball
  • message::strategy::AlignBallToGoal a Task requesting to align the robot to face the goal with the ball infront of it
  • message::planning::KickToGoal a Task requesting to kick the ball towards the goal
  • message::planning::KickTo a Task requesting to kick the ball if close
  • message::strategy::StandStill a Task requesting the robot to stand still
  • message::strategy::LookAround a Task requesting the robot to look around
  • message::strategy::WalkToFieldPosition a Task requesting the robot to walk to a specified position

Dependencies

  • Eigen
Modules
Platform
Modules
Skill
NUbots acknowledges the traditional custodians of the lands within our footprint areas: Awabakal, Darkinjung, Biripai, Worimi, Wonnarua, and Eora Nations. We acknowledge that our laboratory is situated on unceded Pambalong land. We pay respect to the wisdom of our Elders past and present.
Copyright © 2024 NUbots - CC-BY-4.0
Deploys by Netlify