File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -81,17 +81,17 @@ def SetVelocity(self, q_dot):
81
81
82
82
def Step (self ):
83
83
while True :
84
+ start_time = time .time ()
84
85
with self .mutex :
85
86
# Copy the velocity for thread safety.
86
87
q_dot = self .q_dot .copy ()
87
88
running = self .running
88
89
89
90
# Stop servoing when the watchdog times out.
90
- now = time .time ()
91
- if running and now - self .watchdog > self .watchdog_timeout :
91
+ if running and start_time - self .watchdog > self .watchdog_timeout :
92
92
self .q_dot = numpy .zeros (self .num_dofs )
93
93
self .running = False
94
- logging .warning ('Servo motion timed out in %.3f seconds.' , now - self .watchdog )
94
+ logging .warning ('Servo motion timed out in %.3f seconds.' , start_time - self .watchdog )
95
95
96
96
if running :
97
97
env = self .manip .GetRobot ().GetEnv ()
@@ -122,7 +122,6 @@ def Step(self):
122
122
else :
123
123
self .running = False
124
124
logging .warning ('Servo motion hit a joint limit.' )
125
-
126
- if self .event .wait (self .period ):
125
+ if self .event .wait (max (self .period - (time .time ()- start_time ), 0. )):
127
126
break
128
127
You can’t perform that action at this time.
0 commit comments