ChassisSpeeds
ChassisSpeed
ChassisSpeed describes the motion requested from the swerve chassis. It contains forward velocity vx, leftward velocity vy, and angular velocity omega. These are robot relative velocities, not raw joystick percentages.
Creating a velocity request
import dev.easyfamily.easystack.drivebase.swerve.ChassisSpeed;
ChassisSpeed target new ChassisSpeed(1.0, 0.25, 0.5);
= new ChassisSpeed();If module geometry uses meters and maxSpeed uses meters per second, this requests 1.0 m/s forward, 0.25 m/s left, and 0.5 rad/s rotation. The no argument constructor stores zero for all three components.
| Component | Units | Coordinate meaning |
|---|---|---|
| vx | Length units per second | Positive forward |
| vy | Length units per second | Positive left |
| omega | Radians per second | Use a consistent positive rotation convention |
The conventional setup used in this guide takes positive omega as counterclockwise when viewed from above. Its module construction example explains how to obtain the corresponding tangential vectors with the supplied implementation.
Reading the request
double forwardVelocity target.getVx();
double getVelocity target.getVy();
double AngularVelocity target.getOmega();
double translationSpeed target.translationNorm();translationNorm() computes the magnitude of vx and vy together. It does not include omega because angular velocity has different units. getTranslation() returns a new Vector2d containing vx and vy. None of these values is a sensor measurement; they describe a command.
Working with chassis velocity
Scaling a request
ChassisSpeed has final fields. times(scalar) returns a new instance with all three components multiplied by the scalar and leaves the original unchanged.
ChassisSpeed target new 0.25,
= target.times(0.4);
swerve.updateWithTargetVelocity(slower);This produces 0.4 forward, 0.1 left, and 0.2 rad/s rotation. Scaling an existing request is a useful way to implement a deliberate slow mode before the drivetrain performs its own checks.
Field relative input
There is no field relative factory in ChassisSpeed and no driveFieldCentric() method in SwerveDrivetrain. Convert the field velocity to robot coordinates before constructing the request. The following conversion assumes field X is forward at heading zero, field Y is left, and positive heading is counterclockwise.
double c = Math.cos(headingRadians);
double s = Math.sin(headingRadians);
double robotVx fieldVx * c + fieldVy * s;
double robotVy -fieldVx * s + fieldVy * c;
ChassisSpeed robotRelative
new ChassisSpeed(robotVx, robotVy, omega);
swerve.updateWithTargetVelocity(robotRelative);Use the same length units throughout the velocity and geometry configuration. Heading is an angle in radians, whereas omega is an angular rate in radians per second. They cannot be substituted for each other.
toString() formats the values to three decimal places with the label ChassisSpeeds. That label is plural in the implementation even though the Java class name is ChassisSpeed. The method is useful for displaying the target in telemetry.
Last updated 2026-11-16