Skip to content

Commit 2b20e0e

Browse files
author
Siddhartha Srinivasa
committed
Made required change that I no longer remember why I had to
1 parent 422b2ab commit 2b20e0e

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

src/prpy/util.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,8 @@ def JointStatesFromTraj(robot, traj, times, derivatives=[0, 1, 2]):
761761
@param derivatives list of desired derivatives defaults to [0, 1, 2]
762762
@return pva_list List of list of derivatives at specified times.
763763
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|
766766
767767
"""
768768
duration = traj.GetDuration()
@@ -780,11 +780,9 @@ def JointStatesFromTraj(robot, traj, times, derivatives=[0, 1, 2]):
780780
for t in times:
781781
pva = [None] * len(derivatives)
782782
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)
788786

789787
return pva_list
790788

@@ -799,8 +797,8 @@ def JointStateFromTraj(robot, traj, time, derivatives=[0, 1, 2]):
799797
@param derivatives list of desired derivatives defaults to [0, 1, 2]
800798
@return pva_list List of list of derivatives at specified times.
801799
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|
804802
"""
805803
return JointStatesFromTraj(robot, traj, (time,), derivatives)[0]
806804

@@ -820,8 +818,8 @@ def BodyPointsStatesFromJointStates(bodypoints,
820818
@param derivatives list of desired derivatives defaults to [0, 1, 2]
821819
@return bodypoint_list List of list of derivatives at specified times.
822820
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|
825823
"""
826824

827825
# Convert derivatives to numpy array
@@ -895,8 +893,8 @@ def BodyPointsStatesFromJointState(bodypoints, jointstate,
895893
@param derivatives list of desired derivatives defaults to [0, 1, 2]
896894
@return bodypoint_list List of list of derivatives at specified times.
897895
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|
900898
"""
901899
return BodyPointsStatesFromJointStates(bodypoints, (jointstate,),
902900
derivatives)[0]
@@ -915,8 +913,8 @@ def BodyPointsStatesFromTraj(bodypoints, traj, times, derivatives=[0, 1, 2]):
915913
@param derivatives list of desired derivatives defaults to [0, 1, 2]
916914
@return bodypoint_list List of list of derivatives at specified times.
917915
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|
920918
"""
921919
# Assume everything belongs to the same robot
922920
robot = bodypoints[0][0].manipulator.GetRobot()
@@ -939,7 +937,7 @@ def BodyPointsStateFromTraj(bodypoints, traj, time, derivatives=[0, 1, 2]):
939937
@param derivatives list of desired derivatives defaults to [0, 1, 2]
940938
@return bodypoint_list List of list of derivatives at specified times.
941939
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|
944942
"""
945943
return BodyPointsStatesFromTraj(bodypoints, traj, (time,), derivatives)[0]

0 commit comments

Comments
 (0)