sl-controls created pull request seb/saltylab-firmware#246

sl-controls
Mon, 02 Mar 2026 12:23:17 -0500

246#feat(controls): Smooth acceleration rate limiter (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.