@@ -160,13 +160,27 @@ def GetTrajectoryManipulators(self, traj):
160
160
161
161
def ExecutePath (self , path , simplify = True , smooth = True , defer = False ,
162
162
timeout = 1. , ** kwargs ):
163
+
164
+ logger .debug ('Begin ExecutePath' )
165
+
163
166
def do_execute (path , simplify , smooth , timeout , ** kwargs ):
164
- if simplify :
165
- path = self .simplifier .ShortcutPath (self , path , defer = False ,
166
- timeout = timeout , ** kwargs )
167
167
168
- retimer = self .smoother if smooth else self .retimer
169
- timed_traj = retimer .RetimeTrajectory (self , path , defer = False , ** kwargs )
168
+ with Clone (self .GetEnv ()) as cloned_env :
169
+ traj_dofs = prpy .util .GetTrajectoryIndices (path )
170
+ cloned_env .Cloned (self ).SetActiveDOFs (traj_dofs )
171
+ cloned_robot = cloned_env .Cloned (self )
172
+
173
+ if simplify :
174
+ path = self .simplifier .ShortcutPath (cloned_robot , path , defer = False ,
175
+ timeout = timeout , ** kwargs )
176
+
177
+ retimer = self .smoother if smooth else self .retimer
178
+ cloned_timed_traj = retimer .RetimeTrajectory (cloned_robot , path , defer = False , ** kwargs )
179
+
180
+ # Copy the trajectory back to the original environment.
181
+ from ..util import CopyTrajectory
182
+ timed_traj = CopyTrajectory (cloned_timed_traj , env = self .GetEnv ())
183
+
170
184
return self .ExecuteTrajectory (timed_traj , defer = False , ** kwargs )
171
185
172
186
if defer :
@@ -188,6 +202,7 @@ def ExecuteTrajectory(self, traj, defer=False, timeout=None, period=0.01, **kw_a
188
202
# TODO: Verify that the trajectory is timed.
189
203
# TODO: Check if this trajectory contains the base.
190
204
205
+ logger .debug ('Begin ExecuteTrajectory' )
191
206
needs_base = False
192
207
193
208
self .GetController ().SetPath (traj )
@@ -223,7 +238,9 @@ def do_poll():
223
238
224
239
return trollius .async (do_poll ())
225
240
else :
226
- util .WaitForControllers (active_controllers , timeout = timeout )
241
+ import prpy .viz
242
+ with prpy .viz .RenderTrajectory (self , traj ):
243
+ util .WaitForControllers (active_controllers , timeout = timeout )
227
244
228
245
return traj
229
246
0 commit comments