2025-10-24 01:28:04 -04:00
|
|
|
extra_includes:
|
|
|
|
|
- wpystruct.h
|
|
|
|
|
|
|
|
|
|
classes:
|
2026-03-06 14:19:15 -08:00
|
|
|
wpi::math::ChassisVelocities:
|
2025-10-24 01:28:04 -04:00
|
|
|
force_no_default_constructor: true
|
|
|
|
|
attributes:
|
|
|
|
|
vx:
|
|
|
|
|
vy:
|
|
|
|
|
omega:
|
|
|
|
|
methods:
|
|
|
|
|
ToTwist2d:
|
|
|
|
|
Discretize:
|
|
|
|
|
overloads:
|
2025-11-07 20:00:05 -05:00
|
|
|
wpi::units::meters_per_second_t, wpi::units::meters_per_second_t, wpi::units::radians_per_second_t, wpi::units::second_t:
|
2026-03-06 14:19:15 -08:00
|
|
|
const ChassisVelocities&, wpi::units::second_t:
|
2025-10-24 01:28:04 -04:00
|
|
|
operator+:
|
|
|
|
|
operator-:
|
|
|
|
|
overloads:
|
2026-03-06 14:19:15 -08:00
|
|
|
const ChassisVelocities& [const]:
|
2025-10-24 01:28:04 -04:00
|
|
|
'[const]':
|
|
|
|
|
operator*:
|
|
|
|
|
operator/:
|
|
|
|
|
operator==:
|
|
|
|
|
ToRobotRelative:
|
|
|
|
|
ToFieldRelative:
|
|
|
|
|
|
|
|
|
|
inline_code: |
|
2026-03-06 14:19:15 -08:00
|
|
|
cls_ChassisVelocities
|
2025-10-24 01:28:04 -04:00
|
|
|
.def(
|
|
|
|
|
py::init<
|
2025-11-07 20:00:05 -05:00
|
|
|
wpi::units::meters_per_second_t, wpi::units::meters_per_second_t,
|
|
|
|
|
wpi::units::radians_per_second_t
|
2025-10-24 01:28:04 -04:00
|
|
|
>(),
|
|
|
|
|
py::arg("vx") = 0, py::arg("vy") = 0, py::arg("omega") = 0
|
|
|
|
|
)
|
2025-11-07 20:00:05 -05:00
|
|
|
.def_static("fromFeet", [](wpi::units::feet_per_second_t vx, wpi::units::feet_per_second_t vy, wpi::units::radians_per_second_t omega){
|
2026-03-06 14:19:15 -08:00
|
|
|
return ChassisVelocities{vx, vy, omega};
|
2025-10-24 01:28:04 -04:00
|
|
|
}, py::arg("vx") = 0, py::arg("vy") = 0, py::arg("omega") = 0)
|
|
|
|
|
.def_property("vx_fps",
|
2026-03-06 14:19:15 -08:00
|
|
|
[](ChassisVelocities * self) -> wpi::units::feet_per_second_t {
|
2025-10-24 01:28:04 -04:00
|
|
|
return self->vx;
|
|
|
|
|
},
|
2026-03-06 14:19:15 -08:00
|
|
|
[](ChassisVelocities * self, wpi::units::feet_per_second_t vx) {
|
2025-10-24 01:28:04 -04:00
|
|
|
self->vx = vx;
|
|
|
|
|
}
|
|
|
|
|
)
|
2026-06-21 22:36:03 -04:00
|
|
|
.def_property("vy_fps",
|
2026-03-06 14:19:15 -08:00
|
|
|
[](ChassisVelocities * self) -> wpi::units::feet_per_second_t {
|
2025-10-24 01:28:04 -04:00
|
|
|
return self->vy;
|
|
|
|
|
},
|
2026-03-06 14:19:15 -08:00
|
|
|
[](ChassisVelocities * self, wpi::units::feet_per_second_t vy) {
|
2025-10-24 01:28:04 -04:00
|
|
|
self->vy = vy;
|
|
|
|
|
}
|
|
|
|
|
)
|
2026-06-21 22:36:03 -04:00
|
|
|
.def_property("omega_dps",
|
2026-03-06 14:19:15 -08:00
|
|
|
[](ChassisVelocities * self) -> wpi::units::degrees_per_second_t {
|
2025-10-24 01:28:04 -04:00
|
|
|
return self->omega;
|
|
|
|
|
},
|
2026-03-06 14:19:15 -08:00
|
|
|
[](ChassisVelocities * self, wpi::units::degrees_per_second_t omega) {
|
2025-10-24 01:28:04 -04:00
|
|
|
self->omega = omega;
|
|
|
|
|
}
|
|
|
|
|
)
|
2026-03-06 14:19:15 -08:00
|
|
|
.def("__len__", [](const ChassisVelocities &self) { return 3; })
|
|
|
|
|
.def("__getitem__", [](const ChassisVelocities &self, int index) {
|
2025-10-24 01:28:04 -04:00
|
|
|
switch (index) {
|
|
|
|
|
case 0:
|
|
|
|
|
return self.vx();
|
|
|
|
|
case 1:
|
|
|
|
|
return self.vy();
|
|
|
|
|
case 2:
|
|
|
|
|
return self.omega();
|
|
|
|
|
default:
|
2026-03-06 14:19:15 -08:00
|
|
|
throw std::out_of_range("ChassisVelocities index out of range");
|
2025-10-24 01:28:04 -04:00
|
|
|
}
|
|
|
|
|
})
|
2026-03-06 14:19:15 -08:00
|
|
|
.def("__repr__", [](const ChassisVelocities &cs) -> std::string {
|
|
|
|
|
return "ChassisVelocities(vx=" + std::to_string(cs.vx()) + ", "
|
2025-10-24 01:28:04 -04:00
|
|
|
"vy=" + std::to_string(cs.vy()) + ", "
|
|
|
|
|
"omega=" + std::to_string(cs.omega()) + ")";
|
|
|
|
|
})
|
|
|
|
|
;
|
|
|
|
|
|
2026-03-06 14:19:15 -08:00
|
|
|
SetupWPyStruct<wpi::math::ChassisVelocities>(cls_ChassisVelocities);
|