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>
22 lines
667 B
XML
22 lines
667 B
XML
<?xml version="1.0"?>
|
|
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
|
<package format="3">
|
|
<name>saltybot_accel_limiter</name>
|
|
<version>0.1.0</version>
|
|
<description>Smooth acceleration and deceleration limiter for velocity commands.</description>
|
|
<maintainer email="seb@vayrette.com">Seb</maintainer>
|
|
<license>Apache-2.0</license>
|
|
|
|
<buildtool_depend>ament_python</buildtool_depend>
|
|
|
|
<depend>rclpy</depend>
|
|
<depend>geometry_msgs</depend>
|
|
<depend>std_msgs</depend>
|
|
|
|
<test_depend>pytest</test_depend>
|
|
|
|
<export>
|
|
<build_type>ament_python</build_type>
|
|
</export>
|
|
</package>
|