Files
dora-ulite6/dora_ulite6/errors.py
T
cristhian eccd9e3c24 add xArm driver layer ported from littlehand
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.
2026-09-12 11:46:54 -03:00

44 lines
1.6 KiB
Python

"""Everything the robot layer raises.
The distinctions matter: they say whether the arm moved, whether anything can be
done about it, and whether the answer needs a human first. Taken from the
littlehand robot layer, where they were arrived at against this same controller.
"""
class MotionInterruptedError(Exception):
"""The motion was aborted in flight, by :meth:`ULite6.stop` or a controller fault."""
class RobotUnavailableError(Exception):
"""The command never ran because the arm was not usable.
A pulled cable, a pressed emergency stop, a latched controller error: what a
caller must do is the same, and it is never to carry on as if the arm moved.
Recoverable by :meth:`ULite6.recover`.
"""
class UnreachablePoseError(Exception):
"""The pose was never commanded because the arm cannot hold it.
Deliberately not a :class:`RobotUnavailableError`: the arm is fine and the
target is not, so a retry would only ask the same impossible thing and latch
a joint limit error on the controller.
"""
class ArmNeedsHomingError(RobotUnavailableError):
"""Only a motion of ours can clear this error, so the caller must warn first.
A joint past its own limit stays past it however often the error is cleared.
Narrow on purpose: an arm that is stopped rather than stuck — emergency stop
held, collision to be dragged out of by hand — stays a plain
:class:`RobotUnavailableError`, because homing it would move an arm somebody
stopped deliberately.
"""
class EffectorUnsupportedError(Exception):
"""The configured effector is not one this arm can drive."""