Skip to content

Commit aeb333b

Browse files
committed
Added bindings for set and get active joint mask and small test
1 parent d4825ca commit aeb333b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

bindings/python/basic.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ void pyConstraint(py::module& m, const std::string& className) {
106106
.def("update", &Constraint<MatrixType, VectorType>::update)
107107
.def("log", &Constraint<MatrixType, VectorType>::log)
108108
.def("checkConsistency", &Constraint<MatrixType, VectorType>::checkConsistency)
109+
.def("getActiveJointsMask", &Constraint<MatrixType, VectorType>::getActiveJointsMask)
110+
.def("setActiveJointsMask", &Constraint<MatrixType, VectorType>::setActiveJointsMask)
109111
.def("__mod__", [](const std::shared_ptr<Constraint<MatrixType, VectorType>> constraint, const std::list<unsigned int>& rowIndices) {
110112
return constraint % rowIndices;});
111113
}

bindings/python/tests/pyopensot_aggregated_tests.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,16 @@
7979
print(f"sc4.getbUpperBound(): {sc4.getbUpperBound()}")
8080
print(f"sc4.getbLowerBound(): {sc4.getbLowerBound()}")
8181

82+
c1_joint_mask = c1.getActiveJointsMask()
83+
print(f"c1_joint_mask: {c1_joint_mask}")
84+
c1_joint_mask[1] = False
85+
c1.setActiveJointsMask(c1_joint_mask)
86+
87+
c4.update()
88+
print(f"c4.getAineq(): {c4.getAineq()}")
89+
90+
c4.setActiveJointsMask(c1_joint_mask)
91+
c4.update()
92+
print(f"c4.getAineq(): {c4.getAineq()}")
93+
94+

0 commit comments

Comments
 (0)