Unit Conversions
The Thrifty Nova position and velocity feedback methods return using encoder units. Closed loop control uses these units as well. However oftentimes programmers want to convert to a more user friendly unit. For this we can use the Conversion
class.
Creating a Conversion Object
We can create a converter by providing a human readable unit from the PositionUnit
or VelocityUnit
types, and the EncoderType
of the encoder we are using.
Available Units
Position Units
RADIANS
Angular position in radians
Mathematical calculations, arms
DEGREES
Angular position in degrees
Human-readable angles, swerve modules
ROTATIONS
Complete rotations
Wheel rotations, continuous mechanisms
Velocity Units
RADIANS_PER_SEC
Angular velocity in radians/s
Mathematical calculations
DEGREES_PER_SEC
Angular velocity in degrees/s
Angular motion control
ROTATIONS_PER_SEC
Rotations per second
High-speed mechanisms
ROTATIONS_PER_MIN
Rotations per minute
Shooters, intakes
Using the Conversion Object
To convert to encoder units for setting a value we use the toMotor
method.
To convert from encoder units for reading a value we use the fromMotor
method.
To Motor Units (for Setting Values)
From Motor Units (for Reading Values)
Last updated