Skip to content

Commit b76dc24

Browse files
committed
Bindings - add bindings for spline joint
1 parent e48451c commit b76dc24

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

include/pinocchio/bindings/python/multibody/joint/joints-datas.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ namespace pinocchio
7272
.add_property("pjMi", &JointDataComposite::pjMi)
7373
.add_property("StU", &JointDataComposite::StU);
7474
}
75-
7675
} // namespace python
7776
} // namespace pinocchio
7877

include/pinocchio/bindings/python/multibody/joint/joints-models.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,31 @@ namespace pinocchio
269269
"Second rotation axis of the JointModelUniversal.");
270270
}
271271

272+
// Specialization for JointModelSpline
273+
template<>
274+
bp::class_<context::JointModelSpline> &
275+
expose_joint_model<context::JointModelSpline>(bp::class_<context::JointModelSpline> & cl)
276+
{
277+
return cl
278+
.def(bp::init<>(
279+
bp::args("self"),
280+
"Init an empty joint Spline. Default degree of spline basis function is 3."))
281+
.def(
282+
"addControlFrame", &context::JointModelSpline::addControlFrame, bp::arg("frame"),
283+
"Add a frame to the frame control vector. As of now, they need to be added in the order "
284+
"of the movement of the spline")
285+
.def(
286+
"makeKnots", &context::JointModelSpline::makeKnots,
287+
"generate the knots vector for the spline. Call after all the control frame have been "
288+
"added")
289+
.def(
290+
"computeRelativeMotion", &context::JointModelSpline::computeRelativeMotions,
291+
"compute the relative motion between the control frames. Call after all the control "
292+
"frames have been added")
293+
.def_readwrite(
294+
"degree", &context::JointModelSpline::degree, "Degree of the spline basis functions");
295+
}
296+
272297
// specialization for JointModelComposite
273298

274299
struct JointModelCompositeAddJointVisitor

include/pinocchio/serialization/joints-data.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@ namespace boost
269269
fix::serialize(ar, static_cast<pinocchio::JointDataBase<JointType> &>(joint), version);
270270
}
271271

272+
template<class Archive, typename Scalar, int Options>
273+
void serialize(
274+
Archive & ar,
275+
pinocchio::JointDataSplineTpl<Scalar, Options> & joint,
276+
const unsigned int version)
277+
{
278+
typedef pinocchio::JointDataSplineTpl<Scalar, Options> JointType;
279+
fix::serialize(ar, static_cast<pinocchio::JointDataBase<JointType> &>(joint), version);
280+
}
281+
272282
} // namespace serialization
273283
} // namespace boost
274284

include/pinocchio/serialization/joints-model.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,18 @@ namespace boost
311311
fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
312312
}
313313

314+
template<class Archive, typename Scalar, int Options>
315+
void serialize(
316+
Archive & ar,
317+
pinocchio::JointModelSplineTpl<Scalar, Options> & joint,
318+
const unsigned int version)
319+
{
320+
typedef pinocchio::JointModelSplineTpl<Scalar, Options> JointType;
321+
ar & make_nvp("ctrlFrames", joint.ctrlFrames);
322+
ar & make_nvp("degree", joint.degree);
323+
324+
fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
325+
}
314326
} // namespace serialization
315327
} // namespace boost
316328

0 commit comments

Comments
 (0)