Exemplo n.º 1
0
#!/usr/bin/env python

import sys, struct, time, os

import establish_connection as con

# Create an connection (by default device = '/dev/ttyAMA0', baudrate = 57600)
master = con.create_mavlink_connection()
# Declaring variables
t1 = time.time()
counts = {}
bytes_sent = 0
bytes_recv = 0

# Heartbeat confirmation
print("Wait for heartbeat")
master.wait_heartbeat()
print("Heartbeat received!")

# Test BW
while True:
    master.mav.heartbeat_send(1, 1, 1, 1, 1, 1)
    #master.mav.sys_status_send(1, 2, 3, 4, 5, 6, 7, 1, 1, 1, 1, 1, 1)
    #master.mav.attitude_send(1, 2, 3, 4, 5, 6, 7)
    #master.mav.vfr_hud_send(1, 2, 3, 4, 5, 6)  	
    while master.port.inWaiting() > 0:
        m = master.recv_msg()
        if m == None: break
        if m.get_type() not in counts:
            counts[m.get_type()] = 0
        counts[m.get_type()] += 1
Exemplo n.º 2
0
 def __init__(self, name, cmd_fcn, need_param = False):
     self.name       = name
     self.mavfile     = establish_connection.create_mavlink_connection()
     self.cmd_fcn    = cmd_fcn
     self.need_param = need_param