purduesigbots / pros

Source code for PROS kernel: open source C/C++ development for the VEX V5 microcontroller
https://pros.cs.purdue.edu
Other
259 stars 76 forks source link

✨[FEATURE REQUEST] Get velocity for `adi::Encoder` #622

Open Tropix126 opened 9 months ago

Tropix126 commented 9 months ago

Is your feature request related to a problem? Please describe. Three wire Encoders seem to natively support reporting velocity data through the SDK, as is evident from vex::encoder::velocity. The relevant libv5rt function seems to be vexAbsEncVelocityGet. It'd be nice if PROS supported this device functionality, since the data is available but never used or reported.

What is the behavior that isn't addressed by the existing API? There's currently no way to get the velocity of a three-wire encoder without manually differentiating the position value through a custom implementation.

OPTIONAL Describe any solutions you've considered Create a adi::Encoder::get_velocity() method similar to v5::Motor::get_actual_velocity or v5::Rotation::get_velocity that returns the velocity value reported from the sensor

Additional context None

WillXuCodes commented 8 months ago

vexAbsEncVelocityGet from what I remember is the Rotation sensor's velocity. This is something we'd have to discuss in terms of the most optimized way of doing it.

For a potential dev in the future working on this: Registry provides a scratch register that you can write values to and from, it's just not big by any means and has to be divided among all the ADI ports... do with that what you will.