Skip to content

Commit b126b3c

Browse files
committed
Provide more detail about why time.* are bad and Robot.* are better
1 parent 3059fe8 commit b126b3c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

simulator/programming/time.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ title: Simulated Time
99

1010
In the simulated environment, time advances only at the pace that the simulator
1111
is run and in cooperation with the controller code (such as the code controlling
12-
your robot). As a result, using the `time` method to know how long your robot has been
13-
running for or `sleep` method to wait for some duration is the most reliable way of
14-
implementing precise movements in your robot
12+
your robot). As a result, using `time.time` to know how long your robot has been
13+
running for or `time.sleep` to wait for some duration will have unpredictable
14+
results, especially when run on a computer other than the one you are developing
15+
on (such as during the competition).
16+
17+
Instead your code should explicitly signal to the simulator when it is ready for
18+
time to advance and should query for the current time from the simulator. This
19+
can be done by using the methods detailed below.
1520

1621
<div class="info">
1722
If you find that the simulator freezes then this indicates that your code is

0 commit comments

Comments
 (0)