WPILib Drive classes: Conventions and Defaults

This article describes conventions and defaults used by the WPILib Drive classes (DifferentialDrive, MecanumDrive, and KilloughDrive). For further details on using these classes, see the subsequent articles.

Motor Inversion

By default, the class inverts the motor outputs for the right side of the drivetrain. Generally this will mean that no inversion needs to be done on the individual SpeedController objects. To disable this behavior, use the setRightSideInverted() method.

Squaring Inputs & Input Deadband

When driving robots, it is often desirable to manipulate the joystick inputs such that the robot has finer control at low speeds while still using the full output range. One way to accomplish this is by squaring the joystick input, then reapplying the sign. By default the Differential Drive class will square the inputs. If this is not desired (e.g. if passing values in from a PIDController), use one of the drive methods with the squaredInputs parameter and set it to false.

By default, the Differential Drive class applies an input deadband of .02. This means that input values with a magnitude below .02 (after any squaring as described above) will be set to 0. In most cases these small inputs result from imperfect joystick centering and are not sufficient to cause drivetrain movement, the deadband helps reduce necessary motor heating that may result from applying these small values to the drivetrain. To change the deadband, use the setDeadband() method.

Motor Safety

By default all RobotDrive objects enable Motor Safety. This is a watchdog that disables the output if no update method is called within 100ms. To feed the watchdog without changing the input values, call feedWatchdog(). To change the watchdog timeout, call setExpiration(). To disable the watchdog, call setSafetyEnabled(false). To learn more about Motor Safety, see the article: Using the motor safety feature

Axis Conventions

This library uses the NED axes convention (North-East-Down as external reference in the world frame). The positive X axis points ahead, the positive Y axis points right, and the positive Z axis points down. Rotations follow the right-hand rule, so clockwise rotation around the Z axis is positive.

Note: This convention is different than the convention for joysticks which typically have -Y as Up (commonly mapped to throttle) and +X as Right. Pay close attention to the examples below if you want help with typical Joystick->Drive mapping.