DevilBotz2876 / ChargedUp2023

Code for the FRC 2023 Robotics Competition
Other
3 stars 0 forks source link

Improved dock and engage #133

Closed BrownGenius closed 1 year ago

BrownGenius commented 1 year ago

Hi Team,

At WPI, unfortunately, the bumpers were still too low to properly test the Dock & Engage routine. However, as a work around, we manually lowered the ramp so that we could at least test the autonomous routine. What we found is that, once on the ramp, the robot didn't seem to have enough power to drive up the ramp, and basically got stuck.

After digging into it further, I realized that the DriveStraightToDock command should not be using the DriveStraightPID. The DriveStraightPID tries to aim for a specific distance as well as keep the heading steady. However, for the DriveStraightToDock routine, we don't care about the distance, so the distance PID + slew limiter was preventing the robot from hitting the required velocity to climb the ramp.

In the interest of time, I decoupled DriveStraightToDock from DriveStraightPID. DriveStraightToDock now drives the robot at a fixed velocity, depending on the state it is in:

E.g.:

This code is untested, so, if we have time, we need to test/tweak these parameters to make sure they work on the competition bot.

Resolves #132

BrownGenius commented 1 year ago

Interestingly enough, I was browsing chiefdelphi and ran across this post: https://www.chiefdelphi.com/t/psa-balance-in-auto/429778

They have an autoBalance routine that is freely available to use, and it seems to have basically the same logic that we have now...albeit a little simpler: https://github.com/FRC3683/OpenAutoBalance/blob/main/java/autoBalance.java

So, I think we are on the right track...(or both are on the wrong track!).

BrownGenius commented 1 year ago

This was tested on 2023-03-13 on both the practice and competition bot. It works flawlessly on the practice bot, but the competition bot is still unstable. It seems the competition bot is top heavy so very unstable when the charge station tilts in the other direction. It should be "good enough" and hopefully we'll have time to test it on Friday evening in Reading on a real charge station and fixed bumpers.