hardware.yml
config/hardware.yml declares every sensor on the robot. Motors and servos are merged in from their own files, so the codegen sees one flat namespace. Each key becomes an attribute on the generated Defs class, and the key must be a valid Python identifier.
# config/hardware.yml
_motors: !include-merge 'motors.yml'
_servos: !include-merge 'servos.yml'
button:
type: DigitalSensor
port: 10
front_left_ir_sensor:
type: IRSensor
port: 0
front:
type: SensorGroup
left: front_left_ir_sensor
right: front_right_ir_sensor
The two _ keys are merge anchors: the loader consumes them and they do not become attributes. How !include-merge works is on Config Structure → Includes
. Motors are described in Motor config
, servos in Servos in servos.yml
.
Entry types
type | Page |
|---|---|
IRSensor | IR Sensors |
SensorGroup | Sensor Groups |
DigitalSensor | Digital Sensors and Buttons |
AnalogSensor, ETSensor | Analog and ET Sensors |
Motor, Servo | in motors.yml and servos.yml, see above |
Entries with a special meaning
button
Every project must define an entry named button of type DigitalSensor. Steps like wait_for_button() use it as the confirmation input, and the code generator rejects a project without it. The Wombat’s built-in button is on port 10.
button:
type: DigitalSensor
port: 10
imu
An imu entry is always generated, even when it is not listed. If you list it, extra keys are passed to the Imu() constructor.
imu:
type: IMU
wait_for_light_sensor
The name wait_for_light_sensor is reserved for the start-lamp sensor. See Wait for Light
for the keys it accepts.
Defs.analog_sensors
The codegen collects every analog-type sensor (AnalogSensor, IRSensor, ETSensor) into the Defs.analog_sensors list. By default, collect_ir_set
samples all IRSensor entries in that list. Pass sensors=[...] to limit it, for example to leave out the start-lamp sensor.