How openflex-wheeled-humanoid/motion_control_layer works
This ROS 2 control package turns chassis Twist commands into four swerve-module steering and wheel commands, while estimating and publishing wheel-based odometry. The main runtime controller receives commands and joint feedback, applies kinematics and steering/speed constraints, and publishes odometry, optional TF, and debug state. The source excerpts show inverse-kinematics and wheel-speed limiting; odometry’s forward-kinematics integration is explicit in its implementation, but the controller’s call into odometry and several slowdown details are not shown, so those links are marked unverified. Navigation, SLAM, and hardware protocols are outside this package.
Main entry points: swerve_drive_controller.cpp Swerve Controller · swerve_drive_kinematics.cpp Swerve Kinematics · swerve_drive_odometry.cpp Wheel Odometry
Components 8
Controller Runtime
- Swerve Controller
swerve_controller/src/swerve_drive_controller.cpp
Motion Algorithms
- Swerve Kinematics
swerve_controller/src/swerve_drive_kinematics.cpp - Wheel Odometry
swerve_controller/src/swerve_drive_odometry.cpp
Published Results
- Joint Commands
- Odometry and TF
- Debug States
Other components
- Velocity Source
- Joint Feedback
Connections 9
- Velocity Source → Swerve Controller: sends Twist
README.md - Joint Feedback → Swerve Controller: provides feedback
swerve_controller/src/swerve_drive_controller.cpp - Swerve Controller → Swerve Kinematics: computes module states
swerve_controller/src/swerve_drive_controller.cpp - Swerve Kinematics → Swerve Controller: returns states
swerve_controller/src/swerve_drive_controller.cpp - Swerve Controller → Joint Commands: writes commands
README.md - Swerve Controller → Wheel Odometry: updates estimate
- Wheel Odometry → Swerve Kinematics: computes chassis speed
swerve_controller/src/swerve_drive_odometry.cpp - Swerve Controller → Odometry and TF: publishes odometry and TF
README.md - Swerve Controller → Debug States: publishes debug state
README.md