encoder_arm
encoder_arm.py
Overview
encoder_arm.py is a synthetic joint-position sensor that publishes pseudo-random encoder angles for the TIAGo arm at a fixed rate. It enables controllers, loggers, and dashboards to run when no real hardware is connected.
Interfaces (strongly-typed, stateless)
Direction |
Topic |
Semantics |
---|---|---|
Provided |
|
|
Contract
Pre-conditions
Node launched with a valid robot_id CLI argument.
Downstream subscribers expect arm encoder ticks at ~10 Hz.
Post-conditions
Publishes exactly one Int32 per loop iteration.
data field is an integer uniformly drawn from [0, _MAX_ANGLE].
No other side-effects or retained state.
Invariants
Loop frequency = _RATE Hz ± ROS scheduler jitter.
Angle range fixed by _MAX_ANGLE.
Quality-of-Service KPIs
Metric |
Target |
Rationale |
---|---|---|
Message rate |
10 Hz ± 0.5 Hz |
Keeps controllers in sync. |
Latency |
< 100 ms |
Prevents stale joint readings. |
CPU load |
< 1 % |
Safe on onboard CPU. |
Implementation notes
Uses random.randint(0, _MAX_ANGLE) for angle generation.
All logic resides in arm_encoder(); the main loop only maintains timing.
Seed the RNG (random.seed(…)) before calling for reproducible traces.
Functions
Initialise ROS publisher and broadcast random encoder angles until shutdown. |