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>
Description
SaltyLab self-balancing bot firmware (STM32F722)
Languages
Python
67.1%
C
11.4%
JavaScript
9.2%
OpenSCAD
7.8%
HTML
1.5%
Other
2.9%