move
Moves the motor using the locked control type.
The control type was specified during initialization and cannot be changed. The meaning of the value depends on the locked control type:
PWM: Duty cycle from -1.0 to 1.0
VOLTAGE: Voltage in Volts
POSITION: Target position in rotations
VELOCITY: Target velocity in rotations per second
Usage Examples:
PWM Control (Duty Cycle: -1.0 to 1.0)
val motor = Mongu(TalonFX(1), control = ControlType.PWM)
motor.move(0.5) // 50% forward
motor.move(-0.3) // 30% reverse
motor.move(0.0) // stop
Content copied to clipboard
Voltage Control (in Volts)
val motor = Mongu(TalonFX(1), control = ControlType.VOLTAGE)
motor.move(12.0) // 12V forward
motor.move(-6.0) // 6V reverse
motor.move(0.0) // stop
Content copied to clipboard
Position Control (in rotations or encoder units)
val motor = Mongu(TalonFX(1), control = ControlType.POSITION)
motor.move(10.0) // move to position 10
motor.move(-5.5) // move to position -5.5
Content copied to clipboard
Velocity Control (in rotations per second)
val motor = Mongu(TalonFX(1), control = ControlType.VELOCITY)
motor.move(150.0) // move at 150 RPS
motor.move(-75.0) // move at -75 RPS
Content copied to clipboard
Motor Support Matrix:
TalonFX: Supports PWM, Voltage, Position, and Velocity control
PWMTalonSRX: Supports PWM control only
PWMSparkMax: Supports PWM control only
Parameters
value
The control value (meaning depends on locked control type).
Throws
If the control type is not supported for the current motor type.