Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Center of Mass adjustment for Swerve Drive #65

Open
sorenfnt opened this issue Feb 24, 2023 · 0 comments
Open

Feature: Center of Mass adjustment for Swerve Drive #65

sorenfnt opened this issue Feb 24, 2023 · 0 comments

Comments

@sorenfnt
Copy link
Contributor

Get the swerve drive to work with variable center of mass.

The implementation should involve storing the relative positions and distances of each module (by the module's center of rotation) to be passed in during the instantiation of the swerve drive class. The outputs of the swerve math should then be normed so that the drive speed of each module is inversely proportional to it's lever arm (distance to CoM).

The easiest way to do this may be to re-write all of the math, using either the WPILib swerve kinematics, or the general mathematical model for swerve (see https://dominik.win/blog/programming-swerve-drive/ )

Otherwise, assuming the current math works for a square bot, it may work to just scale the drive outputs by 1/(distance from CoM), after norming all of these distances to their average (so that a module which is the average distance away out of the 4 modules is multiplied by 1, those that are closer than average are scaled up, and those that are further than average are scaled down)... this is easier but may be less accurate.

Acceptance Test:
The rectangular bot with offset CoM drives well without any significant drift (after any error in measurement has been eliminated)

Preconditions: Square swerve drive is functioning. All swerve modules behave predictably and the gyroscope is calibrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant