Skip to content

Commit 6debbfb

Browse files
committed
Merge pull request #187 from personalrobotics/feature/untime_trajectory
Added UntimeTrajectory() to strip timing from trajectories.
2 parents b14759e + 5ba0db1 commit 6debbfb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/prpy/util.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,27 @@ def IsTimedTrajectory(trajectory):
730730
return cspec.ExtractDeltaTime(trajectory.GetWaypoint(0)) is not None
731731

732732

733+
def UntimeTrajectory(trajectory, env=None):
734+
"""
735+
Returns an untimed copy of the provided trajectory.
736+
737+
This function strips the DeltaTime group from a timed trajectory to create
738+
an untimed trajectory.
739+
740+
@param trajectory: an OpenRAVE trajectory
741+
@returns: an untimed copy of the provided trajectory.
742+
"""
743+
cspec = trajectory.GetConfigurationSpecification()
744+
cspec.RemoveGroups('deltatime', True)
745+
waypoints = trajectory.GetWaypoints(0, trajectory.GetNumWaypoints(), cspec)
746+
747+
path = openravepy.RaveCreateTrajectory(env or trajectory.GetEnv(),
748+
trajectory.GetXMLId())
749+
path.Init(cspec)
750+
path.Insert(0, waypoints)
751+
return path
752+
753+
733754
def ComputeUnitTiming(robot, traj, env=None):
734755
"""
735756
Compute the unit velocity timing of a path or trajectory.

0 commit comments

Comments
 (0)