February 2020
Intermediate to advanced
432 pages
10h 50m
English
The following cell will run for approximately 5 seconds and will report encoder readings:
GPG.set_motor_dps(GPG.MOTOR_LEFT | GPG.MOTOR_RIGHT, 100)start = time.time()lapse = 0while lapse < 5: lapse = time.time() - start time.sleep(0.5) print("LEFT: {} RIGHT:{}".format(GPG.get_motor_status(GPG.MOTOR_LEFT),GPG.get_motor_status(GPG.MOTOR_RIGHT)))passed_test = GPG.get_motor_status(GPG.MOTOR_LEFT)[0]==0 and GPG.get_motor_status(GPG.MOTOR_RIGHT)[0]==0GPG.set_motor_dps(GPG.MOTOR_LEFT | GPG.MOTOR_RIGHT, 0)if passed_test: print("Test passed.")else: print("Test failed.")
And these are the results:
LEFT: [0, 26, 3095, 101] RIGHT:[0, 26, 4806, 101]LEFT: [0, 26, 3146, 101] RIGHT:[0, 28, 4856, 101]LEFT: [0, 26, 3196, 101] RIGHT:[0, ...
Read now
Unlock full access