BB.IK.DLS.Tracker (bb_ik_dls v0.3.3)

Copy Markdown View Source

GenServer implementing continuous position tracking with DLS.

Runs a periodic IK solve loop, continuously solving for updated targets and sending actuator commands. Useful for following moving targets or real-time position control from external sources.

Usage

# Start tracking
{:ok, pid} = BB.IK.DLS.Tracker.start_link(
  robot: MyRobot,
  target_link: :gripper,
  initial_target: {0.3, 0.2, 0.1},
  update_rate: 30
)

# Update target from vision callback
BB.IK.DLS.Tracker.update_target(pid, {0.35, 0.25, 0.15})

# Check status
%{residual: 0.001, tracking: true} = BB.IK.DLS.Tracker.status(pid)

# Stop and get final positions
{:ok, positions} = BB.IK.DLS.Tracker.stop(pid)

Options

  • :robot - Robot module (required)
  • :target_link - Link to track (required)
  • :initial_target - Starting target position (required)
  • :update_rate - Solve frequency in Hz (default: 20)
  • :delivery - Actuator command delivery: :direct (default), :pubsub, :sync
  • :max_iterations - Maximum DLS iterations per update (default: 100)
  • :tolerance - Convergence tolerance in metres (default: 1.0e-4)
  • :lambda - Damping factor (default: 0.5)
  • :adaptive_damping - Adapt lambda based on error (default: true)
  • :step_size - Max joint update per iteration (default: 0.1)
  • :respect_limits - Whether to clamp to joint limits (default: true)
  • :name - Optional GenServer name for registration

Notes

  • Uses :direct delivery by default for low latency
  • Continues tracking even if individual solves fail (best-effort)
  • Call stop/1 to cleanly terminate tracking

Summary

Functions

Returns a specification to start this module under a supervisor.

Start a tracker process.

Get current tracking status.

Stop tracking and return final positions.

Update the current target position.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

Start a tracker process.

See module documentation for options.

status(tracker)

Get current tracking status.

stop(tracker, opts \\ [])

Stop tracking and return final positions.

Options

  • :hold - Send hold commands to actuators (default: false)

update_target(tracker, target)

Update the current target position.