Match lifecycle¶
The normal HELM lifecycle is:
Students normally call configure() followed by run(). Direct arm() and
disarm() calls are advanced controls and are not needed for ordinary match
programs.
Phase callbacks¶
Robot.run() accepts three optional callbacks:
| Callback | When it runs |
|---|---|
initialize(robot) |
Once, immediately after the robot is armed |
autonomous(robot) |
When the phase becomes Phase.AUTON |
driver(robot) |
When the phase becomes Phase.DRIVER |
Omitted callbacks are treated as no-ops and outputs remain idle during that phase.
Use robot.running inside phase callbacks¶
Each phase callback owns its own loop:
robot.running is true only while:
- the current phase is autonomous or driver;
- the matching callback is active; and
- that phase has not ended.
When the field changes phase, robot.running becomes false and the loop exits.
It becomes true again inside the next matching callback.
Returning early¶
A callback may return before its phase ends:
def autonomous(robot):
robot.thruster("A1").set_duty(30)
# Returning idles all outputs. This callback is not called again this phase.
When any phase callback returns, HELM resets all buffered effector commands to idle. The communication keepalive continues, but the callback is not invoked again for that same phase.
Reading the phase¶
robot.phase contains a Phase enum:
Match phase comes from the field, robot path, or HELM extension. Student code reports and responds to it; student code does not set it.
E-Stop¶
robot.estopped reports E-Stop state but cannot change it:
E-Stop authority belongs to the HELM extension UI and field system. There is no Python API to trigger or clear E-Stop, ensuring that safety control remains independent of the student program.
run() exits when the phase reaches ESTOP or POSTMATCH, idles all outputs,
and requests disarm.