Skip to content

Commit eddbbe8

Browse files
author
Shervin Javdani
committed
modified so you do not need to retime twice
1 parent 9a65ef5 commit eddbbe8

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

src/prpy/base/wam.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -304,18 +304,8 @@ def MoveUntilTouch(manipulator, direction, distance, max_distance=float('+inf'),
304304
delta_t = 0.01
305305

306306
traj_config_spec = traj.GetConfigurationSpecification()
307-
traj_angle_group = traj_config_spec.GetGroupFromName('joint_values')
308-
path_config_spec = openravepy.ConfigurationSpecification()
309-
# path_config_spec.AddDeltaTimeGroup()
310-
path_config_spec.AddGroup(traj_angle_group.name, traj_angle_group.dof, 'linear')
311-
#path_config_spec.AddGroup(traj_angle_group)
312-
# path_config_spec.AddDerivativeGroups(1, False);
313-
# path_config_spec.AddDerivativeGroups(2, False);
314-
# path_config_spec.AddGroup('owd_blend_radius', 1, 'next')
315-
path_config_spec.ResetGroupOffsets()
316-
317307
new_traj = openravepy.RaveCreateTrajectory(manipulator.GetRobot().GetEnv(), '')
318-
new_traj.Init(path_config_spec)
308+
new_traj.Init(traj_config_spec)
319309

320310
for (ignore_col_with, oldstate) in zip(ignore_collisions, ignore_col_obj_oldstate):
321311
ignore_col_with.Enable(oldstate)
@@ -325,24 +315,29 @@ def MoveUntilTouch(manipulator, direction, distance, max_distance=float('+inf'),
325315
waypoint_ind = 0
326316
for t in numpy.arange(0, traj_duration, delta_t):
327317
traj_sample = traj.Sample(t)
328-
print traj_sample
329318

330319
waypoint = traj_config_spec.ExtractJointValues(traj_sample, manipulator.GetRobot(), manipulator.GetArmIndices())
331320
manipulator.SetDOFValues(waypoint)
332-
#if manipulator.GetRobot().GetEnv().CheckCollision(manipulator.GetRobot()):
321+
322+
# Check collision with each body on the robot
333323
for body in manipulator.GetRobot().GetEnv().GetBodies():
334324
if manipulator.GetRobot().GetEnv().CheckCollision(manipulator.GetRobot(), body):
335325
collided_with_obj = True
336326
break
337327
if collided_with_obj:
338328
break
339329
else:
340-
#waypoint = numpy.append(waypoint,t)
341-
new_traj.Insert(int(waypoint_ind), waypoint, path_config_spec)
330+
#set timing on new sampled waypoint
331+
if waypoint_ind == 0:
332+
traj_config_spec.InsertDeltaTime(traj_sample, 0.)
333+
else:
334+
traj_config_spec.InsertDeltaTime(traj_sample, delta_t)
335+
336+
new_traj.Insert(int(waypoint_ind), traj_sample)
342337
waypoint_ind += 1
343338

344-
#manipulator.GetRobot().ExecuteTrajectory(new_traj, execute = True, retime=True, blend=True)
345-
manipulator.GetRobot().ExecutePath(new_traj)
339+
340+
manipulator.GetRobot().ExecuteTrajectory(new_traj)
346341

347342
return collided_with_obj
348343
# Trajectory is aborted by OWD because we felt a force.

0 commit comments

Comments
 (0)