feat(controls): Smooth acceleration rate limiter (Issue #241) #246

Merged
sl-jetson merged 1 commits from sl-controls/issue-241-smooth-accel into main 2026-03-02 12:46:22 -05:00
Collaborator

Summary

Implement rate-limiting for velocity commands to prevent jerky motion.

Features:

  • Smooth acceleration/deceleration rate limiting
  • Configurable limits: 0.5 m/s² linear, 1.0 rad/s² angular (default)
  • Independent limiting for each velocity component (x, y, z linear; x, y, z angular)
  • Prevents sudden velocity changes protecting mechanical systems

Algorithm

  1. Subscribe to /cmd_vel (target velocity)
  2. For each velocity component:
    • Change = target - current
    • Max allowed change = accel_limit × period
    • Clamp(change, -max_change, +max_change)
  3. Publish smoothed velocity to /cmd_vel_smooth

Benefits

Prevents jerky motion from sudden jumps
Protects mechanical systems from shock loads
Enables smooth speed/direction changes
Smooth tracking of dynamic targets (drones, moving objects)

Rate Limiting Examples

At 50Hz (20ms period):

  • Linear limit 0.5 m/s² → max Δv = 0.01 m/s per cycle
  • Angular limit 1.0 rad/s² → max Δω = 0.02 rad/s per cycle

Test Coverage

30+ unit tests:

  • Node initialization and parameters
  • Individual component limiting (linear, angular)
  • Acceleration and deceleration scenarios
  • Multi-component simultaneous limiting
  • Reaching target velocity gradually
  • Emergency stops and direction changes
  • Independent linear vs angular limits
  • Realistic scenarios (gradual accel, smooth stops, turns, obstacle avoidance, oscillations)

Topics

  • Subscribed: /cmd_vel (geometry_msgs/Twist)
  • Published: /cmd_vel_smooth (geometry_msgs/Twist)

Closes Issue #241.

## Summary Implement rate-limiting for velocity commands to prevent jerky motion. **Features:** - Smooth acceleration/deceleration rate limiting - Configurable limits: 0.5 m/s² linear, 1.0 rad/s² angular (default) - Independent limiting for each velocity component (x, y, z linear; x, y, z angular) - Prevents sudden velocity changes protecting mechanical systems ## Algorithm 1. Subscribe to `/cmd_vel` (target velocity) 2. For each velocity component: - Change = target - current - Max allowed change = accel_limit × period - Clamp(change, -max_change, +max_change) 3. Publish smoothed velocity to `/cmd_vel_smooth` ## Benefits ✅ Prevents jerky motion from sudden jumps ✅ Protects mechanical systems from shock loads ✅ Enables smooth speed/direction changes ✅ Smooth tracking of dynamic targets (drones, moving objects) ## Rate Limiting Examples **At 50Hz (20ms period):** - Linear limit 0.5 m/s² → max Δv = 0.01 m/s per cycle - Angular limit 1.0 rad/s² → max Δω = 0.02 rad/s per cycle ## Test Coverage ✅ 30+ unit tests: - Node initialization and parameters - Individual component limiting (linear, angular) - Acceleration and deceleration scenarios - Multi-component simultaneous limiting - Reaching target velocity gradually - Emergency stops and direction changes - Independent linear vs angular limits - Realistic scenarios (gradual accel, smooth stops, turns, obstacle avoidance, oscillations) ## Topics - **Subscribed:** `/cmd_vel` (geometry_msgs/Twist) - **Published:** `/cmd_vel_smooth` (geometry_msgs/Twist) Closes Issue #241.
sl-controls added 1 commit 2026-03-02 12:23:17 -05:00
Implement rate-limiting for velocity commands to prevent jerky motion.
Applies independent acceleration/deceleration limits to linear and angular velocity.

Features:
- Smooth acceleration/deceleration rate limiting
  Default: 0.5 m/s² linear, 1.0 rad/s² angular (configurable)
- Independent limits for each velocity component (x, y, z linear; x, y, z angular)
- Calculates maximum change per control cycle: limit * dt
- Clamps velocity changes to stay within acceleration envelope
- 50Hz control frequency with configurable parameters

Algorithm:
- Subscribe to /cmd_vel (target velocity)
- For each component: change = target - current
- Clamp change: |change| ≤ accel_limit * period
- Apply clamped change to current velocity
- Publish smoothed /cmd_vel_smooth

Benefits:
- Prevents jerky motion from sudden velocity jumps
- Protects mechanical systems from shock loads
- Enables gradual speed/direction changes
- Smooth tracking of dynamic targets

Test Coverage:
- 30+ unit tests covering:
  - Node initialization and parameter configuration
  - Individual component rate limiting (linear, angular)
  - Acceleration and deceleration scenarios
  - Multi-component simultaneous limiting
  - Reaching target velocity after multiple cycles
  - Emergency stops and rapid direction changes
  - Independent linear vs angular limits
  - Realistic scenarios: gradual acceleration, smooth stops, turns while moving,
    obstacle avoidance, continuous motion tracking, oscillating targets

Topics:
- Subscribed: /cmd_vel (geometry_msgs/Twist)
- Published: /cmd_vel_smooth (geometry_msgs/Twist)

Config: frequency=50Hz, linear_accel_limit=0.5 m/s², angular_accel_limit=1.0 rad/s²

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
sl-jetson merged commit 3c276b0bce into main 2026-03-02 12:46:22 -05:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seb/saltylab-firmware#246
No description provided.