-
Notifications
You must be signed in to change notification settings - Fork 85
Resetting the gyro #402
Copy link
Copy link
Closed
Description
I've been trying to reset the gyro in ev3dev but haven't found a way to do so.
Every time I start the program (see below), gyro's value is 0, but I
can't figure out how to reset it inside the program.
from ev3dev import *
from mindstorms_widgets import mindstorms_widgets
gs = gyro_sensor();
assert gs.connected
gs.mode = 'GYRO-ANG'
robot = mindstorms_widgets()
robot.connect_motor( 'left' )
robot.connect_motor( 'right' )
power = 15
robot.move_tank( 'on', lr_power=[power,-power] )
# gs.value() ==0 here
while gs.value()<90:
pass
robot.move_tank( 'off', brake_at_end=True )
print gs.value() # gs.value() == 90 here (approx.)
# I thought this would reset the gyro, but it doesn't
gs = gyro_sensor();
assert gs.connected
gs.mode = 'GYRO-ANG'
print gs.value() # gs.value() == 90 hereReactions are currently unavailable