Verified Commit 48f66548 authored by Gabriele Buondonno's avatar Gabriele Buondonno Committed by Justin Carpentier
Browse files

[bindings] Fix bindings for getFrameAcceleration

parent f3345a2d
...@@ -69,6 +69,7 @@ namespace pinocchio ...@@ -69,6 +69,7 @@ namespace pinocchio
} }
BOOST_PYTHON_FUNCTION_OVERLOADS(getFrameVelocity_overload, (&getFrameVelocity<double,0,JointCollectionDefaultTpl>), 3, 4) BOOST_PYTHON_FUNCTION_OVERLOADS(getFrameVelocity_overload, (&getFrameVelocity<double,0,JointCollectionDefaultTpl>), 3, 4)
BOOST_PYTHON_FUNCTION_OVERLOADS(getFrameAcceleration_overload, (&getFrameAcceleration<double,0,JointCollectionDefaultTpl>), 3, 4)
void exposeFramesAlgo() void exposeFramesAlgo()
{ {
...@@ -95,9 +96,10 @@ namespace pinocchio ...@@ -95,9 +96,10 @@ namespace pinocchio
bp::def("getFrameAcceleration", bp::def("getFrameAcceleration",
&getFrameAcceleration<double,0,JointCollectionDefaultTpl>, &getFrameAcceleration<double,0,JointCollectionDefaultTpl>,
bp::args("model","data","frame_id"), getFrameAcceleration_overload(
"Returns the spatial acceleration of the frame expressed in the coordinates system of the Frame itself.\n" bp::args("model","data","frame_id","reference_frame"),
"forwardKinematics(model,data,q,v,a) should be called first to compute the joint spatial acceleration stored in data.a ."); "Returns the spatial acceleration of the frame expressed in the coordinate system given by reference_frame.\n"
"forwardKinematics(model,data,q,v,a) should be called first to compute the joint spatial acceleration stored in data.a ."));
bp::def("framesForwardKinematics", bp::def("framesForwardKinematics",
&framesForwardKinematics<double,0,JointCollectionDefaultTpl,VectorXd>, &framesForwardKinematics<double,0,JointCollectionDefaultTpl,VectorXd>,
......
...@@ -63,5 +63,14 @@ class TestFrameBindings(PinocchioTestCase): ...@@ -63,5 +63,14 @@ class TestFrameBindings(PinocchioTestCase):
v = pin.getFrameVelocity(self.model, data, self.frame_idx, pin.ReferenceFrame.LOCAL_WORLD_ALIGNED) v = pin.getFrameVelocity(self.model, data, self.frame_idx, pin.ReferenceFrame.LOCAL_WORLD_ALIGNED)
self.assertApprox(v, pin.SE3(T.rotation, np.zeros(3)).act(self.frame_placement.actInv(data.v[self.parent_idx]))) self.assertApprox(v, pin.SE3(T.rotation, np.zeros(3)).act(self.frame_placement.actInv(data.v[self.parent_idx])))
a = pin.getFrameAcceleration(self.model, data, self.frame_idx)
self.assertApprox(a, self.frame_placement.actInv(data.a[self.parent_idx]))
a = pin.getFrameAcceleration(self.model, data, self.frame_idx, pin.ReferenceFrame.LOCAL)
self.assertApprox(a, self.frame_placement.actInv(data.a[self.parent_idx]))
a = pin.getFrameAcceleration(self.model, data, self.frame_idx, pin.ReferenceFrame.WORLD)
self.assertApprox(a, data.oMi[self.parent_idx].act(data.a[self.parent_idx]))
a = pin.getFrameAcceleration(self.model, data, self.frame_idx, pin.ReferenceFrame.LOCAL_WORLD_ALIGNED)
self.assertApprox(a, pin.SE3(T.rotation, np.zeros(3)).act(self.frame_placement.actInv(data.a[self.parent_idx])))
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment