Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a timing check to JointStatesFromTraj(). #260

Merged
merged 1 commit into from
Jan 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/prpy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,14 +1382,16 @@ def JointStatesFromTraj(robot, traj, times, derivatives=[0, 1, 2]):
@param traj An OpenRAVE trajectory
@param times List of times in seconds
@param derivatives list of desired derivatives defaults to [0, 1, 2]
@return pva_list List of list of derivatives at specified times.
Inserts 'None' for unavailable or undesired fields
The i-th element is the derivatives[i]-th derivative
of position of size |times| x |derivatives|

@return List of list of derivatives at specified times.
Inserts 'None' for unavailable or undesired fields
The i-th element is the derivatives[i]-th derivative
of position of size |times| x |derivatives|
"""
duration = traj.GetDuration()
if not IsTimedTrajectory(traj):
raise ValueError("Joint states can only be interpolated"
" on a timed trajectory.")

duration = traj.GetDuration()
times = numpy.array(times)
if any(times > duration):
raise ValueError('Input times {0:} exceed duration {1:.2f}'
Expand Down Expand Up @@ -1418,10 +1420,10 @@ def JointStateFromTraj(robot, traj, time, derivatives=[0, 1, 2]):
@param traj An OpenRAVE trajectory
@param time time in seconds
@param derivatives list of desired derivatives defaults to [0, 1, 2]
@return pva_list List of list of derivatives at specified times.
Inserts 'None' for unavailable or undesired fields
The i-th element is the derivatives[i]-th derivative
of position of size |times| x |derivatives|
@return List of list of derivatives at specified times.
Inserts 'None' for unavailable or undesired fields
The i-th element is the derivatives[i]-th derivative
of position of size |times| x |derivatives|
"""
return JointStatesFromTraj(robot, traj, (time,), derivatives)[0]

Expand Down