BB.Ufactory.Sensor.ForceTorque (bb_ufactory v0.1.0)

Copy Markdown View Source

Force-torque sensor for xArm arms (register 0xC8 / 0xC9).

Enables the xArm's built-in F/T sensor on init/1 and subscribes to wrench messages published by BB.Ufactory.Controller. The controller extracts ft_filtered data from the 135+ byte real-time report frames (port 30003) and publishes a BB.Ufactory.Message.Wrench to [:sensor, controller_name, :wrench] whenever valid data arrives.

This sensor forwards those messages to its own pubsub path ([:sensor | sensor_path]) so application code can subscribe to a stable, sensor-scoped topic without knowing the controller name.

Data Availability

ft_filtered data is only present in real-time report frames when the F/T sensor has been explicitly enabled. Enabling is done automatically in init/1 via cmd_ft_sensor_enable(true). Until the first frame with F/T data arrives, no BB.Ufactory.Message.Wrench messages are published.

Disarm / Re-arm

On disarm, the sensor attempts to send cmd_ft_sensor_enable(false) via the controller process. This is best-effort: if the controller is already down, the attempt is silently ignored and :ok is returned.

Because disarm disables the hardware sensor, init/1 also registers the enable frame with the controller's arm sequence, so the sensor is re-enabled automatically on every :armed transition — without this, the first disarm→re-arm cycle would leave the sensor silently disabled.

Configuration

sensor :wrench, {BB.Ufactory.Sensor.ForceTorque,
  controller: :xarm
}