core / com.acmerobotics.roadrunner.drive / Drive

Drive

abstract class Drive (source)

Abstraction for generic robot drive motion and localization. Robot poses are specified in a coordinate system with positive x pointing forward, positive y pointing left, and positive heading measured counter-clockwise from the x-axis.

Constructors

<init>

Abstraction for generic robot drive motion and localization. Robot poses are specified in a coordinate system with positive x pointing forward, positive y pointing left, and positive heading measured counter-clockwise from the x-axis.

Drive()

Properties

externalHeading

The robot's heading in radians as measured by an external sensor (e.g., IMU, gyroscope).

var externalHeading: Double

localizer

Localizer used to determine the evolution of poseEstimate.

abstract var localizer: Localizer

poseEstimate

The robot's current pose estimate.

var poseEstimate: Pose2d

poseVelocity

Current robot pose velocity (optional)

val poseVelocity: Pose2d?

rawExternalHeading

The raw heading used for computing externalHeading. Not affected by externalHeading setter.

abstract val rawExternalHeading: Double

Functions

getExternalHeadingVelocity

The heading velocity used to determine pose velocity in some cases

open fun getExternalHeadingVelocity(): Double?

setDrivePower

Sets the current commanded drive state of the robot. Feedforward is not applied to drivePower.

abstract fun setDrivePower(drivePower: Pose2d): Unit

setDriveSignal

Sets the current commanded drive state of the robot. Feedforward is applied to driveSignal before it reaches the motors.

abstract fun setDriveSignal(driveSignal: DriveSignal): Unit

updatePoseEstimate

Updates poseEstimate with the most recent positional change.

fun updatePoseEstimate(): Unit

Inheritors

MecanumDrive

This class provides the basic functionality of a mecanum drive using MecanumKinematics.

abstract class MecanumDrive : Drive

SwerveDrive

This class provides the basic functionality of a swerve drive using SwerveKinematics.

abstract class SwerveDrive : Drive

TankDrive

This class provides the basic functionality of a tank/differential drive using TankKinematics.

abstract class TankDrive : Drive