mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[copybara] mostrobotpy to allwpilib (#8503)
Resync with `mostrobotpy` This mostly involves the big "ignore almost everything in the HAL project" and some fixups for the Addressable LED classes. Required two small hand fixes to get it building over here with bazel, and with more compiler warnings on. I also manually zeroed out the `repo_url` field in the toml files to avoid unnecessary churn whenever it goes from a release build to a development build. I already did this with `version` field in there, and will do a follow up PR that updates the copybara script to do it automatically. --------- Co-authored-by: Default email <default@default.com>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
wpi::math::MecanumDriveWheelAccelerations:
|
||||
force_no_default_constructor: true
|
||||
force_type_casters:
|
||||
- wpi::units::meters_per_second_squared
|
||||
attributes:
|
||||
frontLeft:
|
||||
frontRight:
|
||||
rearLeft:
|
||||
rearRight:
|
||||
methods:
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const MecanumDriveWheelAccelerations& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
|
||||
inline_code: |
|
||||
cls_MecanumDriveWheelAccelerations
|
||||
.def(
|
||||
py::init<
|
||||
wpi::units::meters_per_second_squared_t, wpi::units::meters_per_second_squared_t, wpi::units::meters_per_second_squared_t, wpi::units::meters_per_second_squared_t
|
||||
>(),
|
||||
py::arg("frontLeft") = 0, py::arg("frontRight") = 0, py::arg("rearLeft") = 0, py::arg("rearRight") = 0
|
||||
)
|
||||
.def_static("fromFps", [](wpi::units::feet_per_second_squared_t frontLeft,
|
||||
wpi::units::feet_per_second_squared_t frontRight,
|
||||
wpi::units::feet_per_second_squared_t rearLeft,
|
||||
wpi::units::feet_per_second_squared_t rearRight){
|
||||
return MecanumDriveWheelAccelerations{frontLeft, frontRight, rearLeft, rearRight};
|
||||
}, py::arg("frontLeft") = 0, py::arg("frontRight") = 0, py::arg("rearLeft") = 0, py::arg("rearRight") = 0)
|
||||
.def_property("front_left_fpss",
|
||||
[](MecanumDriveWheelAccelerations * self) -> wpi::units::feet_per_second_squared_t {
|
||||
return self->frontLeft;
|
||||
},
|
||||
[](MecanumDriveWheelAccelerations * self, wpi::units::feet_per_second_squared_t frontLeft) {
|
||||
self->frontLeft = frontLeft;
|
||||
}
|
||||
)
|
||||
.def_property("front_right_fpss",
|
||||
[](MecanumDriveWheelAccelerations * self) -> wpi::units::feet_per_second_squared_t {
|
||||
return self->frontRight;
|
||||
},
|
||||
[](MecanumDriveWheelAccelerations * self, wpi::units::feet_per_second_squared_t frontRight) {
|
||||
self->frontRight = frontRight;
|
||||
}
|
||||
)
|
||||
.def_property("rear_left_fpss",
|
||||
[](MecanumDriveWheelAccelerations * self) -> wpi::units::feet_per_second_squared_t {
|
||||
return self->rearLeft;
|
||||
},
|
||||
[](MecanumDriveWheelAccelerations * self, wpi::units::feet_per_second_squared_t rearLeft) {
|
||||
self->rearLeft = rearLeft;
|
||||
}
|
||||
)
|
||||
.def_property("rear_right_fpss",
|
||||
[](MecanumDriveWheelAccelerations * self) -> wpi::units::feet_per_second_squared_t {
|
||||
return self->rearRight;
|
||||
},
|
||||
[](MecanumDriveWheelAccelerations * self, wpi::units::feet_per_second_squared_t rearRight) {
|
||||
self->rearRight = rearRight;
|
||||
}
|
||||
)
|
||||
.def("__repr__", [](const MecanumDriveWheelAccelerations &mdwa) -> std::string {
|
||||
return "MecanumDriveWheelAccelerations(frontLeft=" + std::to_string(mdwa.frontLeft()) + ", "
|
||||
"frontRight=" + std::to_string(mdwa.frontRight()) + ", "
|
||||
"rearLeft=" + std::to_string(mdwa.rearLeft()) + ", "
|
||||
"rearRight=" + std::to_string(mdwa.rearRight()) + ")";
|
||||
})
|
||||
;
|
||||
|
||||
SetupWPyStruct<wpi::math::MecanumDriveWheelAccelerations>(cls_MecanumDriveWheelAccelerations);
|
||||
Reference in New Issue
Block a user