def main(): motob = Motob() bbcon = Bbcon(motob) arbitrator = Arbitrator(bbcon) bbcon.set_arbitrator(arbitrator) # sensorer og sensob ult_sensor = Ultrasonic() ref_sensor = ReflectanceSensors(auto_calibrate=False) reflectance_sensob = ReflectanceSensob(ref_sensor) ultrasonic_sensob = UltrasonicSensob(ult_sensor) camera_sensob = CameraSensob(None, color=0) #behaviors dont_crash = DontCrash(bbcon, ultrasonic_sensob) follow_line = FollowLine(bbcon, reflectance_sensob) find_object = FindColoredObject(bbcon, camera_sensob) bbcon.add_behavior(dont_crash) bbcon.add_behavior(follow_line) bbcon.add_behavior(find_object) try: ZumoButton().wait_for_press() while not bbcon.object_found: # Kjører helt til vi finner objektet bbcon.run_one_timestep() except KeyboardInterrupt: motob.motor.stop() finally: GPIO.cleanup()
def main(): bbcon = Bbcon() lineRider = FollowLine(bbcon) obstruction = Obstruction(bbcon) photo = Photo(bbcon) bbcon.add_behavior(lineRider) bbcon.add_behavior(obstruction) bbcon.add_behavior(photo) ZumoButton().wait_for_press() while True: bbcon.run_one_timestep()
def main(): """ Runs the program """ bbcon = Bbcon() #drive_forward = DriveForward(bbcon) follow_line = FollowLine(bbcon) obstruction = Obstruction(bbcon) # Legger til behavior #bbcon.add_behavior(drive_forward) bbcon.add_behavior(follow_line) bbcon.add_behavior(obstruction) ZumoButton().wait_for_press() while True: bbcon.run_one_timestep()