My team struggled with autonomous this year. We’d be able to get short, low-scoring paths executed somewhat reliably, but if we tried to do better than that it would cause the robot to drift, rotate, and subsequently collide with field elements.
We use a mk4i swerve drivebase with PathPlanner. I feel like the issue may lie within our X/Y/Theta controllers, but idk. Any help would be appreciated.
We were having issues with wildly inconsistent autos during practice and competitions, and we found that making the switch to Colson swerve wheels on our mk4i modules made a world of difference. As the tread would wear (we simply do not have the money to change swerve tread after every 3-4 matches), the wheels would slip slightly throwing our paths off. Making the switch to Colson wheels increased both our overall speed and consistency in auto.
#1: check your current limits and acceleration to avoid wheel slippage #2: confirm your basics: does a 10 foot drive forward command ACTUALLY take you 10 feet? Test 10 times, average, update… #3: confirm that your rotation commands actually rotate the right amount. Program a 10 turn slow spin and measure your error. Look at your gyro data! #4: take some data and see if your errors are consistent (ie, do the same routine 10 times and plot your final position). You will want some simple routines to facilitate this data taking. Using cones to mark the bounds of your path will help too.
I can’t agree with these enough. Jumping into an autonomous routine is something that needs to be slow and careful.
We spent a lot of time this year running basic movements and understanding how the swerve behaves before even starting to do perform motions of our actual paths.
Next thing is to break up your auto into small bites. Repeat one spot over and over until you’re happy with it, then move into the next leg. It’s all about repetition and making sure things stay consistent.
Naturally if you can do things like implementing vision feedback that helps leaps and bounds, but it’s not always necessary for a robust auton path.
We were thinking about doing something like this. Maybe something like using apriltag pose estimation to update our odometry. That, coupled with @Weldingrod1’s careful testing methods will probably get our auton to a reliable state eventually. Thank you both
However, I feel that quite a few of our difficulties in auton reliability come from our pid loops which we pass into our PPSwerveControllerCommand. If any of you guys use similar control methods I’d love to hear how you go about finding gain values for your auton loops.
Connect the PathPlanner UI and see where your robot thinks it is. (The way to do this varies between 2023 PP and 2024 beta PP)
See if your robot is where it thinks it is. Depending on the problem, you may see the robot follow the planned path, or you may see it deviate without being able to correct. This will help you narrow down the problem.
Could you share which Colsons you used? I wonder if there is a Colson solution for the Rev modules (I know those wheels are smaller) Also, how often did you need to replace them?
The wheels we used we actually got from the silent auction at IRI, but they’re the ones from buyswervewheels.com. So far they’re perfectly fine after three offseason events. I don’t know if any options are available for maxswerve or not.
One of the fundamentals is understanding the -actual- relationship between the robot wheels’ rotation, the encoders, and the physical motion. In order to understand this, you need to create a smooth motion profile with a smooth acceleration, cruise, and deceleration phases that moves a specific distance. Choose a nice long distance that you can drive all on one piece of carpet.
Calculate the expected encoder pulses per wheel revolution and the expected circumference of your wheels. Get that into your code. Use a clear, understandable description!!! Something like either wheel circumference or diameter; you will tweak it.
Once you have that ready, put a reference object (like a battery) against your bumpers, zero your odometry, and drive straight forward with your motion profile. Measure the exact distance with respect to the reference surface. It will NOT match your plan… it never does. After you have sorted out the silly stuff like forgetting the gear ratio and pulses per revolution, you will end up adjusting your wheel circumference/diameter by the ratio of actual distance to planned distance. Repeat as needed to get this right!
For really fancy autons you will need to do this on the -real- carpet.
Bonus points: comment in code the expected values for pulses, gear ratio, and circumference/diameter. Double bonus: add an error if the circumference is entered more than 10% off of the expected number… Just protecting against oopsies