Skip to content

Commit c616fa1

Browse files
committed
Added check for deltatime without hardcoded any strings.
It was hard to not hardcode any strings.
1 parent 29f7683 commit c616fa1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/prpy/base/robot.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,13 @@ def ExecuteTrajectory(self, traj, defer=False, timeout=None, period=0.01, **kwar
457457
else:
458458
return traj
459459

460-
# Verify that the trajectory is timed.
460+
# Verify that the trajectory is timed by checking whether the first
461+
# waypoint has a valid deltatime value.
462+
cspec = traj.GetConfigurationSpecification()
463+
if cspec.ExtractDeltaTime(traj.GetWaypoint(0)) is None:
464+
raise ValueError('Trajectory cannot be executed, it is not timed.')
465+
466+
# Verify that the trajectory has non-zero duration.
461467
if traj.GetDuration() <= 0.0:
462468
import warnings
463469
warnings.warn('Executing zero-length trajectory. Please update the'

0 commit comments

Comments
 (0)