Unit 06 · lesson
The Controller in the Middle
A robot controller sits between physical evidence and physical action.
It receives values, executes logic, updates state, and sends outputs. That sounds simple until timing enters the picture.
Input → computation → output
A basic cycle might be:
read distance
read encoder
update robot state
choose behavior
calculate motor command
send output
repeat
The controller does not run "the program" once. Embedded robot software usually executes repeatedly or reacts to events over time.
Physical signals become data
A controller can receive several kinds of signals:
- a digital input such as a limit switch;
- an analog voltage representing a continuous measurement;
- timed pulses from an encoder;
- structured messages from a sensor over a bus;
- network messages from another computer.
Each route has its own failure modes.
A value of 0 might mean "switch open," "sensor at minimum," "message missing," or "software default." Context matters.
Outputs are commands, not results
If code writes:
left_motor = 0.4
the physical chain still includes:
software value → output interface → motor driver → electrical power → motor torque → wheel traction → robot motion
Never let a variable name trick you into skipping the rest of the system.
Timing
Suppose a control loop runs every 20 milliseconds. If one operation blocks for 500 milliseconds, twenty-five expected updates are delayed.
That can affect:
- motor commands;
- sensor reads;
- watchdogs;
- network messages;
- safety reactions.
Real-time robotics is not only about doing the correct calculation. It is also about doing it at a useful time.
Controller map
Create an input/output map for a simple robot:
| Input | Data type | Used for | Output affected |
|---|---|---|---|
| left encoder | count/rate | distance + speed | left motor |
| right encoder | count/rate | distance + speed | right motor |
| stop switch | digital | safety state | both motors |
| distance sensor | range | obstacle state | drive command |
Then draw one line where timing matters.
That is the controller's real job: coordinating evidence and action over time.
Controllers live between worlds
A robot controller has to translate between software abstractions and electrical reality.
Software may contain a variable such as:
desired_speed = 0.40
The physical system needs something different: a timed pulse, a bus message, a voltage command to a driver, or another electrical interface. The controller and its peripherals perform that translation.
In the opposite direction, a sensor might produce a voltage, count pulses, or send a digital message. Software eventually sees a number such as 1.73 or 4281.
That number has a history.
physical quantity
↓
sensor transduction
↓
electrical signal
↓
controller input / interface
↓
numeric representation
↓
program logic
If the number is wrong, the bug can exist at any layer in that chain.
Processing speed is not control quality
A faster processor does not automatically produce a better robot. Control depends on predictable timing, correct interfaces, usable sensor data, and software that completes work within the required cycle.
For a balance controller, a computation that is extremely accurate but arrives 500 ms late may be worse than a simpler estimate delivered every 10 ms.
This leads to a useful engineering question:
What must this controller know and finish before the next decision is due?
Write that question beside every control loop you design. It forces timing to become part of the architecture instead of an afterthought.
system flow
Controllers, Actuators, and Safe Integration: Safe Control Flow
De-energize
Confirm the approved setup and power-off boundary.
Trace
Model power, signal, controller, and actuator paths.
Test
Use a controlled observation to check expected behavior.
Document
Record correction, limitation, and next safe step.
Read this concept flow as plain text
- De-energize. Confirm the approved setup and power-off boundary.
- Trace. Model power, signal, controller, and actuator paths.
- Test. Use a controlled observation to check expected behavior.
- Document. Record correction, limitation, and next safe step.