Files
allwpilib/wpimath/src/main/python/semiwrap/TrajectoryConstraint.yml
PJ Reiniger 40fb9ff562 [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>
2025-12-31 09:06:01 -08:00

36 lines
1.3 KiB
YAML

classes:
wpi::math::TrajectoryConstraint:
force_type_casters:
- wpi::units::meters_per_second_squared
methods:
TrajectoryConstraint:
MaxVelocity:
MinMaxAcceleration:
wpi::math::TrajectoryConstraint::MinMax:
attributes:
minAcceleration:
maxAcceleration:
inline_code: |
.def(py::init([](
wpi::units::meters_per_second_squared_t minAcceleration,
wpi::units::meters_per_second_squared_t maxAcceleration) {
return wpi::math::TrajectoryConstraint::MinMax{minAcceleration, maxAcceleration};
}), py::arg("minAcceleration"), py::arg("maxAcceleration"))
.def("__len__", [](const wpi::math::TrajectoryConstraint::MinMax& self) { return 2; })
.def("__getitem__", [](const wpi::math::TrajectoryConstraint::MinMax& self, int index) {
switch (index) {
case 0:
return self.minAcceleration;
case 1:
return self.maxAcceleration;
default:
throw std::out_of_range("TrajectoryConstraint.MinMax index out of range");
}
})
.def("__repr__", [](const wpi::math::TrajectoryConstraint::MinMax &self) {
return py::str("TrajectoryConstraint.MinMax(minAcceleration={}, maxAcceleration={})").format(
self.minAcceleration, self.maxAcceleration);
})