@@ -254,8 +254,7 @@ def MoveUntilTouch(manipulator, direction, distance, max_distance=float('+inf'),
254
254
@param max_distance maximum distance in meters
255
255
@param max_force maximum force in Newtons
256
256
@param max_torque maximum torque in Newton-Meters
257
- @param execute optionally execute the trajectory
258
- @param ignore_collisions collisions with these objects are ignored in simulation
257
+ @param ignore_collisions collisions with these objects are ignored when planning the path, e.g. the object you think you will touch
259
258
@param **kw_args planner parameters
260
259
@return felt_force flag indicating whether we felt a force.
261
260
"""
@@ -299,21 +298,14 @@ def MoveUntilTouch(manipulator, direction, distance, max_distance=float('+inf'),
299
298
ignore_col_with .Enable (oldstate )
300
299
else :
301
300
301
+ traj = manipulator .GetRobot ().PostProcessPath (traj )
302
+
302
303
traj_duration = traj .GetDuration ()
303
304
delta_t = 0.01
304
305
305
306
traj_config_spec = traj .GetConfigurationSpecification ()
306
- traj_angle_group = traj_config_spec .GetGroupFromName ('joint_values' )
307
- path_config_spec = openravepy .ConfigurationSpecification ()
308
- # path_config_spec.AddDeltaTimeGroup()
309
- path_config_spec .AddGroup (traj_angle_group .name , traj_angle_group .dof , '' )
310
- # path_config_spec.AddDerivativeGroups(1, False);
311
- # path_config_spec.AddDerivativeGroups(2, False);
312
- # path_config_spec.AddGroup('owd_blend_radius', 1, 'next')
313
- path_config_spec .ResetGroupOffsets ()
314
-
315
307
new_traj = openravepy .RaveCreateTrajectory (manipulator .GetRobot ().GetEnv (), '' )
316
- new_traj .Init (path_config_spec )
308
+ new_traj .Init (traj_config_spec )
317
309
318
310
for (ignore_col_with , oldstate ) in zip (ignore_collisions , ignore_col_obj_oldstate ):
319
311
ignore_col_with .Enable (oldstate )
@@ -326,19 +318,26 @@ def MoveUntilTouch(manipulator, direction, distance, max_distance=float('+inf'),
326
318
327
319
waypoint = traj_config_spec .ExtractJointValues (traj_sample , manipulator .GetRobot (), manipulator .GetArmIndices ())
328
320
manipulator .SetDOFValues (waypoint )
329
- #if manipulator.GetRobot().GetEnv().CheckCollision(manipulator.GetRobot()):
321
+
322
+ # Check collision with each body on the robot
330
323
for body in manipulator .GetRobot ().GetEnv ().GetBodies ():
331
324
if manipulator .GetRobot ().GetEnv ().CheckCollision (manipulator .GetRobot (), body ):
332
325
collided_with_obj = True
333
326
break
334
327
if collided_with_obj :
335
328
break
336
329
else :
337
- #waypoint = numpy.append(waypoint,t)
338
- 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 )
339
337
waypoint_ind += 1
340
338
341
- manipulator .GetRobot ().ExecuteTrajectory (new_traj , execute = True , retime = True , blend = True )
339
+
340
+ manipulator .GetRobot ().ExecuteTrajectory (new_traj )
342
341
343
342
return collided_with_obj
344
343
# Trajectory is aborted by OWD because we felt a force.
0 commit comments