@@ -767,6 +767,7 @@ def JointStatesFromTraj(robot, traj, times, derivatives=[0, 1, 2]):
767
767
"""
768
768
duration = traj .GetDuration ()
769
769
770
+ times = numpy .array (times )
770
771
if any (times > duration ):
771
772
raise ValueError ('Input times {0:} exceed duration {1:.2f}'
772
773
.format (times , duration ))
@@ -852,7 +853,10 @@ def BodyPointsStatesFromJointStates(bodypoints,
852
853
bp_state = [None ] * numd
853
854
link , local_pos = bp
854
855
link_index = link .GetIndex ()
855
- world_pos = numpy .dot (link .GetTransform (), local_pos )
856
+ link_transform = link .GetTransform ()
857
+ world_pos = (numpy .dot (link_transform [0 :3 , 0 :3 ],
858
+ local_pos ) +
859
+ link_transform [0 :3 , 3 ])
856
860
bp_state [0 ] = world_pos
857
861
if qd is not None :
858
862
Jpos = robot .CalculateJacobian (link_index , world_pos )
@@ -868,9 +872,9 @@ def BodyPointsStatesFromJointStates(bodypoints,
868
872
link_index , world_pos )
869
873
Hang = robot .ComputeHessianAxisAngle (link_index )
870
874
apos = (numpy .dot (Jpos , qdd ) +
871
- reduce ( numpy .dot , [ qd , Hpos , qd ] ))
875
+ numpy .dot ( qd , numpy . dot ( Hpos , qd ) ))
872
876
aang = (numpy .dot (Jang , qdd ) +
873
- reduce ( numpy .dot , [ qd , Hang , qd ] ))
877
+ numpy .dot ( qd , numpy . dot ( Hang , qd ) ))
874
878
bp_state [2 ] = numpy .hstack ((apos , aang ))
875
879
bpstate_list .append (bp_state )
876
880
return bpstate_list
0 commit comments