Input

Documentation for each input module in the main NUbots codebase
Updated 23 Mar 2026

Camera

Description

Reads Cameras: Which are GigE Vision or U3V (Usb3 Vision, via USB3 Cable).

Usage

Settings are defined in the config/Cameras

Emits

  • message::input::Image

Dependencies

  • Aravis

FakeCamera

Description

Loads compressed images (JPEGs) and corresponding lens parameters (YAML files) from the specified folder and emits them as CompressedImage messages

Images are and lens files are expected to be named using a common theme (e.g. image000001.jpg and lens000001.yaml).

Usage

In the config file set image_folder to be the path to the folder containing the image and lens files, image_prefix to the portion of the filename that is common to all image files and lens_prefix to the portion of the filename that is common to all lens files.

image_folder: 'images'
image_prefix: 'image'
lens_prefix: 'lens'

All images are assumed to be JPEGs with either a .jpg or .jpeg extension. All lens files are assumed to be YAML files with a .yaml extension.

Lens files should contain the following information

projection: EQUISOLID # Either RECTILINEAR, EQUIDUSTANT, or EQUISOLID
focal_length: 420 # Un-normalised focal length in pixels
centre: [0, 0] # Distance between the camera centre axis and optical axis in pixels (measured from the centre of the image)
k: [0, 0] # Distortion coefficients
fov: 1.59286 # Field of view in radians
Hoc: # Camera to observation plane (world) homogeneous transformation
- [-0.308872, 0.945477, 0.103304, 0]
- [-0.84664, -0.223831, -0.482805, 0]
- [-0.433359, -0.236586, 0.869613, 0.9]
- [0, 0, 0, 1]

Emits

  • message::output::CompressedImage with a JPEG FOURCC code

Dependencies

  • Eigen
  • libjpeg-turbo

Game Controller

Description

Listens for RoboCup GameController UDP broadcast packets, converts them into NUClear messages, and maintains a canonical message::input::GameState.

The module also sends periodic and state-dependent reply packets back to the GameController (alive, penalised, unpenalised).

Usage

Install module::input::GameController in the powerplant.

This module is configured by GameController.yaml and consumes:

  • message::support::GlobalConfig for team_id and player_id

At runtime it:

  • Listens for UDP broadcast packets on receive_port
  • Accepts only supported packet version 12
  • Optionally filters incoming packets by source IP using udp_filter_address
  • Tracks the sender address and sends reply packets to that address on send_port
  • Sends ALIVE reply packets every 2 seconds

Emits

  • message::input::GameState
  • message::input::GameState::Phase
  • message::input::GameState::Mode
  • message::input::GameState::TeamColour
  • message::input::GameEvents::Score
  • message::input::GameEvents::GoalScored
  • message::input::GameEvents::Penalisation
  • message::input::GameEvents::Unpenalisation
  • message::input::GameEvents::CoachMessage
  • message::input::GameEvents::HalfTime
  • message::input::GameEvents::BallKickedOut
  • message::input::GameEvents::KickOffTeam
  • message::input::GameEvents::GamePhase
  • message::input::GameEvents::GameMode

Also sends UDP GameController reply packets (PENALISED, UNPENALISED, ALIVE) via emit<Scope::UDP>(...).

Dependencies

  • NUClear UDP networking (for broadcast receive and unicast reply)

ImageDecompressor

Description

Decompresses images that are in JPEG format to raw images, using a variety of decompressors. It will use decompressors in order until it finds a free one to compress the image. In the event that no compressors are currently free it will drop the image.

Usage

Triggers on message::output::CompressedImage Configuration from ImageDecompressor.yaml

Emits

  • message::input::Image

Dependencies

  • TurboJPEG

NatNet

Description

Receives OptiTrack NatNet motion-capture packets and converts them into message::input::MotionCapture.

The module listens to NatNet data broadcasts, pings the discovered server, requests model definitions, and then parses frame packets into NUbots mocap messages.

In the Motive software, ensure the advanced streaming settings are set to the following:

Motive Streaming Settings

Broadcast Frame Data: On Local Interface: <motive_device_ip> # Set to the ip of the device running motive, sometimes toggling on/off needed

Marker Options
  • Labeled Markers: Off
  • Unlabeled Markers: Off
  • Asset Markers: Off
Rigid Body Options
  • Rigid Bodies: On
  • Skeletons: Off
  • Skeleton Coordinates: Global
  • Skeleton As Rigid Bodies: Off
  • Bone Naming Convention: Motive
  • Up Axis: Z Up
Miscellaneous
  • Remote Trigger: Off
  • Transmission Type: Multicast
  • Subject Prefix:
  • Visual3D Compatible: Off
  • Scale: 1
Networking
  • Command Port: 1510
  • Data Port: 1511
  • Multicast Interface: 239.255.42.99
  • Multicast as Broadcast: On
  • Socket Size: 1000000

Usage

Install module::input::NatNet and configure NatNet.yaml.

Default configuration values:

  • multicast_address: 239.255.42.99
  • command_port: 1510
  • data_port: 1511
  • dump_packets: false
  • max_delay_samples: 100

At runtime the module:

  • Binds UDP sockets for NatNet command and data traffic
  • Detects the active NatNet server from incoming broadcast packets
  • Sends a NatNet ping and reads the remote protocol version
  • Requests model definitions when needed
  • Estimates and logs network delay statistics

Consumes

  • extension::Configuration from NatNet.yaml
  • NUClear::UDP::Packet (NatNet command traffic)
  • NUClear::UDP::Packet via UDP::Broadcast on data_port (NatNet frame traffic)

Emits

  • message::input::MotionCapture

Dependencies

  • An OptiTrack motion capture system sending packets over the network using the NatNet protocol.

Sensor Filter

Description

Uses a Unscented Kalman filter to filter the raw incoming data, and provide clean platform agnostic data.

We assume that the IMU (accelerometer and gyroscope) are oriented to conform with the standard coordinate system x-axis out the front of the robot y-axis to the left z-axis up

For the accelerometer the orientation should be as follows x axis reports a +1g acceleration when robot is laying on its back y axis reports a +1g acceleration when robot is laying on its right side z axis reports a +1g acceleration when robot is vertical

Usage

When installed, it will read incoming message::platform::RawSensors objects and pass them through the kalman filter. The resulting filtered data will then be outputted as message::input::Sensors to be used by the rest of the system.

Consumes

  • message::platform::RawSensors in order to filter them.

Emits

  • message::input::Sensors with filtered data from the input.
  • message::input::ButtonLeftDown when button pressed.
  • message::input::ButtonLeftUp when button released.
  • message::input::ButtonMiddleDown when button pressed.
  • message::input::ButtonMiddleUp when button released.
  • message::eye::DataPoint if log_level >= DEBUG, indicating if feet are down.
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 © 2026 NUbots - CC-BY-4.0
Deploys by Netlify