wpilibsuite / allwpilib

Official Repository of WPILibJ and WPILibC
https://wpilib.org/
Other
1.03k stars 607 forks source link

Add AnalogEncoder.getAngle #6770

Closed spacey-sooty closed 1 week ago

spacey-sooty commented 1 week ago

Resolves https://github.com/wpilibsuite/allwpilib/issues/4063

The API differs between Java and C++ as C++ having units used everywhere can have one function that implicitly converts between different units vs in Java units need to be explicitly converted. This means C++ has GetAngle and Java has getDegrees and getRadians. Now C++ just has the extra GetAngle function

SamCarlberg commented 1 week ago

Why is this necessary? new AnalogEncoder(port, 2 * Math.PI, 0) already accomplishes the same thing.

ThadHouse commented 1 week ago

Not all analog and duty cycle encoders are angular. Linear versions of both exist. This api makes no sense because of that.

spacey-sooty commented 1 week ago

That would make sense, the issue should be closed then no?