TriDeadwheelMecanumDrive

MecanumDrive with three tracking dead wheels for localization. This is a convenience class to update the localizer on construction. It functions exactly as a MecanumDrive.

Author

Lucas Bubner, 2023

Since

1.0.0-pre

See also

Constructors

Link copied to clipboard
constructor(constants: DriveConstants, mecanumCoefficients: MecanumCoefficients, @Nullable imu: IMU, frontLeft: DcMotor, frontRight: DcMotor, backLeft: DcMotor, backRight: DcMotor, localizerCoefficients: ThreeWheelLocalizer.Coefficients, enc_left: Deadwheel, enc_right: Deadwheel, enc_x: Deadwheel, lastTrackingEncPositions: List<Integer>, lastTrackingEncVels: List<Integer>)
Create a new TriDeadwheelMecanumDrive
constructor(constants: DriveConstants, mecanumCoefficients: MecanumCoefficients, imu: IMU, frontLeft: DcMotor, frontRight: DcMotor, backLeft: DcMotor, backRight: DcMotor, localizerCoefficients: ThreeWheelLocalizer.Coefficients, enc_left: Deadwheel, enc_right: Deadwheel, enc_x: Deadwheel)
Create a new TriDeadwheelMecanumDrive

Inherited properties

Link copied to clipboard
open var currentTask: Task
Link copied to clipboard
protected open var name: String
Link copied to clipboard
protected val opMode: BunyipsOpMode

Functions

Link copied to clipboard
Enable overflow compensation if your encoders exceed 32767 counts / second.

Inherited functions

Link copied to clipboard
protected fun assertParamsNotNull(parameters: Array<Any>): Boolean
Utility function to run NullSafety.assertComponentArgs() on the given parameters, usually on the motors/hardware/critical objects passed into the constructor.
Link copied to clipboard
Cancel the current task immediately and return to the default task, if available.
Link copied to clipboard
open fun cancelTrajectory()
Abort the current trajectory.
Link copied to clipboard
fun disable()
Prevent a subsystem from running.
Link copied to clipboard
fun enable()
Re-enable a subsystem if it was previously disabled via a disable() call.
Link copied to clipboard
open fun followTrajectory(trajectory: Trajectory)
Follow a trajectory.
Link copied to clipboard
open fun followTrajectoryAsync(trajectory: Trajectory)
Follow a trajectory asynchronously.
Link copied to clipboard
open fun followTrajectorySequence(trajectorySequence: TrajectorySequence)
Follow a trajectory sequence.
Link copied to clipboard
Follow a trajectory sequence asynchronously.
Link copied to clipboard
open fun getAccelerationConstraint(maxAccel: Double): TrajectoryAccelerationConstraint
Get an acceleration constraint for the drive.
Link copied to clipboard
Link copied to clipboard
Get the drive constants related to this drive.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getLastError(): Pose2d
Get the last reported pose error from the drive.
Link copied to clipboard
open fun getLocalizer(): Localizer
Link copied to clipboard
Link copied to clipboard
open fun getPoseEstimate(): Pose2d
Link copied to clipboard
open fun getPoseVelocity(): Pose2d
Link copied to clipboard
Link copied to clipboard
Get the attached TrajectorySequenceRunner for this drive.
Link copied to clipboard
open fun getVelocityConstraint(maxVel: Double, maxAngularVel: Double, trackWidth: Double): TrajectoryVelocityConstraint
Get a velocity constraint for the drive.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isBusy(): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Determine if the subsystem is idle, meaning an IdleTask is running.
Link copied to clipboard
protected open fun onDisable()
User callback that runs once when this subsystem is disabled by a call to disable or by an assertion failure.
Link copied to clipboard
protected open fun onEnable()
User callback that runs once when this subsystem is enabled by a call to enable or the first active call to periodic.
Link copied to clipboard
protected open fun periodic()
To be updated periodically on every hardware loop.
Link copied to clipboard
open fun resetYaw()
Reset the IMU's yaw to 0.
Link copied to clipboard
fun setDefaultTask(defaultTask: Task)
Set the default task for this subsystem, which will be run when no other task is running.
Link copied to clipboard
open fun setDrivePower(drivePower: Pose2d)
Set a drive power.
Link copied to clipboard
open fun setDriveSignal(driveSignal: DriveSignal)
Set a drive velocity and/or acceleration target.
Link copied to clipboard
open fun setExternalHeading(value: Double)
Assert the heading of the robot.
Link copied to clipboard
Set the current task to the given task, overriding any current task.
Link copied to clipboard
open fun setLocalizer(localizer: Localizer)
Set the new localizer to use.
Link copied to clipboard
open fun setMode(runMode: DcMotor.RunMode)
Set the run mode of all motors.
Link copied to clipboard
open fun setMotorPowers(powers: Array<Double>)
Set the motor powers for each motor on this drive.
Link copied to clipboard
open fun setPIDFCoefficients(runMode: DcMotor.RunMode, coefficients: PIDFCoefficients)
Set the PIDF coefficients for the drive motors.
Link copied to clipboard
open fun setPoseEstimate(value: Pose2d)
Assert the position of the robot.
Link copied to clipboard
open fun setRotationPriorityWeightedDrivePower(drivePowerRotationPriority: Pose2d)
Set a drive power with axial weights.
Link copied to clipboard
For continuity, keep setSpeedUsingController for setting drive speeds.
Link copied to clipboard
open fun setWeightedDrivePower(drivePower: Pose2d)
Set a drive power with axial weights.
Link copied to clipboard
open fun setZeroPowerBehavior(zeroPowerBehavior: DcMotor.ZeroPowerBehavior)
Set the zero power behaviour of all motors.
Link copied to clipboard
fun startThread(loopSleepDuration: Measure<Time>)
Call to delegate all updates of this subsystem to a thread that will begin execution on this method call.
Link copied to clipboard
open fun stop()
Cleanup and store the last pose estimate in global storage, while stopping the motors.
Link copied to clipboard
Call to stop delegating updates of this subsystem to a thread.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun trajectoryBuilder(startPose: Pose2d): TrajectoryBuilder
open fun trajectoryBuilder(startPose: Pose2d, reversed: Boolean): TrajectoryBuilder
open fun trajectoryBuilder(startPose: Pose2d, startHeading: Double): TrajectoryBuilder
Get a trajectory builder for the drive.
Link copied to clipboard
Get a trajectory sequence builder for the drive.
Link copied to clipboard
open fun turn(angle: Double)
Turn the drive.
Link copied to clipboard
open fun turnAsync(angle: Double)
Turn the drive asynchronously.
Link copied to clipboard
fun update()
Update the subsystem and run the current task, if tasks are not set up this will just call periodic.
Link copied to clipboard
open fun updateAll()
Update all instances of BunyipsSubsystem that has been constructed since the last clearing.
Link copied to clipboard
Update the pose estimate of the drive.
Link copied to clipboard
Set a remembered pose from memory in another OpMode.
Link copied to clipboard
Call to use the MecanumLocalizer as a backup localizer alongside the current localizer.
open fun useFallbackLocalizer(fallback: Localizer): SwitchableLocalizer
Call to set a fallback localizer that can be switched/tested to as part of the SwitchableLocalizer.
Link copied to clipboard
open fun waitForIdle()
Run current trajectory blocking until it is complete.
Link copied to clipboard
fun <T : BunyipsSubsystem?> withName(@NonNull subsystemName: String): T
Set the name of this subsystem that will be used in telemetry and references.