EasyStack Docs

Swerve

#Swerve Drive

A swerve drivetrain uses four independently steered wheel modules, allowing the robot to move in any direction while controlling its rotation separately. Each module combines a drive motor that spins the wheel with a steering actuator that changes the wheel’s direction. EasyStack handles the calculations that turn a chassis movement request into individual module commands.

To use a swerve drivetrain, start by configuring an EasyMotor and an EasyCRServo for each module. Verify the drive motor direction and configure the steering angle feedback so that every module uses a consistent angle reference in radians. This lets the steering controller determine where the wheel is pointing and move it toward its target.

Next, create four SwerveModule instances. Each module needs its drive motor, steering servo, a Vector2d describing its configured offset, and its maximum speed. Follow the offset convention explained in the module setup section: the supplied implementation uses that vector’s direction directly for the rotational contribution.

Once the modules are ready, create a SwerveDrivetrain using the robot’s track width, wheelbase, maximum speed, and modules in this order: front right, front left, back left, back right. Keep the units consistent. For example, when dimensions are measured in meters, linear velocities must use meters per second.

During the control loop, use ChassisSpeed to specify the desired forward velocity, leftward velocity, and angular velocity. Pass this request to updateWithTargetVelocity() each loop to update all four modules. If the inputs come from a gamepad, scale the joystick values into the desired velocities first. These requests are relative to the robot; field-relative control requires converting them using the robot’s heading.

When control ends, call stop() to stop the drive motors and steering actuators. You can also call updateWithXLock() repeatedly while a lock mode is active to command a crossed wheel arrangement. Before using combined movement, check forward motion, sideways motion, and rotation separately to confirm that module order, steering references, and motor directions are correct.

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.