# remember to set True/False for the wifi depending on if you are using the wifi or the BLE to connect # the address can be empty if you are using wifi mambo = Bebop() print("trying to connect to mambo now") success = mambo.connect(num_retries=3) print("connected: %s" % success) if (success): # get the state information print("sleeping") mambo.smart_sleep(1) mambo.ask_for_state_update() mambo.smart_sleep(1) # setup the extra window to draw the markers in cv2.namedWindow("ExampleWindow") cv2.namedWindow("dst") print("Preparing to open vision") mambo.pan_tilt_camera_velocity(-90, 0, 1) mamboVision = DroneVisionGUI( mambo, is_bebop=True, buffer_size=200, user_code_to_run=demo_mambo_user_vision_function, user_args=(mambo, )) mamboVision.set_user_callback_function( draw_second_pictures, user_callback_args=(mamboVision, )) mamboVision.open_video()
user_callback_args=None) success = bebopVision.open_video() if (success): print("Vision successfully started!") print("sleeping") bebop.smart_sleep(2) bebop.ask_for_state_update() bebop.safe_takeoff(10) bebop.smart_sleep(2) print("Moving the camera using velocity") bebop.pan_tilt_camera_velocity(pan_velocity=0, tilt_velocity=-2, duration=4) bebop.fly_direct(roll=0, pitch=10, yaw=0, vertical_movement=0, duration=10) if (found == False): print("timeout") bebop.safe_land(10) print("Stopping vision") bebopVision.close_video()