Skip to content

Added UntimeTrajectory() to strip timing from trajectories. #187

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

Merged
merged 1 commit into from
Sep 21, 2015
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
21 changes: 21 additions & 0 deletions src/prpy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,27 @@ def IsTimedTrajectory(trajectory):
return cspec.ExtractDeltaTime(trajectory.GetWaypoint(0)) is not None


def UntimeTrajectory(trajectory, env=None):
"""
Returns an untimed copy of the provided trajectory.

This function strips the DeltaTime group from a timed trajectory to create
an untimed trajectory.

@param trajectory: an OpenRAVE trajectory
@returns: an untimed copy of the provided trajectory.
"""
cspec = trajectory.GetConfigurationSpecification()
cspec.RemoveGroups('deltatime', True)
waypoints = trajectory.GetWaypoints(0, trajectory.GetNumWaypoints(), cspec)

path = openravepy.RaveCreateTrajectory(env or trajectory.GetEnv(),
trajectory.GetXMLId())
path.Init(cspec)
path.Insert(0, waypoints)
return path


def ComputeUnitTiming(robot, traj, env=None):
"""
Compute the unit velocity timing of a path or trajectory.
Expand Down