Swerve

public class Swerve extends SubsystemBase

Properties

Link copied to clipboard
private final ChassisSpeeds autoSpeeds
Link copied to clipboard
private PathConstraints constraints
Link copied to clipboard
private final Double heading
Link copied to clipboard
public final static Swerve INSTANCE
Link copied to clipboard
private final Array<SwerveModulePosition> modulePositions
Link copied to clipboard
private Array<SwerveModuleState> moduleStates
Link copied to clipboard
private final Rotation2d pidgeyRotation
Link copied to clipboard
private final Double pidgeyYaw
Link copied to clipboard
private final Pose2d pose
Link copied to clipboard
private final Rotation2d rotationPidgey
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()

Gets the chassis speeds for autonomous driving.

Link copied to clipboard
public final PathConstraints getConstraints()
Link copied to clipboard
public final Double getHeading()

Gets the heading of the robot.

Link copied to clipboard
public final Array<SwerveModulePosition> getModulePositions()

Gets the positions of the swerve modules.

Link copied to clipboard
public final Array<SwerveModuleState> getModuleStates()

Gets the states of the swerve modules.

Link copied to clipboard
public final Rotation2d getPidgeyRotation()

Gets the rotation of the Pigeon2 IMU.

Link copied to clipboard
public final Double getPidgeyYaw()

Gets the yaw of the Pigeon2 IMU.

Link copied to clipboard
public final Pose2d getPose()

Gets the current pose of the robot from the pose estimator.

Link copied to clipboard
public final Rotation2d getRotationPidgey()

Gets the rotation of the Pigeon2 IMU for PID control.

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)

Sets the states of the swerve modules.

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.