def __init__(self): self.seq_nr = 1 # TODO cambiar a 30 ms en vez de 200 self.timer_t = 0.030 self.com_watchdog_timer = threading.Timer(self.timer_t, self.commwdg) self.lock = threading.Lock() self.speedArribaAbajo = 0.6 self.speed = 0.2 self.at(at_config, "general:navdata_demo", "TRUE") self.video_pipe, video_pipe_other = multiprocessing.Pipe() self.nav_pipe, nav_pipe_other = multiprocessing.Pipe() self.com_pipe, com_pipe_other = multiprocessing.Pipe() self.network_process = arnetwork.ARDroneNetworkProcess(nav_pipe_other, video_pipe_other, com_pipe_other) self.network_process.start() self.ipc_thread = arnetwork.IPCThread(self) self.ipc_thread.start() self.image = "" # Creo e inicializo navdata. self.navdata = dict() self.navdata['battery'] = 0 self.navdata['theta'] = 0 self.navdata['phi'] = 0 self.navdata['psi'] = 0 self.navdata['altitude'] = 0 self.time = 0 # Para enviarle muchas veces el ultimo comando cada timer_t segundos. self.ultimoFueDerechaIzquierdaArribaAbajo = False # 1 - derecha. 2 - izquierda. 3 - arriba. 4 - abajo. self.ultimoMovimiento = 0
def __init__(self): self.seq_nr = 1 self.timer_t = 0.2 self.com_watchdog_timer = threading.Timer(self.timer_t, self.commwdg) self.lock = threading.Lock() self.speed = 0.2 self.at(at_config, "general:navdata_demo", "TRUE") self.video_pipe, video_pipe_other = multiprocessing.Pipe() self.nav_pipe, nav_pipe_other = multiprocessing.Pipe() self.com_pipe, com_pipe_other = multiprocessing.Pipe() self.network_process = arnetwork.ARDroneNetworkProcess( nav_pipe_other, video_pipe_other, com_pipe_other) self.network_process.start() self.ipc_thread = arnetwork.IPCThread(self) self.ipc_thread.start() self.image = "" self.navdata = dict() self.time = 0 # AMN if you're using the calls to set speed in various directions, # we need to store the current values here self.speed_updown = 0.0 self.speed_forwardback = 0.0 self.speed_leftright = 0.0 self.speed_yaw = 0.0 self.set_drone_speeds()
def __init__(self, is_ar_drone_2=False, hd=False): self.seq_nr = 1 self.timer_t = 0.2 self.com_watchdog_timer = threading.Timer(self.timer_t, self.commwdg) self.lock = threading.Lock() self.speed = 0.2 self.hd = hd if (self.hd): self.image_shape = (720, 1280, 3) else: self.image_shape = (360, 640, 3) time.sleep(0.5) self.config_ids_string = [SESSION_ID, USER_ID, APP_ID] self.configure_multisession(SESSION_ID, USER_ID, APP_ID, self.config_ids_string) self.set_session_id(self.config_ids_string, SESSION_ID) time.sleep(0.5) self.set_profile_id(self.config_ids_string, USER_ID) time.sleep(0.5) self.set_app_id(self.config_ids_string, APP_ID) time.sleep(0.5) self.set_video_bitrate_control_mode(self.config_ids_string, "1") time.sleep(0.5) self.set_video_bitrate(self.config_ids_string, "10000") time.sleep(0.5) self.set_max_bitrate(self.config_ids_string, "10000") time.sleep(0.5) self.set_fps(self.config_ids_string, "30") time.sleep(0.5) if (self.hd): self.set_video_codec(self.config_ids_string, 0x83) else: self.set_video_codec(self.config_ids_string, 0x81) self.last_command_is_hovering = True self.com_pipe, com_pipe_other = multiprocessing.Pipe() self.navdata = dict() self.navdata[0] = dict( zip([ 'ctrl_state', 'battery', 'theta', 'phi', 'psi', 'altitude', 'vx', 'vy', 'vz', 'num_frames' ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) self.network_process = arnetwork.ARDroneNetworkProcess( com_pipe_other, is_ar_drone_2, self) self.network_process.start() self.image = np.zeros(self.image_shape, np.uint8) self.time = 0 self.last_command_is_hovering = True time.sleep(1.0) self.at(at_config_ids, self.config_ids_string) self.at(at_config, "general:navdata_demo", "TRUE")
def __init__(self): self.seq_nr = 1 self.timer_t = 0.2 self.com_watchdog_timer = threading.Timer(self.timer_t, self.commwdg) self.lock = threading.Lock() self.speed = 0.2 self.at(at_config, "general:navdata_demo", "TRUE") self.nav_pipe, nav_pipe_other = multiprocessing.Pipe() self.com_pipe, com_pipe_other = multiprocessing.Pipe() self.network_process = arnetwork.ARDroneNetworkProcess( nav_pipe_other, com_pipe_other) self.network_process.start() self.ipc_thread = arnetwork.IPCThread(self) self.ipc_thread.start() self.navdata = dict() self.time = 0
def __init__(self): self.seq_nr = 1 self.timer_t = 0.2 self.com_watchdog_timer = threading.Timer(self.timer_t, self.commwdg) self.lock = threading.Lock() self.speed = 1.0 self.nav_pipe, nav_pipe_other = multiprocessing.Pipe() self.com_pipe, com_pipe_other = multiprocessing.Pipe() self.network_process = arnetwork.ARDroneNetworkProcess( nav_pipe_other, com_pipe_other) self.network_process.start() self.ipc_thread = arnetwork.IPCThread(self) self.ipc_thread.start() self.image = "" self.navdata = dict() self.time = 0
def __init__(self, ip='192.168.1.1'): self.seq_nr = 1 self.ip = ip self.timer_t = 0.2 self.com_watchdog_timer = threading.Timer(self.timer_t, self.commwdg) self.lock = threading.Lock() self.speed = 0.2 self.at = AT(ip, self.lock, self.com_watchdog_timer) self.at.at_config("general:navdata_demo", "TRUE") self.video_pipe, video_pipe_other = multiprocessing.Pipe() self.nav_pipe, nav_pipe_other = multiprocessing.Pipe() self.com_pipe, com_pipe_other = multiprocessing.Pipe() self.network_process = arnetwork.ARDroneNetworkProcess( ip, nav_pipe_other, video_pipe_other, com_pipe_other) self.network_process.start() self.ipc_thread = arnetwork.IPCThread(self) self.ipc_thread.start() self.image = "" self.navdata = dict() self.time = 0
def __init__(self, is_ar_drone_2=False): # TODO open control port and send AT*CTRL with mode 4 to get a dump of Drone details, including version, so # the above Boolean is unnecessary. self.seq_nr = 1 self.timer_t = 0.2 self.com_watchdog_timer = threading.Timer(self.timer_t, self.commwdg) self.lock = threading.Lock() self.speed = 0.2 self.at(at_config, "general:navdata_demo", "TRUE") self.video_pipe, video_pipe_other = multiprocessing.Pipe() self.nav_pipe, nav_pipe_other = multiprocessing.Pipe() self.com_pipe, com_pipe_other = multiprocessing.Pipe() self.network_process = arnetwork.ARDroneNetworkProcess( nav_pipe_other, video_pipe_other, com_pipe_other, is_ar_drone_2) self.network_process.start() self.ipc_thread = arnetwork.IPCThread(self) self.ipc_thread.start() self.image = "" self.navdata = dict() self.time = 0
def __init__(self): # starting params self.seq_nr = 1 self.timer_t = 0.2 self.com_watchdog_timer = threading.Timer(self.timer_t, self.commwdg) self.lock = threading.Lock() self.speed = 0.2 self.at(at_config, "video:video_channel", "2") self.at(at_config, "general:navdata_demo", "TRUE") self.int_image = None self.ext_image = None self.camera = 1 # 1 for internal, 0 for external self.navdata = dict() self.time = 0 # nav data process self.nav_pipe, nav_pipe_other = multiprocessing.Pipe() self.com_pipe1, com_pipe_other1 = multiprocessing.Pipe() self.nav_process = arnetwork.ARDroneNetworkProcess( nav_pipe_other, com_pipe_other1) self.nav_process.start() # internal video feed process self.video_pipe, video_pipe_other = multiprocessing.Pipe() self.com_pipe2, com_pipe_other2 = multiprocessing.Pipe() self.video_process = arnetwork.ARDroneVideoProcess( video_pipe_other, com_pipe_other2) self.video_process.start() # external video feed process if ARDRONE_EXT_CAM: self.ext_video_pipe, ext_video_pipe_other = multiprocessing.Pipe() self.com_pipe3, com_pipe_other3 = multiprocessing.Pipe() self.ext_video_process = arnetwork.ARDroneExternalVideoProcess( ext_video_pipe_other, com_pipe_other3) self.ext_video_process.start() # IPC thread self.ipc_thread = arnetwork.IPCThread(self) self.ipc_thread.start()
def __init__(self): self.seq_nr = 1 self.timer_t = 0.2 self.com_watchdog_timer = threading.Timer(self.timer_t, self.commwdg) self.lock = threading.Lock() self.speed = 0.2 self.at(at_config, "general:navdata_demo", "TRUE") #at_custom_parrotauth() #self.at(at_custom_pmode) #self.at(at_custom_misc) #self.at(at_custom_ref) self.video_pipe, video_pipe_other = multiprocessing.Pipe() self.nav_pipe, nav_pipe_other = multiprocessing.Pipe() self.com_pipe, com_pipe_other = multiprocessing.Pipe() self.trigger_pipe, trigger_pipe_other = multiprocessing.Pipe() self.network_process = arnetwork.ARDroneNetworkProcess( nav_pipe_other, video_pipe_other, com_pipe_other) self.network_process.start() self.ipc_thread = arnetwork.IPCThread(self, trigger_pipe_other) self.ipc_thread.start() self.image = "" self.navdata = dict() self.time = 0
def __init__(self, frame_size=(360,640), recording=None): self.seq_nr = 1 self.timer_t = 0.2 self.com_watchdog_timer = threading.Timer(self.timer_t, self.commwdg) self.lock = threading.Lock() self.speed = 0.2 self.at(at_config, "general:navdata_demo", "TRUE") self.video_pipe, video_pipe_other = multiprocessing.Pipe() self.nav_pipe, nav_pipe_other = multiprocessing.Pipe() self.com_pipe, com_pipe_other = multiprocessing.Pipe() self.network_process = arnetwork.ARDroneNetworkProcess( nav_pipe_other, video_pipe_other, com_pipe_other, frame_size, recording) self.network_process.start() self.ipc_thread = arnetwork.IPCThread(self, recording) self.ipc_thread.start() self.image = "" self.navdata = dict() self.time = 0 self.camera = 0 # 0 = front, 1 = bottom self.switch_camera(self.camera) self.recording = recording if self.recording != None: self.commandsfile = open(self.recording + '/commands.tsv', mode='w') self.epoch = datetime.datetime(1970, 1, 1)