The Thrifty Nova provides various ways to set the output of the motor, percent, positional, and velocity control. The following examples highlight various applications of these three control modes.
Simplest control mode - directly sets motor power:
Moves to specific encoder positions using PID control:
Maintains specific speeds using PID control:
Configure encoder type with useEncoderType()
(Optional) Set initial position with setEncoderPosition()
Use control methods:
setPercent()
for direct power control
setPosition()
for position control (requires PID)
setVelocity()
for velocity control (requires PID)
Read feedback with:
getPosition()
for current position
getVelocity()
for current speed
Position and velocity units are always in encoder-native units
Use the Conversion
class to convert between encoder units and real-world units
Position/velocity control require properly configured PID
setPosition()
sets a target for closed-loop control
getPosition()
reads the actual measured position
Current readings are always in amps
All encoder readings are relative to the last setEncoderPosition()
call