BB.Servo.Feetech.Actuator (bb_servo_feetech v0.3.0)

Copy Markdown View Source

An actuator that uses a Feetech controller to drive a serial bus servo.

Configuration is derived from the joint's motor_profile injected by BB.Actuator.Server:

  • Position limits from motor_profile.motor_lower / motor_upper
  • Velocity limit from motor_profile.motor_velocity_limit
  • Position range maps to the servo's goal_position register

When initialised, the actuator:

  1. Disables torque on the servo
  2. Registers with the controller, receiving the shared ETS table reference
  3. Subscribes to position commands

When a position command is received, the actuator:

  1. Clamps the position to motor limits
  2. Converts to servo position units (0-4095 for 360 degrees)
  3. Writes goal_position and goal_speed to the controller's ETS table
  4. Publishes a BB.Message.Actuator.BeginMotion via BB.Actuator.publish_begin_motion/3 (which handles the motor → joint-space conversion)

The controller picks up pending commands on its next loop tick and batches them into efficient sync_write operations on the serial bus.

Example DSL Usage

controller :feetech, {BB.Servo.Feetech.Controller,
  port: "/dev/ttyUSB0",
  baud_rate: 1_000_000
}

joint :shoulder, type: :revolute do
  limit lower: ~u(-90 degree), upper: ~u(90 degree), velocity: ~u(60 degree_per_second)

  actuator :servo, {BB.Servo.Feetech.Actuator, servo_id: 1, controller: :feetech}
end

Summary

Functions

Safety disarm callback.

Functions

disarm(opts)

Safety disarm callback.

Returns :ok because torque management is handled by the controller. The controller receives all registered servo IDs and disables torque for all of them in a single sync_write operation, which is more efficient for bus-based protocols.