Open Loop
The StudioBot can move around without any feedback on what the wheels are doing.
import time
from StudioBot import *
#move forward at speed 80 for 1 second
drivetrain.set_effort(0.5,0.5)
time.sleep(1)
drivetrain.stop()import board
import time
from StudioBot import *
drivetrain.set_effort(0.5,0.5)
while True:
try:
distance = sonar.get_distance()
print(distance)
if distance < 20:
drivetrain.stop()
except RuntimeError:
print("Retrying!")
time.sleep(0.1)Last updated