Skip to content

Commit 798daac

Browse files
committed
Added defer handling to the checks in ExecuteTrajectory.
1 parent f1c2e3e commit 798daac

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/prpy/base/robot.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def ExecuteTrajectory(self, traj, defer=False, timeout=None, period=0.01, **kwar
421421
will be raised). If timeout is a float (including timeout = 0), this
422422
function will return None once the timeout has ellapsed, even if the
423423
trajectory is still being executed.
424-
424+
425425
NOTE: We suggest that you either use timeout=None or defer=True. If
426426
trajectory execution times out, there is no way to tell whether
427427
execution was successful or not. Other values of timeout are only
@@ -449,7 +449,13 @@ def ExecuteTrajectory(self, traj, defer=False, timeout=None, period=0.01, **kwar
449449

450450
# If there was only one waypoint, at this point we are done!
451451
if traj.GetNumWaypoints() == 1:
452-
return traj
452+
if defer is True:
453+
import trollius
454+
future = trollius.Future()
455+
future.set_result(traj)
456+
return future
457+
else:
458+
return traj
453459

454460
# Verify that the trajectory is timed.
455461
if traj.GetDuration() <= 0.0:

0 commit comments

Comments
 (0)