Package-level declarations

Types

Link copied to clipboard
class SwerveDriveBuilder(gyroId: Int, canBus: CANBus)

Builder class for creating a SwerveDrive with DSL syntax.

Link copied to clipboard
data class SwerveEncoderConfig(var offset: Rotation2d = Rotation2d(), var clockwisePositive: Boolean = false)

Configuration builder for swerve encoder setup.

Properties

Link copied to clipboard

Extension property to convert a value in inches to meters.

Link copied to clipboard
val AprilTagFields.layout: AprilTagFieldLayout

Extension property to load the AprilTagFieldLayout for the given AprilTagFields enum value.

Link copied to clipboard

Extension property to convert a value in meters to inches.

Link copied to clipboard
val Pose2d.rotated180: Pose2d

Extension property to get a new Pose2d rotated by 180 degrees from the current pose.

Functions

Link copied to clipboard

Extension to configure an existing Engu for swerve use with a DSL.

Link copied to clipboard
fun Pose2d.distanceTo(targetPose: Pose2d): Distance

Calculates the distance from a robot pose to another pose on the field.

fun Pose2d.distanceTo(targetLocation: Translation2d): Distance

Calculates the distance from a robot pose to an arbitrary field location.

Link copied to clipboard
fun Pose2d.distanceToClosestTag(fieldLayout: AprilTagFieldLayout = AprilTagFields.kDefaultField.layout): Distance?

Calculates the distance from a robot pose to the closest AprilTag.

Link copied to clipboard
fun Pose2d.distanceToTag(tagId: Int, fieldLayout: AprilTagFieldLayout = AprilTagFields.kDefaultField.layout): Distance?

Calculates the distance from a robot pose to a specific AprilTag.

Link copied to clipboard
fun SwerveDrive.driveToAngleCommand(xSupplier: () -> Double, ySupplier: () -> Double, targetAngle: Rotation2d, block: DriveToAngle.Config.() -> Unit = {}): Command

Creates a drive to angle command with DSL configuration.

Link copied to clipboard
fun Pose2d.findClosestTag(fieldLayout: AprilTagFieldLayout): Pair<Int, Distance>?

Finds the closest AprilTag to the robot's current pose.

Link copied to clipboard
fun Engu.getAngleError(target: Rotation2d): Rotation2d

Extension to get the angle error between current position and target.

Link copied to clipboard
fun List<PhotonModule>.getDecentResultPairs(condition: (PhotonPipelineResult) -> Boolean = { it.hasTargets() }): List<Pair<PhotonModule, PhotonPipelineResult>>

Extension function for a list of PhotonModule objects to get the best PhotonPipelineResult.

Link copied to clipboard
fun Pair<PhotonModule, PhotonPipelineResult>.getEstimatedPose(prevEstimatedRobotPose: Pose2d): EstimatedRobotPose?

Extension function for a Pair of PhotonModule and PhotonPipelineResult to get estimated poses.

Link copied to clipboard
fun TalonFXConfiguration.getPingu(): Pingu

Extension function to get the Pingu values from a TalonFXConfiguration.

Link copied to clipboard
fun List<Pair<PhotonModule, PhotonPipelineResult>>.hasTargets(): Boolean

Extension function for a list of Pair of PhotonModule and PhotonPipelineResult to check if any have targets.

Link copied to clipboard
operator fun Command.invoke()

Operator invoke implementation for Command.

Link copied to clipboard
fun Engu.isAtAngle(target: Rotation2d, tolerance: Angle = Units.Degrees.of(2.0)): Boolean

Extension to check if encoder is within tolerance of target angle.

Link copied to clipboard
fun XboxController.leftStickPosition(xDeadzone: Double, yDeadzone: Double): Pair<Double, Double>

Gets the position of the left stick based on the input from the controller.

Link copied to clipboard
fun SwerveDrive.lockCommand(): Command

Creates a lock swerve command.

Link copied to clipboard
fun ChassisSpeeds.magnitude(): Double

Extension to get the magnitude of chassis speeds.

Link copied to clipboard
fun module(driveId: Int, steerId: Int, encoderId: Int, offset: Rotation2d = Rotation2d()): SwerveModule

Extension to create a simple module reference for builder DSL.

Link copied to clipboard
operator fun Rotation2d.plus(yaw: Double): Rotation3d

Operator function to add a yaw value to a Rotation2d, resulting in a Rotation3d.

operator fun ChassisSpeeds.plus(other: ChassisSpeeds): ChassisSpeeds

Extension to add two chassis speeds together.

Link copied to clipboard
fun SwerveDrive.resetGyroCommand(angle: Rotation2d = Rotation2d()): Command

Creates a reset gyro command.

Link copied to clipboard
fun XboxController.rightStickPosition(xDeadzone: Double, yDeadzone: Double): Pair<Double, Double>

Gets the position of the right stick based on the input from the controller.

Link copied to clipboard
fun Command.scheduleIf(condition: Boolean)

Schedule this command when the provided condition is true.

Link copied to clipboard
fun TalonFXConfiguration.setPingu(pingu: Pingu): Pingu

Extension function to set the Pingu values of a TalonFXConfiguration using a Pingu object.

Link copied to clipboard
fun Engu.shortestDistanceTo(target: Rotation2d): Double

Extension to get the shortest angular distance to target.

Link copied to clipboard
fun swerveDrive(gyroId: Int, canBus: CANBus = CANBus.roboRIO(), block: SwerveDriveBuilder.() -> Unit): SwerveDrive

Creates a swerve drive subsystem with a DSL for module configuration.

Link copied to clipboard
fun swerveEncoder(id: Int, offset: Rotation2d = Rotation2d(), clockwisePositive: Boolean = false): Engu

Creates an Engu encoder configured for swerve module use.

Link copied to clipboard
fun swerveModule(driveId: Int, steerId: Int, encoderId: Int, offset: Rotation2d = Rotation2d(), block: SwerveModule.Config.() -> Unit = {}): SwerveModule

Creates a swerve module with DSL configuration.

Link copied to clipboard
fun SwerveDrive.teleopCommand(xSupplier: () -> Double, ySupplier: () -> Double, rotSupplier: () -> Double, fieldOriented: Boolean = true, block: TeleopSwerve.Config.() -> Unit = {}): Command

Creates a teleop swerve command with DSL configuration.

Link copied to clipboard
fun ChassisSpeeds.times(scale: Double): ChassisSpeeds

Extension to scale chassis speeds by a factor.

Link copied to clipboard
fun Rotation2d.to3d(yaw: Double): Rotation3d

Extension function to convert a Rotation2d to a Rotation3d.

Link copied to clipboard
fun Translation2d.toChassisSpeeds(rotation: Double = 0.0): ChassisSpeeds

Extension to convert Translation2d to ChassisSpeeds with rotation.

Link copied to clipboard

Extension to log encoder information to a string.

Link copied to clipboard
fun SwerveDrive.turnToAngleCommand(targetAngle: Rotation2d, block: TurnToAngle.Config.() -> Unit = {}): Command

Creates a turn to angle command with DSL configuration.

Link copied to clipboard
fun Pair<PhotonModule, PhotonPipelineResult>.updateStdDev(estimatedRobotPose: EstimatedRobotPose?)

Extension function for a Pair of PhotonModule and PhotonPipelineResult to update the standard deviations of the estimated robot pose.