BB.Ufactory.Actuator.Gripper (bb_ufactory v0.2.0)

Copy Markdown View Source

Gripper G2 position actuator for xArm arms.

Controls the UFactory Gripper G2 via the xArm RS485 RTU proxy (register 0x7C). Position is expressed in pulse units (0–850, where 850 is fully open), capped in BB.Ufactory.Protocol.cmd_gripper_position/2.

Lifecycle

The gripper is not enabled during init/1. Instead, the actuator registers its cmd_gripper_enable(true) and cmd_gripper_speed frames with the controller, which sends them at the end of its own arm sequence on every :armed transition. This guarantees no RS485 command reaches the bus before the arm controller is fully initialized (mode 0, state 0) — ordering a separate state-machine subscription could not provide, since pubsub dispatch order across subscribers is unspecified.

Command Interface

Receives standard %BB.Message.Actuator.Command.Position{} commands, where position is the target position in pulse units (0.0–850.0). Non-integer values are rounded to the nearest integer. All transports converge on BB.Actuator.handle_command/2; only Command.Position is declared, so the framework refuses other payload types before the driver sees them. A synchronous caller (BB.Actuator.set_position/4) receives {:error, reason} when the controller cannot deliver the frame.

Disarm

On disarm, the actuator sends cmd_gripper_enable(false) through the controller via BB.Process.call/3, avoiding the need for host/port in the actuator's init opts.