Pathplanner path following issues

Hello,

we are having trouble implementing pathplanner for our tank drive robot. I configured the AutoBuilder, but something seems to be wrong with how the robot is following the path. Some more information:

One set of wheels (the left side) is going the wrong way. During teleop, everything is normal, but AutoBuilder spins them the wrong way (or so it seems). I tried making the speed negative in the driveRobotRelative() method, yet it still spun the left wheels the wrong way.

We have not tested the auto with the wheels on the ground, just with the wheels hanging over a cart. The wheels seem to be moving far too fast, so we are quite hesitant to put the robot on the ground to test. Would this change the way the robot follows the path, if the gyro isn’t moving?

We also sometimes get a DifferentialDrive error (not updated often enough).

Here is our code, does anyone spot something(s) wrong?
Thanks.

I think your fundamental problem here is that the signs are wrong for your teleop. getLeftY is positive back, and getRightX is positive right. Your arcadeDrive method expects to get a positive forward speed, and a positive left (counterclockwise) rotation. So you should reverse their signs, e.g. with:

m_drivetrain.setDefaultCommand(new RunCommand(() -> m_drivetrain.arcadeDrive(
    () -> -m_driverController.getLeftY(), // speed forwards
    () -> -m_driverController.getRightX()), // rotation counter-clockwise
    m_drivetrain));

Once you’ve done that, you’ll probably find you need to invert your motors to make teleop work again. Then you’ll be set up to get auto working.

Also, I haven’t reviewed all of your auto code, but I note that you’re calling arcadeDrive in autos. This isn’t ideal because this method applies deadbands and a (sign-preserving) square, which makes it hard to pick the right values for auto.

I agree with with @bovlb. Since you forgot to reverse the joystick axis, you ended up having each motor rotating at the wrong direction to get your robot to work at TeleOp, so it wouldn’t work in auto.

Also, consider limiting the maximum motor output and test it on the ground. The gyro will not update if you lift your robot up, and maybe the chassis was trying to turn around.

1 Like

We might be one or two days ahead of you on the “learning Pathplanner” journey. What we found helpful was creating a “wait 1 second, then move 1 foot (0.3 meters) at 0.1 m/s max speed” auto routine and use that as the basis for our auto development.

Until we switched to that, we were chasing our tails with a bunch of immediate auto-enable, then E-stop because the bot took off somewhere. After that, we knew that the max damage was pretty confined and could focus more brainpower on figuring our how to fix the config.

1 Like