-
Question Context Screenshots #!/usr/bin/env pybricks-micropython
from pybricks.tools import wait, StopWatch, DataLog
all_times = []
data = DataLog("time", "loop time", name="loop_measurements", timestamp=False)
watch = StopWatch()
watch.reset()
# measure the time for 1000 loops
for n in range(1000):
all_times.append(watch.time())
last_time = 0
for n in all_times:
data.log(n, n-last_time)
last_time = n In this experiment the EV3 brick had 3 medium motors, 3 color sensor and an ultrasonic sensor connected. It had Bluetooth disabled and was not connected by USB, when the program was running. The battery had a voltage of 7.14mV. Is there any workaround to increase the speed to have all loops faster than 5ms? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
We were actually just discussing this... 6 years ago. Seems like yesterday. 😆 See ev3dev/ev3dev#324. The graph looks very familiar. The short answer is that Linux is not a realtime operating system, so this is just how ev3dev is. So you will have to look for solutions that work around this. For example, maybe it is possible to use more than one sensor or a larger sensor (Mindsensors light array?) to be able to detect the line while the robot is still moving fast. Or maybe you can make the robot go slower when you think you are getting close to the line? |
Beta Was this translation helpful? Give feedback.
We were actually just discussing this... 6 years ago. Seems like yesterday. 😆 See ev3dev/ev3dev#324. The graph looks very familiar.
The short answer is that Linux is not a realtime operating system, so this is just how ev3dev is. So you will have to look for solutions that work around this. For example, maybe it is possible to use more than one sensor or a larger sensor (Mindsensors light array?) to be able to detect the line while the robot is still moving fast. Or maybe you can make the robot go slower when you think you are getting close to the line?