Skip to content

Commit 651d894

Browse files
committed
Fix time in ros.jl
1 parent 362b397 commit 651d894

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ros/ROS.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,17 @@ function loop_active(connection::ROSPyClientConnection, control_func!::Function)
294294
@info "State: ACTIVE"
295295
i = 1
296296
t = 0.0
297+
start_time = time()
297298
while true
298299
yield() # To allow for interrupts
299300
command = check_tcp(connection)::Union{String, Nothing}
300301
if isnothing(command)
301302
data = check_udp(connection)
302303
if !isnothing(data)
303-
iswarmup = true
304-
i, dt, t = let t0 = t; t = time(); (i+1, t - t0, t) end
304+
i, dt, t = let t0=t;
305+
t = (time() - start_time);
306+
(i+1, t - t0, t)
307+
end
305308
stop = control_func!(connection.torques, data.state, i, t, dt)
306309
stop && return STATE_STOPPED # Stop the controller gracefully
307310
any(isnan, connection.torques) && error("Control function returned NaN torques: $(connection.torques)")

0 commit comments

Comments
 (0)