Class RRMecanumDriveImpl
java.lang.Object
com.acmerobotics.roadrunner.drive.Drive
com.acmerobotics.roadrunner.drive.MecanumDrive
org.firstinspires.ftc.teamcode.framework.subsystems.rrmecanumdrive.RRMecanumDriveImpl
- All Implemented Interfaces:
RRMecanumDrive
public class RRMecanumDriveImpl
extends com.acmerobotics.roadrunner.drive.MecanumDrive
implements RRMecanumDrive
A normal implementation of
RRMecanumDrive.
Anything lacking a description is from RoadRunner. See learnroadrunner.com to
learn more about those things.-
Nested Class Summary
Nested classes/interfaces inherited from class com.acmerobotics.roadrunner.drive.MecanumDrive
com.acmerobotics.roadrunner.drive.MecanumDrive.MecanumLocalizerNested classes/interfaces inherited from interface org.firstinspires.ftc.teamcode.framework.subsystems.rrmecanumdrive.RRMecanumDrive
RRMecanumDrive.DriveConstants, RRMecanumDrive.Parameters -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal com.acmerobotics.roadrunner.trajectory.constraints.TrajectoryAccelerationConstraintstatic doublefinal com.qualcomm.robotcore.hardware.DcMotorExfinal com.qualcomm.robotcore.hardware.DcMotorExfinal doublefinal com.qualcomm.robotcore.hardware.DcMotorExfinal com.qualcomm.robotcore.hardware.DcMotorExfinal com.acmerobotics.roadrunner.trajectory.constraints.TrajectoryVelocityConstraintfinal doublefinal double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidApply motor powers from a DTS (Drive-Turn-Strafe).doubleencoderTicksToInches(double ticks) voidfollowTrajectory(com.acmerobotics.roadrunner.trajectory.Trajectory trajectory) Blocking method to follow a trajectory created by TrajectoryBuilder (NOT TrajectorySequenceBuilder).voidfollowTrajectoryAsync(com.acmerobotics.roadrunner.trajectory.Trajectory trajectory) Asynchronously follows a trajectory created by TrajectoryBuilder (NOT TrajectorySequenceBuilder).voidfollowTrajectorySequence(TrajectorySequence trajectorySequence) Blocking method to follow a trajectory created by TrajectorySequenceBuilder.voidfollowTrajectorySequenceAsync(TrajectorySequence trajectorySequence) Asynchronously follows a trajectory created by TrajectorySequenceBuilder.com.acmerobotics.roadrunner.trajectory.constraints.TrajectoryAccelerationConstraintgetAccelerationConstraint(double maxAccel) Use your robot's FriendlyIMU instead.com.acmerobotics.roadrunner.geometry.Pose2dcom.qualcomm.robotcore.hardware.DcMotorExGet the leftBack motor, if direct access is neededcom.qualcomm.robotcore.hardware.DcMotorExGet the leftFront motor, if direct access is neededdoubleUse your robot's FriendlyIMU instead.com.qualcomm.robotcore.hardware.DcMotorExGet the rightBack motor, if direct access is neededcom.qualcomm.robotcore.hardware.DcMotorExGet the rightFront motor, if direct access is neededcom.acmerobotics.roadrunner.trajectory.constraints.TrajectoryVelocityConstraintgetVelocityConstraint(double maxVel, double maxAngularVel, double trackWidth) booleanisBusy()Is RoadRunner doing something right now?voidPlease use applyDTS() instead.voidsetDrivePower(com.acmerobotics.roadrunner.geometry.Pose2d drivePower) voidvoidsetDriveSignal(com.acmerobotics.roadrunner.drive.DriveSignal driveSignal) voidsetMode(com.qualcomm.robotcore.hardware.DcMotor.RunMode runMode) The usual DcMotor method, but applied to all four motors.voidsetMotorPowers(double v, double v1, double v2, double v3) Please use applyDTS() instead.voidsetPIDFCoefficients(com.qualcomm.robotcore.hardware.DcMotor.RunMode runMode, com.qualcomm.robotcore.hardware.PIDFCoefficients coefficients) voidsetWeightedDrivePower(com.acmerobotics.roadrunner.geometry.Pose2d drivePower) Please use applyDTS() instead.voidsetZeroPowerBehavior(com.qualcomm.robotcore.hardware.DcMotor.ZeroPowerBehavior behavior) The usual DcMotor method, but applied to all four motors.com.acmerobotics.roadrunner.trajectory.TrajectoryBuildertrajectoryBuilder(com.acmerobotics.roadrunner.geometry.Pose2d startPose) We'll usually use TrajectorySequenceBuilder.com.acmerobotics.roadrunner.trajectory.TrajectoryBuildertrajectoryBuilder(com.acmerobotics.roadrunner.geometry.Pose2d startPose, boolean reversed) We'll usually use TrajectorySequenceBuilder.com.acmerobotics.roadrunner.trajectory.TrajectoryBuildertrajectoryBuilder(com.acmerobotics.roadrunner.geometry.Pose2d startPose, double startHeading) We'll usually use TrajectorySequenceBuilder.trajectorySequenceBuilder(com.acmerobotics.roadrunner.geometry.Pose2d startPose) Learn more at learnroadrunner.com.voidturn(double angle) voidturnAsync(double angle) voidupdate()Called by robot.update().voidA poorly named RoadRunner update method that only updates RR stuff (like async(?) trajectory following) when the OpMode thread is active.Methods inherited from class com.acmerobotics.roadrunner.drive.MecanumDrive
getLocalizer, setLocalizerMethods inherited from class com.acmerobotics.roadrunner.drive.Drive
getExternalHeading, getPoseEstimate, getPoseVelocity, setExternalHeading, setPoseEstimate, updatePoseEstimateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.firstinspires.ftc.teamcode.framework.subsystems.rrmecanumdrive.RRMecanumDrive
getPoseEstimate, setPoseEstimate, updatePoseEstimate
-
Field Details
-
leftFront
public final com.qualcomm.robotcore.hardware.DcMotorEx leftFront -
rightFront
public final com.qualcomm.robotcore.hardware.DcMotorEx rightFront -
leftBack
public final com.qualcomm.robotcore.hardware.DcMotorEx leftBack -
rightBack
public final com.qualcomm.robotcore.hardware.DcMotorEx rightBack -
LATERAL_MULTIPLIER
public static double LATERAL_MULTIPLIER -
VX_WEIGHT
public final double VX_WEIGHT -
VY_WEIGHT
public final double VY_WEIGHT -
OMEGA_WEIGHT
public final double OMEGA_WEIGHT -
VEL_CONSTRAINT
public final com.acmerobotics.roadrunner.trajectory.constraints.TrajectoryVelocityConstraint VEL_CONSTRAINT -
ACCEL_CONSTRAINT
public final com.acmerobotics.roadrunner.trajectory.constraints.TrajectoryAccelerationConstraint ACCEL_CONSTRAINT
-
-
Constructor Details
-
RRMecanumDriveImpl
-
-
Method Details
-
getLeftFrontMotor
public com.qualcomm.robotcore.hardware.DcMotorEx getLeftFrontMotor()Description copied from interface:RRMecanumDriveGet the leftFront motor, if direct access is needed- Specified by:
getLeftFrontMotorin interfaceRRMecanumDrive
-
getRightFrontMotor
public com.qualcomm.robotcore.hardware.DcMotorEx getRightFrontMotor()Description copied from interface:RRMecanumDriveGet the rightFront motor, if direct access is needed- Specified by:
getRightFrontMotorin interfaceRRMecanumDrive
-
getLeftBackMotor
public com.qualcomm.robotcore.hardware.DcMotorEx getLeftBackMotor()Description copied from interface:RRMecanumDriveGet the leftBack motor, if direct access is needed- Specified by:
getLeftBackMotorin interfaceRRMecanumDrive
-
getRightBackMotor
public com.qualcomm.robotcore.hardware.DcMotorEx getRightBackMotor()Description copied from interface:RRMecanumDriveGet the rightBack motor, if direct access is needed- Specified by:
getRightBackMotorin interfaceRRMecanumDrive
-
applyDTS
Apply motor powers from a DTS (Drive-Turn-Strafe). This implementation will apply acceleration control before it reaches the motors.- Specified by:
applyDTSin interfaceRRMecanumDrive- Parameters:
dts- The DTS to apply. Normalize it before passing it in for desirable behavior.
-
setMode
public void setMode(com.qualcomm.robotcore.hardware.DcMotor.RunMode runMode) Description copied from interface:RRMecanumDriveThe usual DcMotor method, but applied to all four motors.- Specified by:
setModein interfaceRRMecanumDrive- Parameters:
runMode- The RunMode to set
-
setZeroPowerBehavior
public void setZeroPowerBehavior(com.qualcomm.robotcore.hardware.DcMotor.ZeroPowerBehavior behavior) Description copied from interface:RRMecanumDriveThe usual DcMotor method, but applied to all four motors.- Specified by:
setZeroPowerBehaviorin interfaceRRMecanumDrive- Parameters:
behavior- The ZeroPowerBehavior to set
-
update
public void update()Description copied from interface:RRMecanumDriveCalled by robot.update(). You do not need to call this method.- Specified by:
updatein interfaceRRMecanumDrive
-
trajectoryBuilder
public com.acmerobotics.roadrunner.trajectory.TrajectoryBuilder trajectoryBuilder(com.acmerobotics.roadrunner.geometry.Pose2d startPose) Description copied from interface:RRMecanumDriveWe'll usually use TrajectorySequenceBuilder. Learn more about TrajectoryBuilder at learnroadrunner.com.- Specified by:
trajectoryBuilderin interfaceRRMecanumDrive
-
trajectoryBuilder
public com.acmerobotics.roadrunner.trajectory.TrajectoryBuilder trajectoryBuilder(com.acmerobotics.roadrunner.geometry.Pose2d startPose, boolean reversed) Description copied from interface:RRMecanumDriveWe'll usually use TrajectorySequenceBuilder. Learn more about TrajectoryBuilder at learnroadrunner.com.- Specified by:
trajectoryBuilderin interfaceRRMecanumDrive
-
trajectoryBuilder
public com.acmerobotics.roadrunner.trajectory.TrajectoryBuilder trajectoryBuilder(com.acmerobotics.roadrunner.geometry.Pose2d startPose, double startHeading) Description copied from interface:RRMecanumDriveWe'll usually use TrajectorySequenceBuilder. Learn more about TrajectoryBuilder at learnroadrunner.com.- Specified by:
trajectoryBuilderin interfaceRRMecanumDrive
-
trajectorySequenceBuilder
public TrajectorySequenceBuilder trajectorySequenceBuilder(com.acmerobotics.roadrunner.geometry.Pose2d startPose) Description copied from interface:RRMecanumDriveLearn more at learnroadrunner.com.- Specified by:
trajectorySequenceBuilderin interfaceRRMecanumDrive
-
turnAsync
public void turnAsync(double angle) - Specified by:
turnAsyncin interfaceRRMecanumDrive
-
turn
public void turn(double angle) - Specified by:
turnin interfaceRRMecanumDrive
-
followTrajectoryAsync
public void followTrajectoryAsync(com.acmerobotics.roadrunner.trajectory.Trajectory trajectory) Description copied from interface:RRMecanumDriveAsynchronously follows a trajectory created by TrajectoryBuilder (NOT TrajectorySequenceBuilder).- Specified by:
followTrajectoryAsyncin interfaceRRMecanumDrive
-
followTrajectory
public void followTrajectory(com.acmerobotics.roadrunner.trajectory.Trajectory trajectory) Description copied from interface:RRMecanumDriveBlocking method to follow a trajectory created by TrajectoryBuilder (NOT TrajectorySequenceBuilder).- Specified by:
followTrajectoryin interfaceRRMecanumDrive
-
followTrajectorySequenceAsync
Description copied from interface:RRMecanumDriveAsynchronously follows a trajectory created by TrajectorySequenceBuilder.- Specified by:
followTrajectorySequenceAsyncin interfaceRRMecanumDrive
-
followTrajectorySequence
Description copied from interface:RRMecanumDriveBlocking method to follow a trajectory created by TrajectorySequenceBuilder.- Specified by:
followTrajectorySequencein interfaceRRMecanumDrive
-
getLastError
public com.acmerobotics.roadrunner.geometry.Pose2d getLastError()- Specified by:
getLastErrorin interfaceRRMecanumDrive
-
waitForIdle
public void waitForIdle()Description copied from interface:RRMecanumDriveA poorly named RoadRunner update method that only updates RR stuff (like async(?) trajectory following) when the OpMode thread is active.- Specified by:
waitForIdlein interfaceRRMecanumDrive
-
isBusy
public boolean isBusy()Description copied from interface:RRMecanumDriveIs RoadRunner doing something right now?- Specified by:
isBusyin interfaceRRMecanumDrive
-
setPIDFCoefficients
public void setPIDFCoefficients(com.qualcomm.robotcore.hardware.DcMotor.RunMode runMode, com.qualcomm.robotcore.hardware.PIDFCoefficients coefficients) - Specified by:
setPIDFCoefficientsin interfaceRRMecanumDrive
-
setWeightedDrivePower
public void setWeightedDrivePower(com.acmerobotics.roadrunner.geometry.Pose2d drivePower) Description copied from interface:RRMecanumDrivePlease use applyDTS() instead. This only exists for compatibility with stuff written for SampleMecanumDrive.- Specified by:
setWeightedDrivePowerin interfaceRRMecanumDrive
-
encoderTicksToInches
public double encoderTicksToInches(double ticks) -
getWheelPositions
- Specified by:
getWheelPositionsin interfaceRRMecanumDrive- Specified by:
getWheelPositionsin classcom.acmerobotics.roadrunner.drive.MecanumDrive
-
getWheelVelocities
- Specified by:
getWheelVelocitiesin interfaceRRMecanumDrive- Overrides:
getWheelVelocitiesin classcom.acmerobotics.roadrunner.drive.MecanumDrive
-
setMotorPowers
public void setMotorPowers(double v, double v1, double v2, double v3) Description copied from interface:RRMecanumDrivePlease use applyDTS() instead. This only exists for compatibility with stuff written for SampleMecanumDrive.- Specified by:
setMotorPowersin interfaceRRMecanumDrive- Specified by:
setMotorPowersin classcom.acmerobotics.roadrunner.drive.MecanumDrive
-
getRawExternalHeading
public double getRawExternalHeading()Description copied from interface:RRMecanumDriveUse your robot's FriendlyIMU instead. This exists only to match SampleMecanumDrive.- Specified by:
getRawExternalHeadingin interfaceRRMecanumDrive- Specified by:
getRawExternalHeadingin classcom.acmerobotics.roadrunner.drive.Drive
-
getExternalHeadingVelocity
Description copied from interface:RRMecanumDriveUse your robot's FriendlyIMU instead. This exists only to match SampleMecanumDrive.- Specified by:
getExternalHeadingVelocityin interfaceRRMecanumDrive- Overrides:
getExternalHeadingVelocityin classcom.acmerobotics.roadrunner.drive.Drive
-
getVelocityConstraint
public com.acmerobotics.roadrunner.trajectory.constraints.TrajectoryVelocityConstraint getVelocityConstraint(double maxVel, double maxAngularVel, double trackWidth) - Specified by:
getVelocityConstraintin interfaceRRMecanumDrive
-
getAccelerationConstraint
public com.acmerobotics.roadrunner.trajectory.constraints.TrajectoryAccelerationConstraint getAccelerationConstraint(double maxAccel) - Specified by:
getAccelerationConstraintin interfaceRRMecanumDrive
-
setDrivePower
public void setDrivePower()Description copied from interface:RRMecanumDrivePlease use applyDTS() instead. This only exists for compatibility with stuff written for RoadRunner's MecanumDrive.- Specified by:
setDrivePowerin interfaceRRMecanumDrive
-
setDriveSignal
public void setDriveSignal()- Specified by:
setDriveSignalin interfaceRRMecanumDrive
-
setDrivePower
public void setDrivePower(@NotNull com.acmerobotics.roadrunner.geometry.Pose2d drivePower) - Overrides:
setDrivePowerin classcom.acmerobotics.roadrunner.drive.MecanumDrive
-
setDriveSignal
public void setDriveSignal(@NotNull com.acmerobotics.roadrunner.drive.DriveSignal driveSignal) - Overrides:
setDriveSignalin classcom.acmerobotics.roadrunner.drive.MecanumDrive
-