Skip to content

Conversation

@jimsynz
Copy link
Contributor

@jimsynz jimsynz commented Dec 13, 2025

Summary

Introduces a standardised interface for sending commands to actuators, supporting both pubsub delivery (for orchestration, logging, replay) and direct GenServer delivery (for time-critical control).

Command Message Types

Command Description
Position Target position with optional velocity/duration hints
Velocity Target velocity with optional duration
Effort Target torque/force with optional duration
Trajectory Waypoints with position/velocity/acceleration/time
Stop Cease motion (:immediate or :decelerate)
Hold Actively maintain current position

Delivery Module (BB.Actuator)

Three delivery methods for each command type:

  • Pubsub (set_position/4, etc.) - For orchestration, enables logging and replay
  • Direct cast (set_position!/4, etc.) - Fire-and-forget, lower latency
  • Synchronous (set_position_sync/5, etc.) - Returns acknowledgement or error

Enhanced Motion Messages

  • BeginMotion - Added command_id and command_type for correlation
  • EndMotion - Added command_id for correlation

Example Usage

# Pubsub delivery (kinematics/orchestration)
BB.Actuator.set_position(MyRobot, [:base_link, :shoulder, :servo], 1.57)

# Direct delivery (time-critical control)
BB.Actuator.set_position!(MyRobot, :shoulder_servo, 1.57)

# Synchronous with acknowledgement
{:ok, :accepted} = BB.Actuator.set_position_sync(MyRobot, :shoulder_servo, 1.57)

# Trajectory
waypoints = [
  [position: 0.0, velocity: 0.0, acceleration: 0.5, time_from_start: 0],
  [position: 0.5, velocity: 0.3, acceleration: 0.0, time_from_start: 200],
  [position: 1.0, velocity: 0.0, acceleration: -0.5, time_from_start: 400]
]
BB.Actuator.follow_trajectory(MyRobot, [:shoulder, :servo], waypoints)

Test plan

  • All command message types compile and validate correctly
  • BB.Actuator delivery module compiles
  • Enhanced BeginMotion/EndMotion backward compatible
  • All 457 tests pass
  • mix check --no-retry passes

Introduces a standardised interface for sending commands to actuators,
supporting both pubsub delivery (for orchestration/logging/replay) and
direct GenServer delivery (for time-critical control).

Command message types:
- Position - target position with optional velocity/duration hints
- Velocity - target velocity with optional duration
- Effort - target torque/force with optional duration
- Trajectory - waypoints with position/velocity/acceleration/time
- Stop - cease motion (immediate or decelerate)
- Hold - actively maintain current position

Delivery module (BB.Actuator):
- Pubsub: set_position/4, set_velocity/4, etc.
- Direct cast: set_position!/4, etc.
- Synchronous: set_position_sync/5, etc.

Enhanced BeginMotion/EndMotion with command_id for correlation.
@jimsynz jimsynz force-pushed the feature/actuator-command-interface branch from 1440e7e to 1a13405 Compare December 13, 2025 07:25
@jimsynz jimsynz merged commit 95011ae into main Dec 13, 2025
14 checks passed
@jimsynz jimsynz deleted the feature/actuator-command-interface branch December 13, 2025 07:40
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