Skip to content

Conversation

@jimsynz
Copy link
Contributor

@jimsynz jimsynz commented Dec 12, 2025

Summary

Adds BB.Message.Actuator.EndMotion - a message that actuators can optionally publish when motion ends. This complements BeginMotion and is useful for actuators with partial feedback (limit switches, stall detection) that can report completion but may not have continuous position sensing.

Fields

  • position (float, required) - position when motion ended (radians or metres)
  • reason (atom, required) - why motion ended:
    • :completed - motion reached target normally
    • :cancelled - motion was interrupted
    • :limit_reached - hit a limit switch or software limit
    • :fault - error condition (stall, overcurrent, etc.)
  • detail (atom, optional) - additional context (e.g. :end_stop, :software, :stall)
  • message (string, optional) - human-readable information for operators

Example Usage

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

# Simple completion
Message.new!(EndMotion, :shoulder, position: 1.57, reason: :completed)

# Limit reached with detail
Message.new!(EndMotion, :shoulder,
  position: 0.0,
  reason: :limit_reached,
  detail: :end_stop
)

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

Test plan

  • Tests for message creation with required fields only
  • Tests for optional detail field
  • Tests for optional message field
  • Tests for required field validation
  • Tests for reason enum validation
  • All 457 tests pass
  • mix check --no-retry passes

A message that actuators can optionally publish when motion ends.
Complements `BeginMotion` and is useful for actuators with partial
feedback (limit switches, stall detection) that can report completion
but may not have continuous position sensing.

Fields:
- `position` (float, required) - position when motion ended
- `reason` (atom, required) - :completed, :cancelled, :limit_reached, :fault
- `detail` (atom, optional) - additional context (e.g. :end_stop, :stall)
- `message` (string, optional) - human-readable info for operators
@jimsynz jimsynz merged commit 3fcee81 into main Dec 12, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants