The Falcon 500s use weird units that are hard to work with: encoder tics for position and encoder tics per 100ms for velocity.
Let's add new unit types for these so we can implicitly convert to and from nice units like meters, degrees and meters per second.
Use https://github.com/nholthaus/units#unit-definition-macros
Note that units will need to be mechanism specific. for example, a Drive Base speed unit type using the falcons will need to take into account the gear ratio and wheel size:
The Falcon 500s use weird units that are hard to work with: encoder tics for position and encoder tics per 100ms for velocity. Let's add new unit types for these so we can implicitly convert to and from nice units like meters, degrees and meters per second. Use https://github.com/nholthaus/units#unit-definition-macros Note that units will need to be mechanism specific. for example, a Drive Base speed unit type using the falcons will need to take into account the gear ratio and wheel size:
metersPerSecToWheelRotationsPerSec = 1/WHEEL_CIRCUMFERENCE metersPerSecToMotorRotationsPerSec = metersPerSecToWheelRotationsPerSec / GEAR_RATIO metersPerSecToFalconTicsPerSec = metersPerSecToMotorRotationsPerSec FALCON_TICS_PER_ROTATION metersPerSecToFalconTicsPerMillisec = metersPerSecToFalconTicsPerSec / 1000 metersPerSecToFalconTicsPer100Milliseconds = metersPerSecToFalconTicsPerMillisec 100
UNIT_ADD(length, falconSwerveSpeed, unit<std::ratio<1, metersPerSecToFalconTicsPer100Milliseconds>, meters_per_second>)