Whenever we enable Swerve Modules they rotate to a diffrent positions. We tried to subtract the encoders home and starting positions. We asume that this is due to angle offset. But we are not 100% sure.
We have Cancoders, Neo, Navx gyro, 25 inch by 25 inch chassis
Have you tried to configure the angle offsets? Just take the module number, check your dashboard for the CANCoder value and change the offset accordingly in Constants.java.
We tried that, but the value seems to change every time we start up the robot. Also can you explain the difference between integrated value and the regular value.
Did you loctite the magnets into place?
Do you mean integer? Also try setting all of the CANcoder offsets to zero then try again.
I ment this. We also tried to se the offset to 0, but the value kept going to 0.9, and the the wheel alignment was off.
Yes, I’m pretty sure but I can check again.
The issue is the getCanCoder()
returns a value from the Neo and not the CANcoder. That means the offset is always applied to the value you are seeing in the dashboard. Either edit the function or set the offsets to zero and try again
Also don’t have access to the docs. email: [email protected]
Yea I just posted a screen shot of what i ment also i will look into the getCanCoder() . Thanks for helping
The code is bad so same thing as cancoder. Intigrates mean intigrates encoder.
ok thanks
Sorry looking on mobile I could not see types. If so the code looked correct. You can take a look at GitHub - Team7520/UltimateSwerveBase: Custom Fork Of UltimateSwerveBase With NavX + CANCoder + Neo/SparkMax Support or its parent repository.
Ok thanks
Ok so I had a similar problem and my problem was that the encoders should be inverted and when you invert them, the offset has to be set as (2* Math.PI - angleOffSET) in case you are using radians, but for a more clear debug you should follow these steps:
- Send the absolute and relative position to you shuffleboard so you can see if they match.
- If they match, then you should open a new Timed Skeleton Advance project and just create the motor, the encoder and put the value of the absolute and relative encoder and see if when you turn manually the motor, both of the values are going to the same direction (meaning that they are increasing or deacrising equally)
- If they don’t increase equally (one increases and the other one decreases) it means that one of the encoders is wrongly inverted, so you should invert it and check again
My guess is that your problem kinf of goes in this way, but if this isn’t the problem, let me know and we can chat over dm in discord and I can give you a more adequate help.
Good Luck
Ok yea I think thart might be the problem also it might be that our team was not zeroing the encoders corectly so i will try both.
So we tried that but it still did not work. We think the issue might be that we need the resetmoduleToAbsolute function but we can not figure out how to code that.
nvm we got it