interface DriveMotors
Public interface representing the set of methods every single drive system is guaranteed to implement. For example, both a regular two wheel drive and a mecanum drive implement these same methods. This makes it useful for creating op modes that work for both systems.
Throughout DriveMotors and its subclasses, you will find methods referring to two similar yet distinct concepts: power and speed. Power refers to driving a motor by sending a given amount of power to it. Speed refers to intelligently controlling a motor by constantly making adjustments to power so that the motor moves in a consistent manner. Power does not require an encoder; speed does.
You do not construct DriveMotors directly; instead, you use one of its subclasses.
abstract fun forwardWithPower(power: Double): Unit
Steers the drive forward or reverse at a given power (i.e. without encoder). |
|
abstract fun forwardWithSpeed(speed: Double): Unit
Steers the drive forward or reverse at a given speed (i.e. with encoder). |
|
abstract fun getMotors(): Array<DcMotor>
Returns the underlying motors that this DriveMotors instance represents. |
|
abstract fun steerWithPower(power: Double, turn: Double): Unit
Steers the drive in a given direction at a given power (i.e. without encoder). |
|
abstract fun steerWithSpeed(speed: Double, turn: Double): Unit
Steers the drive in a given direction at a given speed (i.e. with encoder). |
|
abstract fun stop(): Unit
Stops the drive. What could be simpler? |
open class MecanumDrive : DriveMotors
Class representing four DcMotors that comprise a Mecanum drive; in other words, the drive we're using on our robot. |
|
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. |