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

Fix Conversions for TalonFX getVelocity() and omegaRadPerSecond #12

Merged

Conversation

7910f6ba7ee4
Copy link
Contributor

  • Fix conversions for TalonFX getVelocity. Since velocity is in units/100ms, we multiply the raw units by 10 before applying the positionConversionFactor (which is in units meters/unit or degrees/unit).
  • Fix conversions for omega since angleMotor.getVelocity() returns in deg/s, but we want rad/s

Copy link
Contributor

@thenetworkgrinch thenetworkgrinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omega units are in degrees per second after the conversion factor. I am not sure how it would react to rad/s. This would need to be tested.

@7910f6ba7ee4
Copy link
Contributor Author

We're using omega only as a local variable for returning a new SwerveModuleState2 though right? Doesn't SwerveModuleState2 need rad/s for the omegaRadPerSecond parameter, so we need to convert (only within the local getState() method) to rad/s from deg/s?

Should def be tested on a robot though, which I'll do Thursday, since I'm not sure why there weren't issues before.

@thenetworkgrinch
Copy link
Contributor

thenetworkgrinch commented Feb 15, 2023

It is supposed to be, but i treat it as deg/s with SparkMax's as 95 did in their code (which was wrong).

You are right it appears to be treated as radian per second elsewhere in the code.

Copy link
Contributor

@thenetworkgrinch thenetworkgrinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Among closer inspection this is correct.

@thenetworkgrinch thenetworkgrinch merged commit 5d9e86f into BroncBotz3481:main Feb 15, 2023
@7910f6ba7ee4 7910f6ba7ee4 deleted the patch-conversions-fix branch February 17, 2023 03:41
thenetworkgrinch pushed a commit that referenced this pull request Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants