CartesianMecanumDrive

Class for a Cartesian drive system that uses Mecanum wheels. Includes all the common math done across all Mecanum drive systems.

This system is deprecated by RoadRunner, but remains for legacy/non-RoadRunner purposes. Coordinates used in Cartesian drives include a Cartesian speed mapping, where X is the horizontal axis, and Y is the forward axis. This is rotated differently within RoadRunner-derived drive bases.

Author

Lucas Bubner, 2023

Since

1.0.0-pre

See also

Inheritors

Constructors

Link copied to clipboard
constructor(frontLeft: DcMotor, frontRight: DcMotor, backLeft: DcMotor, backRight: DcMotor)

Types

Link copied to clipboard
Mecanum control prioritisation.

Properties

Link copied to clipboard
open var speedR: Double
Rotational speed of the robot.
Link copied to clipboard
open var speedX: Double
Horizontal speed of the robot.
Link copied to clipboard
open var speedY: Double
Vertical speed of the robot.

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
open fun calculateRotationPrioritisedPowers(speedX: Double, speedY: Double, speedR: Double): Array<Double>
Calculate Mecanum drive powers with rotational prioritisation.
Link copied to clipboard
protected open fun periodic()
Update and reflect the speed of the drive system to the actual motors, and calculate the motor powers based on these variables.
Link copied to clipboard
open fun setMode(mode: DcMotor.RunMode): CartesianMecanumDrive
Set the drive system mode.
Link copied to clipboard
Link copied to clipboard
open fun setSpeedPolarR(speed: Double, direction: Measure<Angle>, rSpeed: Double): CartesianMecanumDrive
Set a polar speed at which the Mecanum drive assembly should move.
Link copied to clipboard
open fun setSpeedUsingController(left_stick_x: Double, left_stick_y: Double, right_stick_x: Double): CartesianMecanumDrive
Set a speed at which the Mecanum drive assembly should move using controller input.
Link copied to clipboard
Set a speed at which the Mecanum drive assembly should move.
Link copied to clipboard
Set the drive system to brake.
Link copied to clipboard
Set the drive system to float.
Link copied to clipboard
open fun stop()
Immediately stop the drive system.
Link copied to clipboard
Swap the priority of the drive system.

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
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
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
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
Set the current task to the given task, overriding any current task.
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
Call to stop delegating updates of this subsystem to a thread.
Link copied to clipboard
Link copied to clipboard
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
fun <T : BunyipsSubsystem?> withName(@NonNull subsystemName: String): T
Set the name of this subsystem that will be used in telemetry and references.