Skip to content

Commit c513846

Browse files
authored
Merge pull request #80 from robotpy/add-constraints-repr
Add __repr__ for TrapezoidProfile.Constraints
2 parents cd1a275 + eb3002d commit c513846

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

subprojects/robotpy-wpimath/gen/controls/TrapezoidProfile.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ classes:
4848
TotalTime:
4949
IsFinished:
5050
template_inline_code: |
51+
{
5152
std::string clsNameCopy = clsName;
5253
5354
cls_State
@@ -56,13 +57,12 @@ classes:
5657
py::arg("position") = 0,
5758
py::arg("velocity") = 0
5859
)
59-
.def_readwrite("position", &frc::TrapezoidProfile<Distance>::State::position)
60-
.def_readwrite("velocity", &frc::TrapezoidProfile<Distance>::State::velocity)
6160
.def("__repr__", [clsNameCopy](const State &self) {
6261
return clsNameCopy + ".State("
6362
"position=" + std::to_string(self.position()) + ", "
6463
"velocity=" + std::to_string(self.velocity()) + ")";
6564
});
65+
}
6666
TrapezoidProfile::Constraints:
6767
shared_ptr: false
6868
attributes:
@@ -81,6 +81,17 @@ classes:
8181
maxAcceleration_:
8282
name: maxAcceleration
8383
default: 0
84+
template_inline_code: |
85+
{
86+
std::string clsNameCopy = clsName;
87+
88+
cls_Constraints
89+
.def("__repr__", [clsNameCopy](const Constraints &self) {
90+
return clsNameCopy + ".Constraints("
91+
"maxVelocity=" + std::to_string(self.maxVelocity()) + ", "
92+
"maxAcceleration=" + std::to_string(self.maxAcceleration()) + ")";
93+
});
94+
}
8495
TrapezoidProfile::State:
8596
force_no_default_constructor: true
8697
shared_ptr: false

0 commit comments

Comments
 (0)