DifferentialDrive Right Side Inverted Plus Motion Profiling

The DifferentialDrive negates the input on the right side of the drive so that the robot drives forward on both sides without having to do any -1 multiplications.

This means the right side talons are driving forward with red leds.

The problem is, when I use motion profiling, I am using non negated right side drive. If I use talon.setInverted(true) to flip the talon on the right, it corrects motion profiling, but the differential drive goes in circles. I’m setting setInverted in robot init. I believe that’s where it needs to be set.

I also don’t see anywhere else I could just multiply by -1 to counter this issue. We drive with arcadeDrive(move, turn). the move isn’t specific to left or right. We also are using talons to process the motion profile and I don’t want to send one side a negative position velocity.

Does this all make sense? Has anyone else overcome this without righting an alternative to the DifferentialDrive class?

wpilib has written a setRightSideInverted(boolean) method into the class, but I think it’s still in beta. Would like to know how to fix in the meatime.

The newest version of WPILib has a “setRightSideInverted” method for handling this.

I’m not seeing that. I downloaded the most recent updates in Eclipse and restarted it. Then i tried to use drive.setRightSideInverted but the method isn’t there.

I see it here: https://github.com/wpilibsuite/allwpilib/blob/master/wpilibj/src/main/java/edu/wpi/first/wpilibj/drive/DifferentialDrive.java

Not sure how to get the differentialdrive code with that method. Is this beta?

Thank you!

Yes, that change was added in May, so it wasn’t in the last 2018 release.

This isn’t as big of a deal as I thought. I was under the impression that talon.setInverted() had to be set in robotInit(). After finding that isn’t the case, I can use talon.setInverted(true) on the right side during a motion profile.

Once setRightSideInverted() is in the wpilib alpha, it’ll be even simpler.