core / com.acmerobotics.roadrunner.drive / Drive

Drive

abstract class Drive

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>

Drive()

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.

Properties

externalHeading

var externalHeading: Double

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

localizer

abstract var localizer: Localizer

Localizer used to determine the evolution of poseEstimate.

poseEstimate

var poseEstimate: Pose2d

The robot's current pose estimate.

rawExternalHeading

abstract val rawExternalHeading: Double

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

Functions

setDrivePower

abstract fun setDrivePower(drivePower: Pose2d): Unit

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

setDriveSignal

abstract fun setDriveSignal(driveSignal: DriveSignal): Unit

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

updatePoseEstimate

fun updatePoseEstimate(): Unit

Updates poseEstimate with the most recent positional change.

Inheritors

MecanumDrive

abstract class MecanumDrive : Drive

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

SwerveDrive

abstract class SwerveDrive : Drive

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

TankDrive

abstract class TankDrive : Drive

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