Skip to content

Commit

Permalink
Add __repr__ for TrapezoidProfile.Constraints
Browse files Browse the repository at this point in the history
- Fixes #79
  • Loading branch information
virtuald committed Feb 18, 2024
1 parent 58d5646 commit eb3002d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions subprojects/robotpy-wpimath/gen/controls/TrapezoidProfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ classes:
TotalTime:
IsFinished:
template_inline_code: |
{
std::string clsNameCopy = clsName;
cls_State
Expand All @@ -56,13 +57,12 @@ classes:
py::arg("position") = 0,
py::arg("velocity") = 0
)
.def_readwrite("position", &frc::TrapezoidProfile<Distance>::State::position)
.def_readwrite("velocity", &frc::TrapezoidProfile<Distance>::State::velocity)
.def("__repr__", [clsNameCopy](const State &self) {
return clsNameCopy + ".State("
"position=" + std::to_string(self.position()) + ", "
"velocity=" + std::to_string(self.velocity()) + ")";
});
}
TrapezoidProfile::Constraints:
shared_ptr: false
attributes:
Expand All @@ -81,6 +81,17 @@ classes:
maxAcceleration_:
name: maxAcceleration
default: 0
template_inline_code: |
{
std::string clsNameCopy = clsName;
cls_Constraints
.def("__repr__", [clsNameCopy](const Constraints &self) {
return clsNameCopy + ".Constraints("
"maxVelocity=" + std::to_string(self.maxVelocity()) + ", "
"maxAcceleration=" + std::to_string(self.maxAcceleration()) + ")";
});
}
TrapezoidProfile::State:
force_no_default_constructor: true
shared_ptr: false
Expand Down

0 comments on commit eb3002d

Please sign in to comment.