MotorFactory

class MotorFactory(name: String)

Constructors

Link copied to clipboard
fun MotorFactory(name: String)

Properties

Link copied to clipboard
val brake: MotorFactory

Set the motor mode to brake

Link copied to clipboard
val float: MotorFactory

Set the motor mode to float

Link copied to clipboard
val forward: MotorFactory

Set this motor's direction to forward (NOTE: Does not change encoder direction)

Link copied to clipboard
val highPriority: MotorFactory

Incrase the priority of the motor, updating it at normal speed

Link copied to clipboard
val lowPriority: MotorFactory

Lower the priority of the motor, updating it 3x slower than the control loop

Link copied to clipboard
val reverse: MotorFactory

Set this motor's direction to reverse (NOTE: Does not change encoder direction)

Link copied to clipboard
val voltageCorrected: MotorFactory

Enable voltage correction

Functions

Link copied to clipboard
fun build(): KMotor

Build the motor from the motor factory

Link copied to clipboard
fun createEncoder(encoderFactory: EncoderFactory): MotorFactory

Created an encoder association with this motor

Link copied to clipboard
fun pairEncoder(motor: KMotor, encoderFactory: EncoderFactory): MotorFactory

Pair this motor's encoder with another motor's encoder

Link copied to clipboard
fun withMotionProfileControl(    pidGains: PIDGains,     ffGains: FFGains,     constraints: MotionConstraints,     allowedPositionError: Double,     disabledPosition: Double? = null): MotorFactory

Enable motion profile control in the motor

Link copied to clipboard
fun withPositionControl(    pidGains: PIDGains,     ffGains: FFGains,     allowedPositionError: Double,     disabledPosition: Double? = null,     bounds: Bounds = Bounds()): MotorFactory

Enable position PID control in the motor

Link copied to clipboard
fun withStaticFeedforward(ks: Double): MotorFactory

Add a static feedforward term to the motor. This is included in motor power calculatiosn regardless of motor mode (e.g. a motor with MotorControlModes.OPEN_LOOP with still calculate static feedforward). Used to deal with motor problems.

Link copied to clipboard
fun withVelocityControl(    pidGains: PIDGains,     kF: Double,     allowedVelocityError: Double): MotorFactory

Enable velocity PID control in the motor