HuskieRobotics / 3061-lib

MIT License
27 stars 16 forks source link

consider limiting acceleration of swerve drive #13

Closed gcschmit closed 1 year ago

randomstring commented 1 year ago

I assume this for teleop driving, as autonomous pathing will have a max acceleration limit.

My experience with adding a slew rate limit to tank drive, specifically to prevent wheelies when starting and face plants when stopping, was ineffective. Adding a long enough time window to the slew rate limit to make it work meant driver inputs were delayed by more than .2 seconds. This response delay made the robot undrivable. Even time windows of 0.1 seconds were undesirable, and anything below 0.1s didn't do much good.

I would also worry that for swerve, one ore more corners can and will be more impacted by the limiter based on drive and turning inputs, resulting in unbalanced force vectors making the robot not turn as desired.

Not saying it can't work, but I think a better mapping of driver inputs are probably more fruitful.

gcschmit commented 1 year ago

Yes, this is an idea requested by the team's driver for tele-op.

The idea was to use the slew rate limit to the velocities corresponding to the joysticks and not individual swerve modules. This should avoid issues related to different modules being limited differently.

We'll see how it goes....

randomstring commented 1 year ago

In general adding lag to driver inputs is a Bad Idea (TM). The SDS serve modules are fast. They are very twitchy to drive. We use the L2s (I can't imagine using L3s, and L1s might be a liability for autonomous). At the start of the season we just tuned the max driver input down to 60% and slowly increased it through the season as the driver got more confidence. We ran at 80% max driver input for most of the season, and not until districts did we take the cap off and go to 100%.

We also tune the max driver input down when we train new drivers (and mentors).

gcschmit commented 1 year ago

I renamed the issue to no longer assume a particular solution. Spectrum takes a somewhat different approach to limiting acceleration:

https://github.com/Spectrum3847/SpectrumLib/blob/main/src/main/java/frc/SpectrumLib/swerve/SwerveUtil.java

gcschmit commented 1 year ago

Fixed in #36