Package yams.commands3.swerve


package yams.commands3.swerve
Commands v3 swerve drive.

SwerveDrive extends the core SwerveDrive (kinematics, odometry, pose estimation and telemetry) with Command factories that require the Mechanism set in its SwerveDriveConfig. Each wheel is a SwerveModule backed by two SmartMotorControllers (drive and steer), configured with SwerveModuleConfig.

SwerveInputStream turns driver inputs into ChassisVelocities. It converts controller axis suppliers into ChassisVelocities that can be sampled with get() inside drive commands or coroutines.

public class DriveMechanism implements Mechanism {
  private final SwerveDrive drive = new SwerveDrive(
      new SwerveDriveConfig(this, frontLeft, frontRight, backLeft, backRight)
          .withTranslationController(new PIDController(1, 0, 0))
          .withRotationController(new PIDController(1, 0, 0)));

  public Command driveTo(Pose2d pose) {
    return drive.driveToPose(pose, Centimeters.of(5), Degrees.of(3));
  }
}
See Also:
  • Classes
    Class
    Description
    Command-based extension of SwerveDrive that adds the Mechanism binding and Command factories.
    Helper class to transform controller inputs into workable Chassis speeds for the Commands v3 API.