Robotics & Mechatronics · Embedded execution and hardware contracts
Define command/state units, timestamps and validity
A robot message needs more than a numerical value. State exactly which quantity it represents, its unit and reference, when it was acquired or is to apply, and which conditions make it usable.
All numerical tables, scenarios and records are original constructed teaching data unless a specific external dataset is named. No physical experiment is claimed. A worked simulation model is distinguished from an executed simulator.
Lesson preparation and course links
Use the local explanations and supplied units, diagrams, tables and examples; advanced chapters build on the named local chapters. External links are point-of-need depth, not a requirement to finish an entire map.
Back to the Robotics chapterAfter reading, you can
Make position, velocity, effort, enable and fault fields unambiguous across a controller and device interface.
Define a command/state contract
Contract C1 is a fictional one-axis message pair. Fields are illustrative and do not claim to be ROS message definitions.
| Field | Command meaning | State meaning |
|---|---|---|
| quantity/unit | position in rad | measured joint angle in rad |
| reference | joint-zero version J3 | same supported J3 calibration/reference |
| time | apply-at in device monotonic clock | acquired-at in mapped sensor clock |
| identity | session epoch and command sequence | acquisition sequence and configuration ID |
| validity | within range and unexpired; explicit acceptance | finite, fresh, referenced, quality accepted |
| effort | if used: N·m, separate mode | estimated or measured torque must be labelled |
Dimensional consistency is part of the interface
A field called effort can mean torque for a rotational joint or force for a linear joint. Current in amperes is not torque without an explicit supported conversion. A position array must retain joint ordering as well as unit. A swapped index can be numerically plausible while moving the wrong axis.
SI conventions help interoperability, but a driver or device can use counts, degrees or millimetres internally. Transform exactly once at an explicit boundary and retain raw values. Double conversion is as wrong as missing conversion.
Distinguish apply time, acquisition time and receipt time
A command queued at 1.000 s for application at 1.020 s differs from a state acquired at 1.015 s and received at 1.030 s. Controller decisions must use the age and alignment appropriate to their question. Network receipt time does not reveal acquisition age by itself.
Compare times only through a supported clock mapping. Clock drift, reset and synchronisation uncertainty can invalidate the relationship. An epoch identifies a restart/session change so an old timestamp or sequence cannot masquerade as current.
Find the contract defect
Assume the consumer expects C1 and all unspecified fields are otherwise valid.
| Incoming record | Defect |
|---|---|
| position=90, unit=degree | Unit differs; convert at declared boundary or reject |
| joint order [elbow, shoulder] instead of [shoulder, elbow] | Identity/order mismatch |
| position=0.2 rad, reference J2 | Reference mismatch |
| acquired clock restarted; old mapping retained | Age/alignment unsupported |
| effort=1.0 A labelled N·m | Quantity mismatch, not just formatting |
Keep enough raw evidence to reconstruct the decision
Store raw message identity, conversion version, clock mapping, accepted command and applied/observed response. A later analyst should be able to distinguish rejection, delayed application, wrong conversion and genuine tracking error.
A contract test feeds valid, boundary and malformed records through the interface and checks its logged response. It is an implementation check, not a general AI estimation or frame-theory lesson.
Align a command and an observation
Command application is scheduled for 1.020 s. A position sample acquired 1.015 s predates it by 5 ms even if received 1.030 s. It cannot demonstrate the response to that command.
A later sample acquired 1.025 s is 5 ms after application, subject to clock-mapping uncertainty. If mapping uncertainty is±8 ms, the relative ordering is not firmly established by those timestamps alone. Report that timing limitation rather than assigning a precise 5 ms response.
Try the reasoning
Why is receipt time insufficient to establish sensor age?
Show the answer and reasoning
Acquisition and transport delay can differ. The record needs acquisition time and a supported mapping.
Can 1 A be relabelled 1 N·m?
Show the answer and reasoning
No. A supported torque/current relationship and conditions are required; they are different physical quantities.
Why include an epoch as well as sequence?
Show the answer and reasoning
A restart can reset counters and clocks. Epoch distinguishes old-session records from current ones.
What is 90° in radians?
Show the answer and reasoning
π/2≈1.5708 rad, converted once at the declared boundary.
What to carry forward
Units, reference, identity and timestamp meaning are part of the robot value. A plausible number with the wrong contract is unusable.
References
Sources supporting this lesson’s explanations and examples.