mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
[robotpy] Run wpiformat on non-python robotpy files (#8362)
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.
This commit is contained in:
@@ -43,7 +43,7 @@ inline_code: |
|
||||
self->ax = ax;
|
||||
}
|
||||
)
|
||||
.def_property("ay_fpss",
|
||||
.def_property("ay_fpss",
|
||||
[](ChassisAccelerations * self) -> wpi::units::feet_per_second_squared_t {
|
||||
return self->ay;
|
||||
},
|
||||
@@ -51,7 +51,7 @@ inline_code: |
|
||||
self->ay = ay;
|
||||
}
|
||||
)
|
||||
.def_property("alpha_dpss",
|
||||
.def_property("alpha_dpss",
|
||||
[](ChassisAccelerations * self) -> wpi::units::degrees_per_second_squared_t {
|
||||
return self->alpha;
|
||||
},
|
||||
|
||||
@@ -45,7 +45,7 @@ inline_code: |
|
||||
self->vx = vx;
|
||||
}
|
||||
)
|
||||
.def_property("vy_fps",
|
||||
.def_property("vy_fps",
|
||||
[](ChassisVelocities * self) -> wpi::units::feet_per_second_t {
|
||||
return self->vy;
|
||||
},
|
||||
@@ -53,7 +53,7 @@ inline_code: |
|
||||
self->vy = vy;
|
||||
}
|
||||
)
|
||||
.def_property("omega_dps",
|
||||
.def_property("omega_dps",
|
||||
[](ChassisVelocities * self) -> wpi::units::degrees_per_second_t {
|
||||
return self->omega;
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ inline_code: |
|
||||
self->left = left;
|
||||
}
|
||||
)
|
||||
.def_property("right_fpss",
|
||||
.def_property("right_fpss",
|
||||
[](DifferentialDriveWheelAccelerations * self) -> wpi::units::feet_per_second_squared_t {
|
||||
return self->right;
|
||||
},
|
||||
|
||||
@@ -35,7 +35,7 @@ inline_code: |
|
||||
self->left = left;
|
||||
}
|
||||
)
|
||||
.def_property("right_fps",
|
||||
.def_property("right_fps",
|
||||
[](DifferentialDriveWheelVelocities * self) -> wpi::units::feet_per_second_t {
|
||||
return self->right;
|
||||
},
|
||||
@@ -50,4 +50,3 @@ inline_code: |
|
||||
;
|
||||
|
||||
SetupWPyStruct<wpi::math::DifferentialDriveWheelVelocities>(cls_DifferentialDriveWheelVelocities);
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ inline_code: |
|
||||
>(),
|
||||
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,
|
||||
.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)
|
||||
@@ -43,7 +43,7 @@ inline_code: |
|
||||
self->frontLeft = frontLeft;
|
||||
}
|
||||
)
|
||||
.def_property("front_right_fpss",
|
||||
.def_property("front_right_fpss",
|
||||
[](MecanumDriveWheelAccelerations * self) -> wpi::units::feet_per_second_squared_t {
|
||||
return self->frontRight;
|
||||
},
|
||||
@@ -59,7 +59,7 @@ inline_code: |
|
||||
self->rearLeft = rearLeft;
|
||||
}
|
||||
)
|
||||
.def_property("rear_right_fpss",
|
||||
.def_property("rear_right_fpss",
|
||||
[](MecanumDriveWheelAccelerations * self) -> wpi::units::feet_per_second_squared_t {
|
||||
return self->rearRight;
|
||||
},
|
||||
|
||||
@@ -46,7 +46,7 @@ inline_code: |
|
||||
self->frontLeft = fps;
|
||||
}
|
||||
)
|
||||
.def_property("frontRight_fps",
|
||||
.def_property("frontRight_fps",
|
||||
[](MecanumDriveWheelVelocities * self) -> wpi::units::feet_per_second_t {
|
||||
return self->frontRight;
|
||||
},
|
||||
@@ -62,7 +62,7 @@ inline_code: |
|
||||
self->rearLeft = fps;
|
||||
}
|
||||
)
|
||||
.def_property("rearRight_fps",
|
||||
.def_property("rearRight_fps",
|
||||
[](MecanumDriveWheelVelocities * self) -> wpi::units::feet_per_second_t {
|
||||
return self->rearRight;
|
||||
},
|
||||
|
||||
@@ -41,7 +41,7 @@ inline_code: |-
|
||||
"\n"
|
||||
":param kinematics: The swerve drive kinematics.")
|
||||
)
|
||||
|
||||
|
||||
.def("setKinematics", static_cast<void (wpi::math::TrajectoryConfig::*)(wpi::math::SwerveDriveKinematics<3>&)>(
|
||||
&wpi::math::TrajectoryConfig::SetKinematics<3>),
|
||||
py::arg("kinematics"), release_gil(), py::doc(
|
||||
@@ -50,7 +50,7 @@ inline_code: |-
|
||||
"\n"
|
||||
":param kinematics: The swerve drive kinematics.")
|
||||
)
|
||||
|
||||
|
||||
.def("setKinematics", static_cast<void (wpi::math::TrajectoryConfig::*)(wpi::math::SwerveDriveKinematics<4>&)>(
|
||||
&wpi::math::TrajectoryConfig::SetKinematics<4>),
|
||||
py::arg("kinematics"), release_gil(), py::doc(
|
||||
@@ -59,7 +59,7 @@ inline_code: |-
|
||||
"\n"
|
||||
":param kinematics: The swerve drive kinematics.")
|
||||
)
|
||||
|
||||
|
||||
.def("setKinematics", static_cast<void (wpi::math::TrajectoryConfig::*)(wpi::math::SwerveDriveKinematics<6>&)>(
|
||||
&wpi::math::TrajectoryConfig::SetKinematics<6>),
|
||||
py::arg("kinematics"), release_gil(), py::doc(
|
||||
|
||||
@@ -19,4 +19,3 @@ classes:
|
||||
- [CubicHermiteSpline]
|
||||
- [QuinticHermiteSpline]
|
||||
SetErrorHandler:
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ inline_code: |
|
||||
.def_static("fromFeet", [](wpi::units::foot_t dx, wpi::units::foot_t dy, wpi::units::radian_t dtheta){
|
||||
return Twist2d{dx, dy, dtheta};
|
||||
}, py::arg("dx") = 0, py::arg("dy") = 0, py::arg("dtheta") = 0)
|
||||
.def_property("dx_feet",
|
||||
.def_property("dx_feet",
|
||||
[](Twist2d * self) -> wpi::units::foot_t {
|
||||
return self->dx;
|
||||
},
|
||||
@@ -30,7 +30,7 @@ inline_code: |
|
||||
self->dx = dx;
|
||||
}
|
||||
)
|
||||
.def_property("dy_feet",
|
||||
.def_property("dy_feet",
|
||||
[](Twist2d * self) -> wpi::units::foot_t {
|
||||
return self->dy;
|
||||
},
|
||||
@@ -38,7 +38,7 @@ inline_code: |
|
||||
self->dy = dy;
|
||||
}
|
||||
)
|
||||
.def_property("dtheta_degrees",
|
||||
.def_property("dtheta_degrees",
|
||||
[](Twist2d * self) -> wpi::units::degree_t {
|
||||
return self->dtheta;
|
||||
},
|
||||
|
||||
@@ -30,7 +30,7 @@ inline_code: |-
|
||||
},
|
||||
py::arg("dx") = 0, py::arg("dy") = 0, py::arg("dz") = 0,
|
||||
py::arg("rx") = 0, py::arg("ry") = 0, py::arg("rz") = 0)
|
||||
.def_property("dx_feet",
|
||||
.def_property("dx_feet",
|
||||
[](Twist3d * self) -> wpi::units::foot_t {
|
||||
return self->dx;
|
||||
},
|
||||
@@ -38,7 +38,7 @@ inline_code: |-
|
||||
self->dx = dx;
|
||||
}
|
||||
)
|
||||
.def_property("dy_feet",
|
||||
.def_property("dy_feet",
|
||||
[](Twist3d * self) -> wpi::units::foot_t {
|
||||
return self->dy;
|
||||
},
|
||||
@@ -46,7 +46,7 @@ inline_code: |-
|
||||
self->dy = dy;
|
||||
}
|
||||
)
|
||||
.def_property("dz_feet",
|
||||
.def_property("dz_feet",
|
||||
[](Twist3d * self) -> wpi::units::foot_t {
|
||||
return self->dz;
|
||||
},
|
||||
@@ -54,7 +54,7 @@ inline_code: |-
|
||||
self->dz = dz;
|
||||
}
|
||||
)
|
||||
.def_property("rx_degrees",
|
||||
.def_property("rx_degrees",
|
||||
[](Twist3d * self) -> wpi::units::degree_t {
|
||||
return self->rx;
|
||||
},
|
||||
@@ -62,7 +62,7 @@ inline_code: |-
|
||||
self->rx = rx;
|
||||
}
|
||||
)
|
||||
.def_property("ry_degrees",
|
||||
.def_property("ry_degrees",
|
||||
[](Twist3d * self) -> wpi::units::degree_t {
|
||||
return self->ry;
|
||||
},
|
||||
@@ -70,7 +70,7 @@ inline_code: |-
|
||||
self->ry = ry;
|
||||
}
|
||||
)
|
||||
.def_property("rz_degrees",
|
||||
.def_property("rz_degrees",
|
||||
[](Twist3d * self) -> wpi::units::degree_t {
|
||||
return self->rz;
|
||||
},
|
||||
|
||||
@@ -1,37 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include "wpi/math/trajectory/constraint/TrajectoryConstraint.hpp"
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include <semiwrap.h>
|
||||
|
||||
#include "wpi/math/trajectory/constraint/TrajectoryConstraint.hpp"
|
||||
|
||||
namespace wpi::math {
|
||||
|
||||
struct PyTrajectoryConstraint : public TrajectoryConstraint {
|
||||
|
||||
PyTrajectoryConstraint() {}
|
||||
|
||||
wpi::units::meters_per_second_t
|
||||
MaxVelocity(const Pose2d &pose, wpi::units::curvature_t curvature,
|
||||
wpi::units::meters_per_second_t velocity) const override {
|
||||
wpi::units::meters_per_second_t MaxVelocity(
|
||||
const Pose2d& pose, wpi::units::curvature_t curvature,
|
||||
wpi::units::meters_per_second_t velocity) const override {
|
||||
return m_constraint->MaxVelocity(pose, curvature, velocity);
|
||||
}
|
||||
|
||||
MinMax MinMaxAcceleration(const Pose2d &pose, wpi::units::curvature_t curvature,
|
||||
wpi::units::meters_per_second_t velocity) const override {
|
||||
MinMax MinMaxAcceleration(
|
||||
const Pose2d& pose, wpi::units::curvature_t curvature,
|
||||
wpi::units::meters_per_second_t velocity) const override {
|
||||
return m_constraint->MinMaxAcceleration(pose, curvature, velocity);
|
||||
}
|
||||
|
||||
std::shared_ptr<TrajectoryConstraint> m_constraint;
|
||||
};
|
||||
|
||||
}; // namespace wpi::math
|
||||
}; // namespace wpi::math
|
||||
|
||||
namespace pybind11 {
|
||||
namespace detail {
|
||||
namespace pybind11::detail {
|
||||
|
||||
template <> struct type_caster<wpi::math::PyTrajectoryConstraint> {
|
||||
using value_conv = make_caster<std::shared_ptr<wpi::math::TrajectoryConstraint>>;
|
||||
template <>
|
||||
struct type_caster<wpi::math::PyTrajectoryConstraint> {
|
||||
using value_conv =
|
||||
make_caster<std::shared_ptr<wpi::math::TrajectoryConstraint>>;
|
||||
|
||||
PYBIND11_TYPE_CASTER(wpi::math::PyTrajectoryConstraint, _("wpimath._wpimath.TrajectoryConstraint"));
|
||||
PYBIND11_TYPE_CASTER(wpi::math::PyTrajectoryConstraint,
|
||||
_("wpimath._wpimath.TrajectoryConstraint"));
|
||||
|
||||
bool load(handle src, bool convert) {
|
||||
value_conv conv;
|
||||
@@ -40,15 +46,15 @@ template <> struct type_caster<wpi::math::PyTrajectoryConstraint> {
|
||||
}
|
||||
|
||||
value.m_constraint =
|
||||
cast_op<std::shared_ptr<wpi::math::TrajectoryConstraint>>(std::move(conv));
|
||||
cast_op<std::shared_ptr<wpi::math::TrajectoryConstraint>>(
|
||||
std::move(conv));
|
||||
return true;
|
||||
}
|
||||
|
||||
static handle cast(const wpi::math::PyTrajectoryConstraint &src,
|
||||
static handle cast(const wpi::math::PyTrajectoryConstraint& src,
|
||||
return_value_policy policy, handle parent) {
|
||||
return value_conv::cast(src.m_constraint, policy, parent);
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace detail
|
||||
}; // namespace pybind11
|
||||
} // namespace pybind11::detail
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "wpi/math/geometry/Ellipse2d.hpp"
|
||||
@@ -11,11 +13,11 @@
|
||||
|
||||
namespace rpy {
|
||||
|
||||
inline std::string toString(const wpi::math::Rotation2d &self) {
|
||||
inline std::string toString(const wpi::math::Rotation2d& self) {
|
||||
return "Rotation2d(" + std::to_string(self.Radians()()) + ")";
|
||||
}
|
||||
|
||||
inline std::string toString(const wpi::math::Rotation3d &self) {
|
||||
inline std::string toString(const wpi::math::Rotation3d& self) {
|
||||
return "Rotation3d("
|
||||
"x=" +
|
||||
std::to_string(self.X()()) +
|
||||
@@ -27,7 +29,7 @@ inline std::string toString(const wpi::math::Rotation3d &self) {
|
||||
std::to_string(self.Z()()) + ")";
|
||||
}
|
||||
|
||||
inline std::string toString(const wpi::math::Translation2d &self) {
|
||||
inline std::string toString(const wpi::math::Translation2d& self) {
|
||||
return "Translation2d("
|
||||
"x=" +
|
||||
std::to_string(self.X()()) +
|
||||
@@ -36,7 +38,7 @@ inline std::string toString(const wpi::math::Translation2d &self) {
|
||||
std::to_string(self.Y()()) + ")";
|
||||
}
|
||||
|
||||
inline std::string toString(const wpi::math::Translation3d &self) {
|
||||
inline std::string toString(const wpi::math::Translation3d& self) {
|
||||
return "Translation3d("
|
||||
"x=" +
|
||||
std::to_string(self.X()()) +
|
||||
@@ -48,7 +50,7 @@ inline std::string toString(const wpi::math::Translation3d &self) {
|
||||
std::to_string(self.Z()()) + ")";
|
||||
}
|
||||
|
||||
inline std::string toString(const wpi::math::Quaternion &self) {
|
||||
inline std::string toString(const wpi::math::Quaternion& self) {
|
||||
return "Quaternion("
|
||||
"w=" +
|
||||
std::to_string(self.W()) +
|
||||
@@ -63,37 +65,36 @@ inline std::string toString(const wpi::math::Quaternion &self) {
|
||||
std::to_string(self.Z()) + ")";
|
||||
}
|
||||
|
||||
inline std::string toString(const wpi::math::Transform2d &self) {
|
||||
inline std::string toString(const wpi::math::Transform2d& self) {
|
||||
return "Transform2d(" + rpy::toString(self.Translation()) + ", " +
|
||||
rpy::toString(self.Rotation()) + ")";
|
||||
}
|
||||
|
||||
inline std::string toString(const wpi::math::Transform3d &self) {
|
||||
inline std::string toString(const wpi::math::Transform3d& self) {
|
||||
return "Transform3d(" + rpy::toString(self.Translation()) + ", " +
|
||||
rpy::toString(self.Rotation()) + ")";
|
||||
}
|
||||
|
||||
inline std::string toString(const wpi::math::Pose2d &self) {
|
||||
inline std::string toString(const wpi::math::Pose2d& self) {
|
||||
return "Pose2d(" + rpy::toString(self.Translation()) + ", " +
|
||||
rpy::toString(self.Rotation()) + ")";
|
||||
}
|
||||
|
||||
inline std::string toString(const wpi::math::Pose3d &self) {
|
||||
inline std::string toString(const wpi::math::Pose3d& self) {
|
||||
return "Pose3d(" + rpy::toString(self.Translation()) + ", " +
|
||||
rpy::toString(self.Rotation()) + ")";
|
||||
}
|
||||
|
||||
inline std::string toString(const wpi::math::Rectangle2d &self) {
|
||||
inline std::string toString(const wpi::math::Rectangle2d& self) {
|
||||
return "Rectangle2d(center=" + rpy::toString(self.Center()) +
|
||||
", xWidth=" + std::to_string(self.XWidth()()) +
|
||||
", yWidth=" + std::to_string(self.YWidth()()) + ")";
|
||||
", xWidth=" + std::to_string(self.XWidth()()) +
|
||||
", yWidth=" + std::to_string(self.YWidth()()) + ")";
|
||||
}
|
||||
|
||||
inline std::string toString(const wpi::math::Ellipse2d &self) {
|
||||
inline std::string toString(const wpi::math::Ellipse2d& self) {
|
||||
return "Ellipse2d(center=" + rpy::toString(self.Center()) +
|
||||
", xSemiAxis=" + std::to_string(self.XSemiAxis()()) +
|
||||
", ySemiAxis=" + std::to_string(self.YSemiAxis()()) + ")";
|
||||
", xSemiAxis=" + std::to_string(self.XSemiAxis()()) +
|
||||
", ySemiAxis=" + std::to_string(self.YSemiAxis()()) + ")";
|
||||
}
|
||||
|
||||
|
||||
} // namespace rpy
|
||||
} // namespace rpy
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
#include "semiwrap_init.wpimath._wpimath.hpp"
|
||||
|
||||
SEMIWRAP_PYBIND11_MODULE(m) { initWrapper(m); }
|
||||
SEMIWRAP_PYBIND11_MODULE(m) {
|
||||
initWrapper(m);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user