Quadruped-PyMPC
Quadruped-PyMPC copied to clipboard
Fix touchdown detection logic in SwingTrajectoryController
The check_touch_down_condition() method in SwingTrajectoryController had incorrect logic that detected lift-off events instead of touchdown events. This caused step frequency optimization to fail with slow gaits, particularly crawl patterns at 0.5 Hz step frequency.
Implemented a robust three-stage touchdown detection algorithm:
- Fixed core logic to detect touchdown instead of lift-off
- Added proper state management with automatic reset
- Implemented stability delay to prevent premature optimization triggers
This fix enables proper step frequency optimization for crawl gaits and improves the reliability of gait adaptation across all locomotion patterns.
Thanks Amlan. I'm planning to review this PR this week.