[wpimath] Reorganize LinearSystem factories (#8468)

This commit is contained in:
Tyler Veness
2026-01-12 19:09:35 -08:00
committed by GitHub
parent 89d0759ef2
commit 00fa8361dd
108 changed files with 1808 additions and 2138 deletions

View File

@@ -10,10 +10,6 @@ classes:
wpi::units::volt_t, wpi::units::volt_t, wpi::units::unit_t<kv_unit>, wpi::units::unit_t<ka_unit>:
Calculate:
overloads:
wpi::units::unit_t<Velocity>, wpi::units::unit_t<Acceleration> [const]:
ignore: true
wpi::units::unit_t<Velocity>, wpi::units::unit_t<Velocity>, wpi::units::second_t [const]:
ignore: true
wpi::units::unit_t<Velocity> [const]:
wpi::units::unit_t<Velocity>, wpi::units::unit_t<Velocity> [const]:
MaxAchievableVelocity:

View File

@@ -1,59 +0,0 @@
classes:
wpi::math::LinearSystemId:
typealias:
- kv_meters = wpi::units::unit_t<wpi::units::compound_unit<wpi::units::volts, wpi::units::inverse<wpi::units::meters_per_second>>>
- kv_radians = wpi::units::unit_t<wpi::units::compound_unit<wpi::units::volts, wpi::units::inverse<wpi::units::radians_per_second>>>
- ka_meters = wpi::units::unit_t<wpi::units::compound_unit<wpi::units::volts, wpi::units::inverse<wpi::units::meters_per_second_squared>>>
- ka_radians = wpi::units::unit_t<wpi::units::compound_unit<wpi::units::volts, wpi::units::inverse<wpi::units::radians_per_second_squared>>>
methods:
ElevatorSystem:
SingleJointedArmSystem:
IdentifyVelocitySystem:
rename: identifyVelocitySystemMeters
cpp_code: |
[](kv_meters kV, ka_meters kA) {
return wpi::math::LinearSystemId::IdentifyVelocitySystem<wpi::units::meter>(kV, kA);
}
IdentifyPositionSystem:
rename: identifyPositionSystemMeters
cpp_code: |
[](kv_meters kV, ka_meters kA) {
return wpi::math::LinearSystemId::IdentifyPositionSystem<wpi::units::meter>(kV, kA);
}
IdentifyDrivetrainSystem:
overloads:
decltype(1_V/1_mps), decltype(1_V/1_mps_sq), decltype(1_V/1_mps), decltype(1_V/1_mps_sq):
cpp_code: |
[](kv_meters kVlinear, ka_meters kAlinear, kv_meters kVangular, ka_meters kAangular) {
return wpi::math::LinearSystemId::IdentifyDrivetrainSystem(kVlinear, kAlinear, kVangular, kAangular);
}
decltype(1_V/1_mps), decltype(1_V/1_mps_sq), decltype(1_V/1_rad_per_s), decltype(1_V/1_rad_per_s_sq), wpi::units::meter_t:
cpp_code: |
[](kv_meters kVlinear, ka_meters kAlinear, kv_radians kVangular, ka_radians kAangular, wpi::units::meter_t trackWidth) {
return wpi::math::LinearSystemId::IdentifyDrivetrainSystem(kVlinear, kAlinear, kVangular, kAangular, trackWidth);
}
FlywheelSystem:
DCMotorSystem:
overloads:
DCMotor, wpi::units::kilogram_square_meter_t, double:
decltype(1_V/Velocity_t<Distance> (1)), decltype(1_V/Acceleration_t<Distance> (1)):
cpp_code: |
[](kv_meters kv, ka_meters ka) {
return wpi::math::LinearSystemId::DCMotorSystem<wpi::units::meter>(kv, ka);
}
DrivetrainVelocitySystem:
inline_code: |
.def_static("DCMotorSystemRadians", [](kv_radians kV, ka_radians kA) {
return wpi::math::LinearSystemId::DCMotorSystem<wpi::units::radian>(kV, kA);
}, py::arg("kV"), py::arg("kA"), release_gil()
)
.def_static("identifyVelocitySystemRadians", [](kv_radians kV, ka_radians kA) {
return wpi::math::LinearSystemId::IdentifyVelocitySystem<wpi::units::radian>(kV, kA);
}, py::arg("kV"), py::arg("kA"), release_gil()
)
.def_static("identifyPositionSystemRadians", [](kv_radians kV, ka_radians kA) {
return wpi::math::LinearSystemId::IdentifyPositionSystem<wpi::units::radian>(kV, kA);
}, py::arg("kV"), py::arg("kA"), release_gil()
)

View File

@@ -0,0 +1,14 @@
classes:
wpi::math::Models:
methods:
FlywheelFromPhysicalConstants:
FlywheelFromSysId:
ElevatorFromPhysicalConstants:
ElevatorFromSysId:
SingleJointedArmFromPhysicalConstants:
SingleJointedArmFromSysId:
DifferentialDriveFromPhysicalConstants:
DifferentialDriveFromSysId:
overloads:
decltype(1_V/1_mps), decltype(1_V/1_mps_sq), decltype(1_V/1_mps), decltype(1_V/1_mps_sq):
decltype(1_V/1_mps), decltype(1_V/1_mps_sq), decltype(1_V/1_rad_per_s), decltype(1_V/1_rad_per_s_sq), wpi::units::meter_t: