Skip to content

Commit f3af6bb

Browse files
committed
Fixing bug that prevented trajectory blending.
1 parent 492533c commit f3af6bb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/prpy/base/wamrobot.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,15 @@ def RetimeTrajectory(self, traj, max_jerk=30.0, synchronize=False,
8888
# Fall back on the standard OpenRAVE retimer if MacTrajectory is not
8989
# available.
9090
if self.mac_retimer is None:
91-
return Robot.RetimeTrajectory(self, traj, **kw_args)
91+
active_manipulators = self.GetTrajectoryManipulators(traj)
92+
sim_flags = [ manip.simulated for manip in active_manipulators ]
93+
94+
if all(sim_flags):
95+
return Robot.RetimeTrajectory(self, traj, **kw_args)
96+
elif not any(sim_flags):
97+
return prpy.util.CopyTrajectory(traj)
98+
else:
99+
raise ValueError('Mixed simulated and real manipulators is not supported.')
92100

93101
# check the number of
94102
num_waypoints = traj.GetNumWaypoints()
@@ -172,6 +180,7 @@ def ExecuteTrajectory(self, traj, timeout=None, blend=True, retime=True, limit_t
172180
@param retime flag for retiming the trajectory before execution
173181
@return executed_traj including blending and retiming
174182
"""
183+
175184
# Query the active manipulators based on which DOF indices are
176185
# included in the trajectory.
177186
active_manipulators = self.GetTrajectoryManipulators(traj)
@@ -219,6 +228,7 @@ def has_group(cspec, group_name):
219228

220229
first_waypoint = traj.GetWaypoint(0)
221230
cspec = traj.GetConfigurationSpecification()
231+
222232
first_dof_values = cspec.ExtractJointValues(first_waypoint, self, active_indices, 0)
223233
lower_limits, upper_limits = self.GetActiveDOFLimits()
224234

@@ -236,7 +246,7 @@ def has_group(cspec, group_name):
236246

237247
# This must be last because MacTrajectories are immutable.
238248
# TODO: This may break if the retimer clamps DOF values to the joint limits.
239-
if retime:
249+
if retime:
240250
traj = self.RetimeTrajectory(traj, synchronize=needs_synchronization, **kw_args)
241251

242252
if needs_base:

0 commit comments

Comments
 (0)