EasyStack Docs

DriveBase Basics

Drivebase Basics

All four drivebases extend RobotDrive and implement the Drivetrain contract. This lets higher level code send a movement request or stop the robot through the same two method names. Each concrete drivebase still decides how that request becomes wheel commands.

Drivetrain

Drivetrain declares drive(DrivePowers powers) and stop(). It does not create motors, read a controller, obtain an IMU heading, or run a periodic loop. Your program supplies inputs and calls the appropriate method while control is active.

Java
import dev.easyfamily.easystack.drivebase.drive.Drivetrain;
import dev.easyfamily.easystack.drivebase.drive.DrivePowers;

 = mecanumDrive;
drivebase.drive(new DrivePowers(@.4, 0.0, 0.0));
drivebase.stop();

Here, mecanumDrive is an existing MecanumDrive instance. A variable typed as Drivetrain exposes the shared drive and stop methods. Keep a concrete type when you also need configuration or specialized controls, such as tankDrive() or driveFieldCentric().

Understanding the input meaning

For DifferentialDrive, MecanumDrive, and HolonomicDrive, movement inputs are normalized power requests. The mixing methods clip individual axes to the range −1 to 1, then combine and normalize the resulting wheel commands.

For SwerveDrivetrain, drive() interprets those same three values as forward velocity, lateral velocity, and angular velocity. It does not multiply joystick fractions by maximum speed. Scale driver input explicitly before using the swerve adapter, or use ChassisSpeed directly.

All examples assume valid, initialized hardware references and finite numeric inputs. The drivebases do not automatically schedule updates or replace hardware direction and sensor configuration.

DrivePowers

DrivePowers stores a movement request containing forward, strafe, and turn. Its fields are private and final, so the values cannot be changed after construction. Create a new instance when the request changes.

Creating a movement request

The constructor order is forward, strafe, turn. This differs from the strafe, forward, turn order used by the mecanum and holonomic driving methods.

Java
import dev.easyfamily.easystack.drivebase.drive.DrivePowers;
 = new DrivePowers(0.5, 0.2, -0.1);
drive.drive(powers);
ValueMeaning in a power based drivebase
forwardForward or backward input
strafeSideways input; ignored by DifferentialDrive
turnRotation input

DrivePowers stores the supplied numbers exactly. It does not clip, normalize, apply a deadband, or square the values. Processing happens in the drivebase that receives it.

Reading values and requesting zero

Java
double forward powers.getForward();
 = powers.getStrafe();
 = powers.getTurn ();

DrivePowers neutral DrivePowers.zero();
drive.drive(neutral);

zero() creates a new object containing three zeroes. A zero request produces zero wheel power in the differential, mecanum, and holonomic mixers. On swerve, it also requests zero translation and rotation, but module steering can still update. Use stop() when you need to stop the drive motors and steering actuators immediately.

RobotDrive

RobotDrive provides output configuration and protected input helpers for subclasses. It is abstract, so create a concrete drivebase rather than constructing RobotDrive itself.

Maximum output

The default maxOutput is 1.0. For the differential, mecanum, and holonomic drivebases, it multiplies the final wheel powers. A value of 0.5 therefore scales a normalized wheel command of 1.0 to 0.5.

Java
drive.setMaxOutput(0.5);
double outputScale = drive.getMaxOutput();

drive.setMaxOutput(1.0);

setMaxOutput() clips its argument to −1 through 1. It does not take an absolute value. Use values from 0 to 1 for normal output limiting; a negative value reverses the scaled commands in the power based drivebases. Swerve applies this setting differently, as described in its output limit section.

Input processing

clip() limits one input to −1 through 1. squareInput() squares its magnitude while preserving its sign: an input of −0.5 becomes −0.25. DifferentialDrive and MecanumDrive expose optional squared input overloads for finer joystick control near zero.

normalize(values) divides every array entry by the largest absolute entry only when that entry exceeds 1. This preserves the ratios between wheel commands instead of clipping each wheel independently.

The overload normalize(values, magnitude) only multiplies every entry by magnitude. Despite its name, it does not independently limit or normalize the array. MecanumDrive and four motor HolonomicDrive use it while constructing their translation commands, then call the other normalization method after adding rotation.

These helpers are protected. They support subclasses; they are not public methods to call through a drive instance. No deadband, acceleration ramp, or automatic watchdog is implemented by RobotDrive.

Last updated 2026-11-16

EasyStack - FTC Java library

This site records page views of visitors to understand how the documentation is used. Nothing is sold or shared with third parties.