BB.Servo.PCA9685.Actuator (bb_servo_pca9685 v0.5.0)
View SourceAn actuator that uses a PCA9685 controller to drive a servo.
This actuator derives its configuration from the joint constraints defined in the robot:
- Position limits from
joint.limits.lowerandjoint.limits.upper - Velocity limit from
joint.limits.velocity - PWM range maps linearly to the joint's position range
When a position command is received, the actuator:
- Clamps the position to joint limits
- Converts to PWM pulse width
- Sends PWM command to the PCA9685 controller
- Publishes a
BB.Message.Actuator.BeginMotionfor sensors to consume
Example DSL Usage
controller :pca9685, {BB.Servo.PCA9685.Controller, bus: "i2c-1", address: 0x40}
joint :shoulder, type: :revolute do
limit lower: ~u(-45 degree), upper: ~u(45 degree), velocity: ~u(60 degree_per_second)
actuator :servo, {BB.Servo.PCA9685.Actuator, channel: 0, controller: :pca9685}
sensor :feedback, {BB.Sensor.OpenLoopPositionEstimator, actuator: :servo}
end
Summary
Functions
Disable the servo by setting pulse width to 0.
Functions
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 receives the robot module,
controller name, and channel from the opts provided during registration.