BB.Sim.Actuator (bb v0.19.0)

Copy Markdown View Source

Simulated actuator for kinematic simulation mode.

This actuator is automatically used in place of real actuators when the robot is started with simulation: :kinematic. It:

  • Receives position commands via pubsub, cast, and call
  • Calculates motion timing from the motor profile's velocity and acceleration limits
  • Publishes BeginMotion messages (in joint-space, via BB.Actuator.publish_begin_motion/3) for position estimation
  • Clamps positions to the motor-space limits derived from the joint

Like every other driver, the sim operates purely in motor-space: the wrapper transforms inbound commands joint→motor before they arrive here, and the outbound publish helper transforms motor→joint on the way out. When the joint has no transmission, motor-space and joint-space are identical.

Works with BB.Sensor.OpenLoopPositionEstimator for position feedback.

Example

# Start robot in simulation mode
MyRobot.start_link(simulation: :kinematic)

# Commands work identically to hardware mode
BB.Actuator.set_position(MyRobot, [:base, :shoulder, :motor], 1.57)