PathPlanner help

We are working to implement pathplanner this year, we got tried to get a basic program going to turn and to driver straight, but we are struggling to get it to go a a speed that makes sense.

We tried to adjust the PID for the planner, we changed the velocity and accelerations, but nothing seems to have a change.

We aren’t really sure what we are doing incorrectly or why it isn’t travelling the whole distance

Here is the code

The videos are of the robot running
https://drive.google.com/drive/folders/1AaShGdC1bRLbBNkv9YXACz69MwvKsGE0?usp=sharing

The integer values in this line here (4,3) are the acceleration and velocity values that the path should be using as targets while running the path. The PID tuning you do should be correcting for the error in achieving the target position/speed.

I also believe in the PathPlanner UI there is a set of Acceleration, Velocity generation values but I thought the coded accel/velocity parameter values for the loadPath method would overwrite the ones you set in the UI, but maybe that is not the case.

PathPlanner.loadPath("BasicAuto", 4,  3, false);

Another thing I looked in your swerve drive class and your drive motor current limits are set at 20 amps which is pretty low for a drivetrain. I think the way the motors behave with the limit set that low may also be a part of your problem.

Ok, changed the current limit the 40 amps that the breaker that it is connected to. This did not have an obvious difference.

The settings in the GUI are also for 4,3 velocity and acceleration, so the values are the same as far as I understand.

Have you checked that your odometry updates correctly? Like display your robot position on a Field2D visualization on the dashboard and then drive it around and validate that your sensor readings correspond correctly to what Pose data you are updating.

Your PID constants are wayy too small is another thing, and again I’m not able to check over every detail of your code.

2023_swerve/Constants.java at Auto-Test-Pinky · amschmidt2/2023_swerve (github.com)

Based on what I’ve seen you want values greater than 1 for the P GAIN on these Path Following routines.

I understand, Thank you for your help, looking at the 2d visualizer the robot does not move like we would expect.

It is moving much slower on the visualizer similar to what we are seeing in the auto, but when the robot spins it matches the same as the robot. Is there a resource that I can look to see what that maps to?

We had moved the PID up and down, I put it back to 5 and didnt see movement.

So it seems then you need to potentially fix your odometry/sensor inputs that are being fed into your odometry object. You may have a encoder value scaled wrong for the drive motors. (I didn’t check)

Actually… Looking at your gear ratios in your module constants. Why is the module gear ratio set to (1 / gearing) instead of (gearing / 1).

I have been learning the BaseFalconSwerve implementation for our code base this year and their gear ratios are divided by 1.

BaseFalconSwerve/COTSFalconSwerveConstants.java at main · Team364/BaseFalconSwerve (github.com)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.