@@ -304,18 +304,8 @@ def MoveUntilTouch(manipulator, direction, distance, max_distance=float('+inf'),
304
304
delta_t = 0.01
305
305
306
306
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
-
317
307
new_traj = openravepy .RaveCreateTrajectory (manipulator .GetRobot ().GetEnv (), '' )
318
- new_traj .Init (path_config_spec )
308
+ new_traj .Init (traj_config_spec )
319
309
320
310
for (ignore_col_with , oldstate ) in zip (ignore_collisions , ignore_col_obj_oldstate ):
321
311
ignore_col_with .Enable (oldstate )
@@ -325,24 +315,29 @@ def MoveUntilTouch(manipulator, direction, distance, max_distance=float('+inf'),
325
315
waypoint_ind = 0
326
316
for t in numpy .arange (0 , traj_duration , delta_t ):
327
317
traj_sample = traj .Sample (t )
328
- print traj_sample
329
318
330
319
waypoint = traj_config_spec .ExtractJointValues (traj_sample , manipulator .GetRobot (), manipulator .GetArmIndices ())
331
320
manipulator .SetDOFValues (waypoint )
332
- #if manipulator.GetRobot().GetEnv().CheckCollision(manipulator.GetRobot()):
321
+
322
+ # Check collision with each body on the robot
333
323
for body in manipulator .GetRobot ().GetEnv ().GetBodies ():
334
324
if manipulator .GetRobot ().GetEnv ().CheckCollision (manipulator .GetRobot (), body ):
335
325
collided_with_obj = True
336
326
break
337
327
if collided_with_obj :
338
328
break
339
329
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 )
342
337
waypoint_ind += 1
343
338
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 )
346
341
347
342
return collided_with_obj
348
343
# Trajectory is aborted by OWD because we felt a force.
0 commit comments