Skip to content

Commit 06e2b0f

Browse files
committed
Add compatibility methods to DCMotorSim
- Fixes #104
1 parent 3c74b55 commit 06e2b0f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

subprojects/robotpy-wpilib/gen/simulation/DCMotorSim.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ classes:
1919
GetAngularAcceleration:
2020
GetTorque:
2121
GetInputVoltage:
22-
Gearbox:
23-
Gearing:
24-
J:
22+
GetGearbox:
23+
GetGearing:
24+
GetJ:
25+
26+
inline_code: |
27+
cls_DCMotorSim
28+
// java API compatibility
29+
.def("getAngularPositionRotations", [](const DCMotorSim &self) {
30+
return units::turn_t{self.GetAngularPosition()};
31+
}, py::doc("Returns the DC motor position in rotations"))
32+
.def("getAngularVelocityRPM", [](const DCMotorSim &self) {
33+
return units::revolutions_per_minute_t{self.GetAngularVelocity()};
34+
}, py::doc("Returns the DC motor velocity in revolutions per minute"))
35+
;

0 commit comments

Comments
 (0)