CrossTheRoadElec / Phoenix-Releases

Release repository for Phoenix-Framework and Phoenix-Tuner
79 stars 6 forks source link

Feature Request: WPILib Measures getters and setters #79

Closed TaylerUva closed 1 month ago

TaylerUva commented 8 months ago

WPILib provides a Units and Measures class. Phoenix classes should provide getters and setters for WPILib Measures allowing the conversions to be done in the back end.

For example TalonFX.setPosition is accepts a position in rotations as a double:

StatusCode com.ctre.phoenix6.hardware.core.CoreTalonFX.setPosition(double newValue)

If it instead accepts a Measure a team could provide a value in degrees or radians the back end would automatically convert it to Rotations.

This would work great in combination with the existing Feedback.SensorToMechanismRatio as TalonFX.getPosition() could be returned in Unit.Rotations and be easily converted to degrees

StatusSignal<Double> com.ctre.phoenix6.hardware.core.CoreTalonFX.getPosition()

The overall goal of this request is reduce the amount of unit conversion errors.

JCaporuscio commented 8 months ago

This is something we'll probably look at in the off-season - Units and Measures weren't available in WPILib early enough for us to evaluate implementing it for use this season.

We do want units to be easily manageable though, so this is a good candidate for potential integration over the summer.

daltzctr commented 1 month ago

Fixed in beta 1