Skip to content

Commit e90be3d

Browse files
committed
Merge pull request #260 from personalrobotics/bugfix/JointStateTimingCheck
Adds a timing check to `JointStatesFromTraj()`.
2 parents e05911a + 95e1636 commit e90be3d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/prpy/util.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,14 +1382,16 @@ def JointStatesFromTraj(robot, traj, times, derivatives=[0, 1, 2]):
13821382
@param traj An OpenRAVE trajectory
13831383
@param times List of times in seconds
13841384
@param derivatives list of desired derivatives defaults to [0, 1, 2]
1385-
@return pva_list List of list of derivatives at specified times.
1386-
Inserts 'None' for unavailable or undesired fields
1387-
The i-th element is the derivatives[i]-th derivative
1388-
of position of size |times| x |derivatives|
1389-
1385+
@return List of list of derivatives at specified times.
1386+
Inserts 'None' for unavailable or undesired fields
1387+
The i-th element is the derivatives[i]-th derivative
1388+
of position of size |times| x |derivatives|
13901389
"""
1391-
duration = traj.GetDuration()
1390+
if not IsTimedTrajectory(traj):
1391+
raise ValueError("Joint states can only be interpolated"
1392+
" on a timed trajectory.")
13921393

1394+
duration = traj.GetDuration()
13931395
times = numpy.array(times)
13941396
if any(times > duration):
13951397
raise ValueError('Input times {0:} exceed duration {1:.2f}'
@@ -1418,10 +1420,10 @@ def JointStateFromTraj(robot, traj, time, derivatives=[0, 1, 2]):
14181420
@param traj An OpenRAVE trajectory
14191421
@param time time in seconds
14201422
@param derivatives list of desired derivatives defaults to [0, 1, 2]
1421-
@return pva_list List of list of derivatives at specified times.
1422-
Inserts 'None' for unavailable or undesired fields
1423-
The i-th element is the derivatives[i]-th derivative
1424-
of position of size |times| x |derivatives|
1423+
@return List of list of derivatives at specified times.
1424+
Inserts 'None' for unavailable or undesired fields
1425+
The i-th element is the derivatives[i]-th derivative
1426+
of position of size |times| x |derivatives|
14251427
"""
14261428
return JointStatesFromTraj(robot, traj, (time,), derivatives)[0]
14271429

0 commit comments

Comments
 (0)