Adds a rate-limiting shim between raw /cmd_vel and the drive stack to prevent wheel slip, tipping, and jerky motion from step velocity inputs. Core library — _velocity_ramp.py (pure Python, no ROS2 deps) - VelocityRamp: applies independent accel/decel limits to linear-x and angular-z with configurable max_lin_accel, max_lin_decel, max_ang_accel, max_ang_decel - _ramp_axis(): per-axis rate limiter with correct accel/decel selection (decel when |target| < |current| or sign reversal; accel otherwise) - Emergency stop: step(0.0, 0.0) bypasses ramp → immediate zero output - Asymmetric limits supported (e.g. faster decel than accel) ROS2 node — velocity_ramp_node.py - Subscribes /cmd_vel, publishes /cmd_vel_smooth at configurable rate_hz - Parameters: max_lin_accel (0.5 m/s²), max_lin_decel (0.5 m/s²), max_ang_accel (1.0 rad/s²), max_ang_decel (1.0 rad/s²), rate_hz (50) Tests — test/test_velocity_ramp.py: 50/50 passing - _ramp_axis: accel/decel selection, sign reversal, overshoot prevention - Construction: invalid params raise ValueError, defaults verified - Linear/angular ramp-up: step size, target reached, no overshoot - Deceleration: asymmetric limits, partial decel (non-zero target) - Emergency stop: immediate zero, state cleared, resume from zero - Sign reversal: passes through zero without jumping - Reset: state cleared, next ramp starts from zero - Monotonicity: linear and angular outputs are monotone toward target - Rate accuracy: 50Hz/10Hz step sizes, 100-step convergence verified Co-Authored-By: Claude Sonnet 4.6 <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%