Repository navigation
22. RobotController Configuration
The RobotController is configured through a YAML document that defines the timing parameters of the control loop and the calibration used to convert raw power supply measurements into voltages.
The configuration is validated against the controller-schema-2.0 JSON schema before the controller is created.
| Parameter | Type | Required | Description |
|---|---|---|---|
reactionInterval |
integer | Yes | Minimum simulation time (milliseconds) between two consecutive inference executions. |
commandInterval |
integer | Yes | Minimum simulation time (milliseconds) between two command synchronization cycles. |
supplyValues |
integer[2] | Yes | Two raw ADC values used for battery voltage calibration. |
voltages |
number[2] | Yes | Voltages corresponding to the two calibration points defined in supplyValues. |
reactionInterval: 100
commandInterval: 50
supplyValues:
- 512
- 768
voltages:
- 10.8
- 12.6Defines how frequently the controller is allowed to execute the inference algorithm.
The controller does not execute inference after every sensor event. Instead, it waits until the configured interval has elapsed since the previous execution.
A smaller value results in:
- faster reactions;
- higher CPU utilization.
A larger value results in:
- lower computational load;
- slower robot response.
Defines how frequently the controller synchronizes the desired robot command with the actual robot state.
During each synchronization cycle, the controller verifies whether the requested command has already been achieved. If not, the appropriate command is sent to the robot.
This mechanism avoids repeatedly transmitting identical commands while ensuring that command execution remains reliable.
Defines two raw measurements produced by the robot's power supply sensor.
These values represent the calibration points of the analog-to-digital converter (ADC).
The array must contain exactly two integer values.
Example:
supplyValues:
- 520
- 780Defines the voltages corresponding to the raw values specified in supplyValues.
The array must contain exactly two floating-point values.
Example:
voltages:
- 10.5
- 12.6The controller computes the battery voltage using linear interpolation between the two calibration points.
Given:
Raw1 -> Voltage1
Raw2 -> Voltage2
every measured raw value is converted into a voltage using a linear mapping.
For example:
| Raw value | Voltage |
|---|---|
| 520 | 10.5 V |
| 650 | 11.55 V |
| 780 | 12.6 V |
This calibration allows the controller to convert hardware-specific ADC readings into meaningful physical values.
The configuration is validated before the controller is created.
The following conditions must be satisfied:
-
reactionIntervalmust be present. -
commandIntervalmust be present. -
supplyValuesmust contain exactly two integers. -
voltagesmust contain exactly two floating-point values. - The document must conform to the
controller-schema-2.0JSON schema.
If any validation fails, controller creation is aborted with an exception.
During initialization, the controller performs the following steps:
- Validates the YAML document.
- Reads the timing parameters.
- Reads the voltage calibration points.
- Creates a linear interpolation function for voltage conversion.
- Instantiates the
RobotControllerwith the configured parameters.
The resulting controller is immediately ready to be connected to a RobotApi instance.
Current version: 0.27.0