BB.Servo.Pigpio.Actuator (bb_servo_pigpio v0.9.0)

Copy Markdown View Source

An actuator that uses Pigpiox to drive a 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
  • PWM range maps linearly to the motor's position range (motor_lower → min_pulse, motor_upper → max_pulse)

When a position command is received, the actuator:

  1. Clamps the position to motor limits
  2. Converts to PWM pulse width
  3. Sends PWM command to pigpiox
  4. Publishes a BB.Message.Actuator.BeginMotion via BB.Actuator.publish_begin_motion/3 (which handles the motor → joint-space conversion)

Position feedback

An RC servo has no return path, so this driver declares no BB.Actuator.capabilities/1 - it writes PWM and reads nothing. Pair it with BB.Sensor.OpenLoopPositionEstimator, which turns the BeginMotion message published above into BB.Message.Sensor.JointState - the only thing BB.Robot.State is written from. Leave it out and the joint reads as parked at its initial position however far the servo travels; BB.Dsl warns at compile time when it finds one.

Safety

This actuator implements the BB.Safety behaviour. When the robot is disarmed (either by command or due to supervisor crash), the servo PWM output is disabled by setting the pulse width to 0.

Summary

Functions

Disable the servo by setting pulse width to 0.

Functions

disarm(opts)

Disable the servo by setting pulse width to 0.

Called by BB.Safety.Controller when the robot is disarmed or crashes. This function works without GenServer state - it only needs the pin number.