4 check bandwidth of link 6 from __future__
import print_function
9 from pymavlink
import mavutil
12 from argparse
import ArgumentParser
13 parser = ArgumentParser(description=__doc__)
15 parser.add_argument(
"--baudrate", type=int,
16 help=
"master port baud rate", default=115200)
17 parser.add_argument(
"--device", required=
True, help=
"serial device")
18 args = parser.parse_args()
23 master = mavutil.mavlink_connection(args.device, baud=args.baudrate)
34 master.mav.heartbeat_send(1, 1)
35 master.mav.sys_status_send(1, 2, 3, 4, 5, 6, 7)
36 master.mav.gps_raw_send(1, 2, 3, 4, 5, 6, 7, 8, 9)
37 master.mav.attitude_send(1, 2, 3, 4, 5, 6, 7)
38 master.mav.vfr_hud_send(1, 2, 3, 4, 5, 6)
42 while master.port.inWaiting() > 0:
49 if m.get_type()
not in counts:
51 counts[m.get_type()] = 0
53 counts[m.get_type()] += 1
58 print(
"%u sent, %u received, %u errors bwin=%.1f kB/s bwout=%.1f kB/s" % (
59 master.mav.total_packets_sent,
60 master.mav.total_packets_received,
61 master.mav.total_receive_errors,
62 0.001*(master.mav.total_bytes_received-bytes_recv)/(t2-t1),
63 0.001*(master.mav.total_bytes_sent-bytes_sent)/(t2-t1)))
64 bytes_sent = master.mav.total_bytes_sent
65 bytes_recv = master.mav.total_bytes_received