robotpy / mostrobotpy

Official Repository of python implementation of WPILib components
https://robotpy.github.io
Other
11 stars 13 forks source link

[BUG]: Missing functions with DCMotorSim #104

Open daltzctr opened 2 weeks ago

daltzctr commented 2 weeks ago

Problem description

WPILib has various getPosition and getVelocity in specified units: https://github.wpilib.org/allwpilib/docs/development/java/edu/wpi/first/wpilibj/simulation/DCMotorSim.html#getAngularVelocity()

but RobotPy is missing getAngularPositionRotations, getAngularVelocityRotations, and maybe other functions: https://robotpy.readthedocs.io/projects/robotpy/en/stable/wpilib.simulation/DCMotorSim.html#wpilib.simulation.DCMotorSim.getAngularVelocity

Operating System

Windows, MacOS, Linux, RoboRIO, Raspbian

Installed Python Packages

No response

Reproducible example code

No response

virtuald commented 2 weeks ago

Those functions do not exist in C++: https://github.com/wpilibsuite/allwpilib/blob/28cb7cf757e8dce89aab6d8181203b665afca62a/wpilibc/src/main/native/include/frc/simulation/DCMotorSim.h#L60

My guess is it's just a unit conversion, so C++ doesn't need them? If you can provide which units you need we can add the corresponding functions.

Edit: I see, Java has the units specified. We can probably add those extra functions too.