Differential drive best code

Hello! Our team is wondering what would be a good way to program a curvature drive of sorts, like what 254 used past year, or what 118 is using currently. Right now we have a simple arcade drive with the left ( front and back robot movement ) joystick and the right (robot turning) joystick of a PS4 controller. We were wondering how could we code something similar that turns smoothly in curves like 254 or 118, example codes would be extremely helpful, thanks!

The differential drive class in WPILIB has a curvatureDrive method that you can use.


I saw it and read about it but saw some teams thought it wasnt that good. Is it good?

My team uses arcade drive so I wouldn’t know.

1 Like

arcade drive as is? The thing is it makes you always turn in place so its hard to control at times

4180 is fond of custom classes, since 2016 we have custom joystick and drivetrain code that maps our drivetrain to a single joystick, adapted each year to the drivers controller of choice (Which has been the same 3axis Logitech attack3 from 2016-19, switching to a new 4 axis thrust master only this year) and to the motor controllers were using that year

We like doing it cause it allows to play with the how the joystick maps to the robot more easily than the generic wpi imports, and allows to have throttle to control max speed in addition to normal controllers

Deep space is one of the better examples, the master branch has code for a 3 axis joystick but other branches have code for other types of controllers.

1 Like

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