def update_reference_distance(): ttg.blink_both() d = ttg.get_distance() time.sleep(0.2) d += ttg.get_distance() time.sleep(0.2) d += ttg.get_distance() m = d/3 return m
# alert will be sent. In any case, the next state # will be reached after the pass check. if state == 2: print "i'm on state 2" ttg.turn_on_L1() ttg.turn_on_L2() is_root = root.wait(20) ttg.turn_off_L1() ttg.turn_off_L2() if not is_root: print 'Alarm to TT' ttrest.ttwrite('AccesViolation','1') else: print 'Aborted alarm' ttrest.ttwrite('AbortedAlarm','1') ttg.blink_both() consume_root() state = 3 # States 3 and 4 are equivalent to 0 and 2 if state == 3: print "i'm on state 3" if b: state = 4 samp_pos = 0 # negative samples samp_total = 0 if state == 4: print "i'm on state 4" if b: samp_pos+=1 samp_total+=1