Skip to content

Add SwerveDrive system plugin#3365

Draft
C88-YQ wants to merge 11 commits intogazebosim:mainfrom
C88-YQ:feature/swerve_drive
Draft

Add SwerveDrive system plugin#3365
C88-YQ wants to merge 11 commits intogazebosim:mainfrom
C88-YQ:feature/swerve_drive

Conversation

@C88-YQ
Copy link

@C88-YQ C88-YQ commented Mar 3, 2026

🎉 New feature

Closes #3364
Related to gazebosim/gz-math#718

Summary

This PR introduces a new SwerveDrive system plugin to gz-sim, providing support for four-wheel independent steering (swerve / 4WISD) kinematics.

The new system:

  • Supports four independently steerable wheels
  • Computes steering angles and wheel velocities from cmd_vel input
  • Publishes odometry based on wheel states
  • Follows the architectural pattern of existing drive systems such as DiffDrive and MecanumDrive
  • Includes integration tests and an example world file

Kinematic and odometry computation are handled by the SwerveDriveOdometry utility introduced in gz-math (gazebosim/gz-math#718).

This implementation does not modify existing drive systems and is fully backward compatible.

Test it

  1. Make sure the corresponding gz-math PR has been merged (or build against a local branch containing SwerveDriveOdometry).
  2. Build gz-sim
  3. Run tests:
    ctest --output-on-failure
  4. Manually test using the example world:
    gz sim swerve_drive.sdf
  5. Publish velocity commands:
    gz topic -t "/model/vehicle_blue/cmd_vel" -m gz.msgs.Twist -p "linear: {y: 0.5}, angular: {z: 0.2}"

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the feature
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • Updated Bazel files (if adding new files). Created an issue otherwise.
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)
swerve_drive.mp4
steering_motion.mp4

@github-actions github-actions bot added the 🪵 jetty Gazebo Jetty label Mar 3, 2026
@C88-YQ
Copy link
Author

C88-YQ commented Mar 3, 2026

This PR currently depends on the new SwerveDriveOdometry utility proposed in gz-math PR gazebosim/gz-math#718

Should I temporarily disable or stub the odometry part in gz-sim until the math PR is merged to keep CI fully independent?

@arjo129 arjo129 added the needs upstream release Blocked by a release of an upstream library label Mar 4, 2026
@arjo129
Copy link
Contributor

arjo129 commented Mar 4, 2026

Thank you for your contribution. It is indeed a useful one. Can we consider targetting main instead of gz-sim10. Ive reviewed your gz-math pr. Its a great first attempt theres so\me minor issues with angle wrapping.

@strangerwhoisharborofdoom

Great work on implementing the SwerveDrive plugin! This looks like a valuable addition to gz-sim's drive system plugins.

A few suggestions:

  1. Documentation: The "Updated documentation" checkbox is unchecked. Do you plan to add docs for SwerveDrive similar to DiffDrive/MecanumDrive?

  2. Testing: Consider adding edge case tests for zero velocity commands and maximum steering angles.

  3. Example World: Consider adding comments in the .sdf file explaining key parameters for users.

The implementation follows existing drive system patterns well. Looking forward to seeing this merged!

C88-YQ added 10 commits March 5, 2026 14:41
Signed-off-by: C88-YQ <1409947012@qq.com>
Signed-off-by: C88-YQ <1409947012@qq.com>
Signed-off-by: C88-YQ <1409947012@qq.com>
Signed-off-by: C88-YQ <1409947012@qq.com>
Signed-off-by: C88-YQ <1409947012@qq.com>
Signed-off-by: C88-YQ <1409947012@qq.com>
Signed-off-by: C88-YQ <1409947012@qq.com>
Signed-off-by: C88-YQ <1409947012@qq.com>
Signed-off-by: C88-YQ <1409947012@qq.com>
@C88-YQ C88-YQ force-pushed the feature/swerve_drive branch from 1a17a77 to 8685e84 Compare March 5, 2026 06:42
@C88-YQ C88-YQ changed the base branch from gz-sim10 to main March 5, 2026 06:42
Signed-off-by: C88-YQ <1409947012@qq.com>
@C88-YQ C88-YQ force-pushed the feature/swerve_drive branch from e8f1391 to a2db4b0 Compare March 5, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪵 jetty Gazebo Jetty needs upstream release Blocked by a release of an upstream library

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

Feature Request: Add SwerveDrive system plugin

3 participants