def __init__(self):
        self.mavlink = mav.Mavlink()
        self.controller_mav = mav.Controller()
        self.gimbal_mav = mav.Gimbal()
        self.can = can_pro.CAN4Gimbal(3, 0, 0)
        self.gui = GimGui(self.mavlink, self.controller_mav, self.gimbal_mav,
                          self.can)

        self.threads = []
        t1 = threading.Thread(target=self.mav_update)
        t2 = threading.Thread(target=self.gui.lab_change)
        t3 = threading.Thread(target=self.gui.param_change)
        t4 = threading.Thread(target=self.can_update)
        self.threads.append(t1)
        self.threads.append(t2)
        self.threads.append(t3)
        self.threads.append(t4)
Ejemplo n.º 2
0
    def __init__(self):
        self.gim = can_pro_gimbal.CAN4Gimbal()

        self.gim.can_open()

        self.root = tk.Tk()

        self.b_p_enc = tk.Button(self.root,
                                 text='P ENC',
                                 command=self.send_p_enc).pack()
        self.b_r_enc = tk.Button(self.root,
                                 text='R ENC',
                                 command=self.send_r_enc).pack()
        self.b_y_enc = tk.Button(self.root,
                                 text='Y ENC',
                                 command=self.send_y_enc).pack()
        self.b_r_rps = tk.Button(self.root,
                                 text='R RPS',
                                 command=self.send_r_rps_mcu).pack()
        self.b_p_rps = tk.Button(self.root,
                                 text='P RPS',
                                 command=self.send_p_rps_mcu).pack()
        self.b_y_rps = tk.Button(self.root,
                                 text='Y RPS',
                                 command=self.send_y_rps_mcu).pack()
        self.b_r_rpl_n = tk.Button(self.root,
                                   text='R RPL N',
                                   command=self.send_r_rpl_mcu_n).pack()
        self.b_r_rpl_h = tk.Button(self.root,
                                   text='R RPL H',
                                   command=self.send_r_rpl_mcu_h).pack()
        self.b_p_rpl_n = tk.Button(self.root,
                                   text='P RPL N',
                                   command=self.send_p_rpl_mcu_n).pack()
        self.b_p_rpl_h = tk.Button(self.root,
                                   text='P RPL H',
                                   command=self.send_p_rpl_mcu_h).pack()
        self.b_y_rpl_n = tk.Button(self.root,
                                   text='Y RPL N',
                                   command=self.send_y_rpl_mcu_n).pack()
        self.b_y_rpl_h = tk.Button(self.root,
                                   text='Y RPL H',
                                   command=self.send_y_rpl_mcu_h).pack()
        self.b_r_rs = tk.Button(self.root,
                                text='R RS',
                                command=self.send_r_rs_mcu).pack()
        self.b_p_rs = tk.Button(self.root,
                                text='P RS',
                                command=self.send_p_rs_mcu).pack()
        self.b_y_rs = tk.Button(self.root,
                                text='Y RS',
                                command=self.send_y_rs_mcu).pack()
        self.b_r_rl = tk.Button(self.root,
                                text='R RL',
                                command=self.send_r_rl_mcu).pack()
        self.b_p_rl = tk.Button(self.root,
                                text='P RL',
                                command=self.send_p_rl_mcu).pack()
        self.b_y_rl = tk.Button(self.root,
                                text='Y RL',
                                command=self.send_y_rl_mcu).pack()

        self.root.protocol('WM_DELETE_WINDOW', self.closing)

        self.ready2decode = 0

        self.rx_mail = []

        self.threads = []
        t1 = threading.Thread(target=self.recv)
        t2 = threading.Thread(target=self.decode)
        self.threads.append(t1)
        self.threads.append(t2)
def lab_change():
    #global var_roll
    while True:
        set_tk_attitude_var()
        #set_tk_control_param_var()
        time.sleep(0.01)
        #root.update()


def param_change():
    while True:
        set_tk_control_param_var()
        time.sleep(1)


can = can_pro.CAN4Gimbal()
can.can_open()


def can_update():
    while True:
        can.high_level_read()
        time.sleep(0.01)


threads = []
t1 = threading.Thread(target=get_data_1)
t2 = threading.Thread(target=lab_change)
t3 = threading.Thread(target=param_change)
can_thread = threading.Thread(target=can_update)
threads.append(t1)
Ejemplo n.º 4
0
 def __init__(self):
     self.mavlink = mav.Mavlink()
     self.controller_mav = mav.Controller()
     self.gimbal_mav = mav.Gimbal()
     self.can = can_pro.CAN4Gimbal(3, 0, 0)