mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[robotpy] Mirror most other subprojects (#8208)
GitOrigin-RevId: ac60fd3cf4a24023184376687da28373d14b781a This mirrors the robotpy files for the following projects: - apriltag - datalog - hal - ntcore - romiVendordep - wpilibc - wpimath - xrpVendordep This excludes cscore and the halsim wrappers for at this time. NOTE: This does not hook these projects up to the build system, just simply mirrors the files. The building will take place in a follow up PR to make it easier to review the changes necessary to build.
This commit is contained in:
78
wpimath/src/main/python/semiwrap/geometry/Translation2d.yml
Normal file
78
wpimath/src/main/python/semiwrap/geometry/Translation2d.yml
Normal file
@@ -0,0 +1,78 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
- pybind11/eigen.h
|
||||
|
||||
functions:
|
||||
to_json:
|
||||
ignore: true
|
||||
from_json:
|
||||
ignore: true
|
||||
classes:
|
||||
frc::Translation2d:
|
||||
methods:
|
||||
Translation2d:
|
||||
overloads:
|
||||
'':
|
||||
units::meter_t, units::meter_t:
|
||||
units::meter_t, const Rotation2d&:
|
||||
const Eigen::Vector2d&:
|
||||
Distance:
|
||||
X:
|
||||
Y:
|
||||
ToVector:
|
||||
Norm:
|
||||
Angle:
|
||||
RotateBy:
|
||||
RotateAround:
|
||||
Nearest:
|
||||
overloads:
|
||||
std::span<const Translation2d> [const]:
|
||||
std::initializer_list<Translation2d> [const]:
|
||||
ignore: true
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const Translation2d& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
|
||||
inline_code: |
|
||||
cls_Translation2d
|
||||
.def_static("fromFeet", [](units::foot_t x, units::foot_t y){
|
||||
return std::make_unique<Translation2d>(x, y);
|
||||
}, py::arg("x"), py::arg("y"))
|
||||
.def_static("fromFeet", [](units::foot_t distance, const Rotation2d &angle) {
|
||||
return std::make_unique<Translation2d>(distance, angle);
|
||||
}, py::arg("distance"), py::arg("angle"))
|
||||
.def_property_readonly("x", &Translation2d::X)
|
||||
.def_property_readonly("y", &Translation2d::Y)
|
||||
.def_property_readonly("x_feet", [](Translation2d * self) -> units::foot_t {
|
||||
return self->X();
|
||||
})
|
||||
.def_property_readonly("y_feet", [](Translation2d * self) -> units::foot_t {
|
||||
return self->Y();
|
||||
})
|
||||
.def("distanceFeet", [](Translation2d * self, const Translation2d &other) -> units::foot_t {
|
||||
return self->Distance(other);
|
||||
})
|
||||
.def("normFeet", [](Translation2d * self) -> units::foot_t {
|
||||
return self->Norm();
|
||||
})
|
||||
.def("__abs__", &Translation2d::Norm)
|
||||
.def("__len__", [](const Translation2d& self) { return 2; })
|
||||
.def("__getitem__", [](const Translation2d& self, int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return self.X();
|
||||
case 1:
|
||||
return self.Y();
|
||||
default:
|
||||
throw std::out_of_range("Translation2d index out of range");
|
||||
}
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Translation2d&>(&rpy::toString));
|
||||
|
||||
SetupWPyStruct<frc::Translation2d>(cls_Translation2d);
|
||||
Reference in New Issue
Block a user