Brings across the robot layer from monolitic-littlehand-python, which was written against this same controller. The point of it is that a command either moved the arm or raised: the SDK returns a code for a motion the controller quietly refused, wait_move calls that refusal finished, and arm.error_code is the report stream's stale copy. So errors are read live, arrival is confirmed rather than assumed, and a move whose straight-line path leaves the joint envelope is refused before it is commanded. Failures are typed, because the distinctions decide the response: an unreachable pose is not an unavailable arm, and a joint past its limit needs a motion nobody should start without warning the room. read_report is the deliberate exception to all of it: a report-cache read that costs no round trip and cannot block, which is the only read that works while a motion is in flight.
14 lines
354 B
Python
14 lines
354 B
Python
"""Timestamped stderr logging.
|
|
|
|
stderr rather than stdout: dora reads a dynamic node's stdout, and a print that
|
|
lands there is noise in the wrong stream.
|
|
"""
|
|
|
|
import sys
|
|
import time
|
|
|
|
|
|
def log(message: str) -> None:
|
|
"""Print a timestamped line for the node."""
|
|
print(f"[ulite6 {time.strftime('%H:%M:%S')}] {message}", file=sys.stderr, flush=True)
|