Swerve

public class Swerve extends SubsystemBase

Properties

Link copied to clipboard
private final ChassisSpeeds autoSpeeds

The chassis speeds, used for autonomous driving

Link copied to clipboard
private PathConstraints constraints
Link copied to clipboard
private final Double heading

Heading of the robot

Link copied to clipboard
public final static Swerve INSTANCE
Link copied to clipboard
private final Array<SwerveModulePosition> modulePositions

The positions of the swerve modules

Link copied to clipboard
private Array<SwerveModuleState> moduleStates

The states of the swerve modules

Link copied to clipboard
private final Rotation2d pidgeyRotation

Rotation of the Pigeon2 IMU

Link copied to clipboard
private final Double pidgeyYaw

Yaw of the Pigeon2 IMU

Link copied to clipboard
private final Pose2d pose

The current pose of the robot from the pose estimator

Link copied to clipboard
private final Rotation2d rotationPidgey

The rotation of the Pigeon2 IMU, used for PID control

Link copied to clipboard

Functions

Link copied to clipboard
public final Unit chassisSpeedsDrive(ChassisSpeeds chassisSpeeds)

Drives the robot using chassis speeds.

Link copied to clipboard
public final ChassisSpeeds getAutoSpeeds()
Link copied to clipboard
public final PathConstraints getConstraints()
Link copied to clipboard
public final Double getHeading()
Link copied to clipboard
public final Array<SwerveModulePosition> getModulePositions()
Link copied to clipboard
public final Array<SwerveModuleState> getModuleStates()
Link copied to clipboard
public final Rotation2d getPidgeyRotation()
Link copied to clipboard
public final Double getPidgeyYaw()
Link copied to clipboard
public final Pose2d getPose()
Link copied to clipboard
public final Rotation2d getRotationPidgey()
Link copied to clipboard
Link copied to clipboard
public final Unit newPose(Pose2d pose)

Sets a new pose for the robot.

Link copied to clipboard
public final Command pathFindTest()
Link copied to clipboard
public final Command pathFindToGoal()
Link copied to clipboard
public Unit periodic()

This method is called periodically by the scheduler. It updates the pose estimator and dashboard values.

Link copied to clipboard
public final Unit resetDrive()

Resets the drive positions of all swerve modules.

Link copied to clipboard
public final Unit resetPidgey()

Resets the Pigeon2 IMU.

Link copied to clipboard
public final Unit setAutoPID()

Sets the PID constants for autonomous driving.

Link copied to clipboard
public final Unit setConstraints(PathConstraints value)
Link copied to clipboard
public final Unit setDriveSpeeds(Double forwardSpeed, Double leftSpeed, Double turnSpeed, Boolean isFieldOriented)

Sets the drive speeds for the swerve modules.

Link copied to clipboard
public final Unit setModuleStates(Array<SwerveModuleState> states)
Link copied to clipboard
public final Unit setSwerveLoggingThread(Thread value)
Link copied to clipboard
Link copied to clipboard
public final Unit setTelePID()

Sets the PID constants for teleoperated driving.

Link copied to clipboard
public final Unit stop()

Stops all swerve modules.

Link copied to clipboard
Link copied to clipboard
public final Unit zeroPose()

Resets the pose of the robot to zero.