@@ -761,8 +761,8 @@ def JointStatesFromTraj(robot, traj, times, derivatives=[0, 1, 2]):
761
761
@param derivatives list of desired derivatives defaults to [0, 1, 2]
762
762
@return pva_list List of list of derivatives at specified times.
763
763
Inserts 'None' for unavailable or undesired fields
764
- The i-th element is the i -th derivative of position
765
- Of size |times| x |derivatives|
764
+ The i-th element is the derivatives[i] -th derivative
765
+ of position of size |times| x |derivatives|
766
766
767
767
"""
768
768
duration = traj .GetDuration ()
@@ -780,11 +780,9 @@ def JointStatesFromTraj(robot, traj, times, derivatives=[0, 1, 2]):
780
780
for t in times :
781
781
pva = [None ] * len (derivatives )
782
782
trajdata = traj .Sample (t )
783
- for i in range (len (derivatives )):
784
- if i in derivatives :
785
- pva [i ] = cspec .ExtractJointValues (trajdata , robot ,
786
- dof_indices , i )
787
- pva_list .append (pva )
783
+ for i , deriv in enumerate (derivatives ):
784
+ pva [i ] = cspec .ExtractJointValues (trajdata , robot , dof_indices , deriv )
785
+ pva_list .append (pva )
788
786
789
787
return pva_list
790
788
@@ -799,8 +797,8 @@ def JointStateFromTraj(robot, traj, time, derivatives=[0, 1, 2]):
799
797
@param derivatives list of desired derivatives defaults to [0, 1, 2]
800
798
@return pva_list List of list of derivatives at specified times.
801
799
Inserts 'None' for unavailable or undesired fields
802
- The i-th element is the i -th derivative of position
803
- Of size |times| x |derivatives|
800
+ The i-th element is the derivatives[i] -th derivative
801
+ of position of size |times| x |derivatives|
804
802
"""
805
803
return JointStatesFromTraj (robot , traj , (time ,), derivatives )[0 ]
806
804
@@ -820,8 +818,8 @@ def BodyPointsStatesFromJointStates(bodypoints,
820
818
@param derivatives list of desired derivatives defaults to [0, 1, 2]
821
819
@return bodypoint_list List of list of derivatives at specified times.
822
820
Inserts 'None' for unavailable or undesired fields
823
- The i-th element is the i -th derivative of position
824
- Of size |jointstates| x |bodypoints | x |derivatives|
821
+ The i-th element is the derivatives[i] -th derivative
822
+ of position of size |times | x |derivatives|
825
823
"""
826
824
827
825
# Convert derivatives to numpy array
@@ -895,8 +893,8 @@ def BodyPointsStatesFromJointState(bodypoints, jointstate,
895
893
@param derivatives list of desired derivatives defaults to [0, 1, 2]
896
894
@return bodypoint_list List of list of derivatives at specified times.
897
895
Inserts 'None' for unavailable or undesired fields
898
- The i-th element is the i -th derivative of position
899
- Of size |jointstates| x |bodypoints | x |derivatives|
896
+ The i-th element is the derivatives[i] -th derivative
897
+ of position of size |times | x |derivatives|
900
898
"""
901
899
return BodyPointsStatesFromJointStates (bodypoints , (jointstate ,),
902
900
derivatives )[0 ]
@@ -915,8 +913,8 @@ def BodyPointsStatesFromTraj(bodypoints, traj, times, derivatives=[0, 1, 2]):
915
913
@param derivatives list of desired derivatives defaults to [0, 1, 2]
916
914
@return bodypoint_list List of list of derivatives at specified times.
917
915
Inserts 'None' for unavailable or undesired fields
918
- The i-th element is the i -th derivative of position
919
- Of size |jointstates| x |bodypoints | x |derivatives|
916
+ The i-th element is the derivatives[i] -th derivative
917
+ of position of size |times | x |derivatives|
920
918
"""
921
919
# Assume everything belongs to the same robot
922
920
robot = bodypoints [0 ][0 ].manipulator .GetRobot ()
@@ -939,7 +937,7 @@ def BodyPointsStateFromTraj(bodypoints, traj, time, derivatives=[0, 1, 2]):
939
937
@param derivatives list of desired derivatives defaults to [0, 1, 2]
940
938
@return bodypoint_list List of list of derivatives at specified times.
941
939
Inserts 'None' for unavailable or undesired fields
942
- The i-th element is the i -th derivative of position
943
- Of size |jointstates| x |bodypoints | x |derivatives|
940
+ The i-th element is the derivatives[i] -th derivative
941
+ of position of size |times | x |derivatives|
944
942
"""
945
943
return BodyPointsStatesFromTraj (bodypoints , traj , (time ,), derivatives )[0 ]
0 commit comments