def main(): bbcon = BBCON() follow_line = FollowLine(bbcon) obstruction = Obstruction(bbcon) bbcon.add_behaviour(follow_line) bbcon.add_behaviour(obstruction) print("before button") ZumoButton().wait_for_press() print("after button") while True: bbcon.run_one_timestep()
def start(): bbcon = BBCON() arb = Arbitrator(bbcon) motor = Motors() reflect_sens = ReflectanceSensors(False) cam = Camera() ir = IR() ultra = Ultrasonic() bbcon.add_motobs(motor) bbcon.set_arb(arb) bbcon.add_behaviour(AvoidObj(bbcon, ultra, ir)) bbcon.add_behaviour(Behaviour_line_follower(bbcon, reflect_sens)) bbcon.add_behaviour(fub(bb=bbcon)) #behaviour avoid blue, has to be added last, do not change this, will screw up bbcon code bbcon.add_behaviour(Behaviour_avoid_blue(bb=bbcon, cam=cam, ultra=ultra)) bbcon.add_sensob(reflect_sens) bbcon.add_sensob(ir) bbcon.add_sensob(ultra) #cam has to be added last, will screw up bbcon code if not bbcon.add_sensob(cam) butt = ZumoButton() butt.wait_for_press() print("Start zumo") while True: bbcon.run_one_timestep()