BroncBotz3481 / YAGSL-Example

Yet Another General Swerve Library Example Project
Apache License 2.0
58 stars 130 forks source link

Issue in calcMaxAccel? #218

Open scarmain opened 1 month ago

scarmain commented 1 month ago

I was looking over the calculations in SwerveMath.calcMaxAccel(), and I think there might be a problem in the logic. When you check the reference wheel based on the angle, not all the wheels are selected, the front left is used twice, and back right is never used. Is this the intended functionality? (The math is a little over my head what the proper fix could be)

https://github.com/BroncBotz3481/YAGSL/blob/89e41639515e64865a23ff8c33107c1e00807e45/swervelib/math/SwerveMath.java#L214

(note, moved from https://github.com/BroncBotz3481/YAGSL/issues/67 , although I find it weird this is not an example issue and instead a "core" problem)

scarmain commented 1 month ago

From @thenetworkgrinch

This is indeed intended functionality. However it is not the right functionality. I implemented this with square and rectangular robots in mind. If anyone uses a triangular robot this may suddenly become a problem (but might not if front left is the center module).

On the flipside if anyone who wants to use YAGSL with a triangular chassis, I will probably fix this the same day.

scarmain commented 1 month ago

I just want to add, I know of several "unique" robots that would break this theory, 2481's 5 wheel swerve in 2022, and 9312's TurdSwerve that uses 2 powered swerve wheels to drive. (that robot you could probably put in a second configuration with 2 fake wheels to simulate the chassis easily)

EDIT: Just remembered 5 powered wheeled robots are probably a thing of the past with the 4 propulsion motor limit.