TeamCode / org.firstinspires.ftc.teamcode.movement / TwoWheelDrive

TwoWheelDrive

open class TwoWheelDrive : DriveMotors

Class representing a simple, run-of-the-mill two wheel drive. We used to use this; now we are not.

This was one of the earliest classes made this year; I apologize in advance for the poor coding in this class.

Author
anli5005

Constructors

<init>

TwoWheelDrive(leftDrive: DcMotor, rightDrive: DcMotor)

Constructs a TwoWheelDrive using two DcMotors.

Properties

leftDrive

var leftDrive: DcMotor

The DcMotor mounted to the robot's left wheel.

powerMultiplier

var powerMultiplier: Double

Number at which to multiply any powers passed in by. Useful for reversing a TwoWheelDrive.

rightDrive

var rightDrive: DcMotor

The DcMotor mounted to the robot's right wheel

Functions

forwardWithPower

open fun forwardWithPower(power: Double): Unit

forwardWithSpeed

open fun forwardWithSpeed(speed: Double): Unit

getMotors

open fun getMotors(): Array<DcMotor>

isBusy

open fun isBusy(): Boolean

moveFor

open fun moveFor(left: Int, right: Int, leftPower: Double, rightPower: Double): Unit
open fun moveFor(amount: Int, power: Double): Unit

reset

open fun reset(): Unit

Stops and resets each of the motors and their encoders.

setDirections

open fun setDirections(left: Direction, right: Direction): Unit

Calls setDirection on each of the DcMotors.

setLeftMode

open fun setLeftMode(mode: RunMode): Unit

Sets the left motor to a given mode.

setLeftPower

open fun setLeftPower(power: Double): Unit

Moves the left motor at a given power (i.e. without encoder).

setLeftSpeed

open fun setLeftSpeed(speed: Double): Unit

Moves the left motor at a given speed (i.e. with encoder).

setMotorMode

open fun setMotorMode(mode: RunMode): Unit

Sets both motors to a given mode.

setPowers

open fun setPowers(left: Double, right: Double): Unit

Moves both motors at given powers (i.e. without encoder).

setRightMode

open fun setRightMode(mode: RunMode): Unit

Sets the right motor to a given mode.

setRightPower

open fun setRightPower(power: Double): Unit

Moves the right motor at a given power (i.e. without encoder).

setRightSpeed

open fun setRightSpeed(speed: Double): Unit

Moves the right motor at a given speed (i.e. with encoder).

setSpeeds

open fun setSpeeds(left: Double, right: Double): Unit

Moves both motors at given speeds (i.e. with encoder).

standard

open static fun standard(hardwareMap: HardwareMap): TwoWheelDrive

Given only a hardware map, constructs a ready-to-use two wheel drive with preset motors and parameters.

steerWithPower

open fun steerWithPower(power: Double, turn: Double): Unit

steerWithSpeed

open fun steerWithSpeed(speed: Double, turn: Double): Unit

stop

open fun stop(): Unit

waitUntilAvailable

open fun waitUntilAvailable(): Unit