BB.Message.Actuator.EndMotion (bb v0.15.0)

View Source

Message published by actuators when motion ends.

Optional counterpart to BeginMotion. Useful for actuators with partial feedback (limit switches, stall detection) that can report when motion completes but may not have continuous position sensing.

Fields

  • position - Position when motion ended (radians or metres)
  • reason - Why motion ended (:completed, :cancelled, :limit_reached, :fault)
  • detail - Optional atom with additional context (e.g. :end_stop, :stall)
  • message - Optional human-readable information for operators
  • command_id - Optional correlation ID from the originating command

Examples

alias BB.Message
alias BB.Message.Actuator.EndMotion

# Simple completion
{:ok, msg} = Message.new(EndMotion, :shoulder,
  position: 1.57,
  reason: :completed
)

# Limit reached with detail
{:ok, msg} = Message.new(EndMotion, :shoulder,
  position: 0.0,
  reason: :limit_reached,
  detail: :end_stop
)

# Fault with message
{:ok, msg} = Message.new(EndMotion, :shoulder,
  position: 0.52,
  reason: :fault,
  detail: :stall,
  message: "Motor stall detected at 30% travel"
)

Summary

Types

reason()

@type reason() :: :completed | :cancelled | :limit_reached | :fault

t()

@type t() :: %BB.Message.Actuator.EndMotion{
  command_id: reference() | nil,
  detail: atom() | nil,
  message: String.t() | nil,
  position: float(),
  reason: reason()
}

Functions

new(frame_id, attrs)

@spec new(
  atom(),
  keyword()
) :: {:ok, BB.Message.t()} | {:error, term()}