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

Sparkmax Failover will never happen #99

Open
TrialNTerror opened this issue Nov 29, 2023 · 11 comments
Open

Sparkmax Failover will never happen #99

TrialNTerror opened this issue Nov 29, 2023 · 11 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@TrialNTerror
Copy link

The getRelativeEncoderPosition method will always return the absolute encoder position as they are not separate in SparkmaxSwerve.java. Additionally absoluteEncoder will never equal null to swap over to the relative encoder.

So it wont fail over. And the Dashboard says they are always identical regardless if both work or not.
image

@TrialNTerror
Copy link
Author

Actually apologies. I think absoluteEncoder could be null, but only if it wasn't connected originally.

@thenetworkgrinch
Copy link
Contributor

If the SparkMax has an absolute encoder attached to it, then it will return the value of the absolute encoder attached to it. However I do not remember if i made any checks to see if this fails. You may be correct.

@thenetworkgrinch
Copy link
Contributor

Currently with REV's API I do not know if there was an error raised because none is returned from the call. The closest I can get to it is SensorError which does not explicitly state any error message I can rely on.

@thenetworkgrinch thenetworkgrinch transferred this issue from BroncBotz3481/YAGSL Nov 29, 2023
@thenetworkgrinch thenetworkgrinch added bug Something isn't working wontfix This will not be worked on labels Nov 29, 2023
@TrialNTerror
Copy link
Author

The absolute encoder value wont change if it comes unplugged. Would that be something that could be used?

@thenetworkgrinch
Copy link
Contributor

I will not fix this until REV has an API in which I can utilize specifically to fix it. If this sits here by end of december and I am reminded of it I will implement a "hacky" fix.

@TrialNTerror
Copy link
Author

Ok Darn thank you

@TrialNTerror
Copy link
Author

Could you please tell me where in YAGSL does it make the change to the relative encoder, because seemingly no matter what I do it wont swap to the relative encoder?

@thenetworkgrinch
Copy link
Contributor

There should be no reason to get the relative encoder value since it is not used in a SparkMAX with attached absolute encoder. Here is the snippet that ensures that.

https://github.com/BroncBotz3481/YAGSL-Example/blob/main/src/main/java/swervelib/motors/SparkMaxSwerve.java#L189

@Technologyman00
Copy link
Collaborator

What if it was used for failover? I feel like that is the main reason.

@thenetworkgrinch
Copy link
Contributor

It shouldnt be, since in theory the encoder is attached to the SparkMAX correctly and the response time is minimal + no magnets to worry about (unless using canandcoder). implementing a fail over would require resetting the feedback encoder to the relative encoder mid-operation which i have never seen in code before and have no idea if that may trigger some undefined behavior from REVLib.

@Technologyman00
Copy link
Collaborator

https://github.com/Trial-N-Terror-FRC-7900/YAGSL-Max-Swerve-Example/tree/SparkMaxFailover I have made some code that should work for failing over on the sparkmaxes. We will have to test it, but it is based on that we have noticed that the encoder value freezes after lost connection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants