mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
This turns the styleguide on for the non-python robotpy files. The overwhelming amount of changes were related to whitespace, followed by some IWYU for standard library headers.
85 lines
2.6 KiB
YAML
85 lines
2.6 KiB
YAML
extra_includes:
|
|
- wpystruct.h
|
|
|
|
classes:
|
|
wpi::math::ChassisVelocities:
|
|
force_no_default_constructor: true
|
|
attributes:
|
|
vx:
|
|
vy:
|
|
omega:
|
|
methods:
|
|
ToTwist2d:
|
|
Discretize:
|
|
overloads:
|
|
wpi::units::meters_per_second_t, wpi::units::meters_per_second_t, wpi::units::radians_per_second_t, wpi::units::second_t:
|
|
const ChassisVelocities&, wpi::units::second_t:
|
|
operator+:
|
|
operator-:
|
|
overloads:
|
|
const ChassisVelocities& [const]:
|
|
'[const]':
|
|
operator*:
|
|
operator/:
|
|
operator==:
|
|
ToRobotRelative:
|
|
ToFieldRelative:
|
|
|
|
inline_code: |
|
|
cls_ChassisVelocities
|
|
.def(
|
|
py::init<
|
|
wpi::units::meters_per_second_t, wpi::units::meters_per_second_t,
|
|
wpi::units::radians_per_second_t
|
|
>(),
|
|
py::arg("vx") = 0, py::arg("vy") = 0, py::arg("omega") = 0
|
|
)
|
|
.def_static("fromFeet", [](wpi::units::feet_per_second_t vx, wpi::units::feet_per_second_t vy, wpi::units::radians_per_second_t omega){
|
|
return ChassisVelocities{vx, vy, omega};
|
|
}, py::arg("vx") = 0, py::arg("vy") = 0, py::arg("omega") = 0)
|
|
.def_property("vx_fps",
|
|
[](ChassisVelocities * self) -> wpi::units::feet_per_second_t {
|
|
return self->vx;
|
|
},
|
|
[](ChassisVelocities * self, wpi::units::feet_per_second_t vx) {
|
|
self->vx = vx;
|
|
}
|
|
)
|
|
.def_property("vy_fps",
|
|
[](ChassisVelocities * self) -> wpi::units::feet_per_second_t {
|
|
return self->vy;
|
|
},
|
|
[](ChassisVelocities * self, wpi::units::feet_per_second_t vy) {
|
|
self->vy = vy;
|
|
}
|
|
)
|
|
.def_property("omega_dps",
|
|
[](ChassisVelocities * self) -> wpi::units::degrees_per_second_t {
|
|
return self->omega;
|
|
},
|
|
[](ChassisVelocities * self, wpi::units::degrees_per_second_t omega) {
|
|
self->omega = omega;
|
|
}
|
|
)
|
|
.def("__len__", [](const ChassisVelocities &self) { return 3; })
|
|
.def("__getitem__", [](const ChassisVelocities &self, int index) {
|
|
switch (index) {
|
|
case 0:
|
|
return self.vx();
|
|
case 1:
|
|
return self.vy();
|
|
case 2:
|
|
return self.omega();
|
|
default:
|
|
throw std::out_of_range("ChassisVelocities index out of range");
|
|
}
|
|
})
|
|
.def("__repr__", [](const ChassisVelocities &cs) -> std::string {
|
|
return "ChassisVelocities(vx=" + std::to_string(cs.vx()) + ", "
|
|
"vy=" + std::to_string(cs.vy()) + ", "
|
|
"omega=" + std::to_string(cs.omega()) + ")";
|
|
})
|
|
;
|
|
|
|
SetupWPyStruct<wpi::math::ChassisVelocities>(cls_ChassisVelocities);
|