mavtester.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 '''
4 test mavlink messages
5 '''
6 from __future__ import print_function
7 
8 from pymavlink import mavtest, mavutil
9 
10 from argparse import ArgumentParser
11 parser = ArgumentParser(description=__doc__)
12 
13 parser.add_argument("--baudrate", type=int,
14  help="master port baud rate", default=115200)
15 parser.add_argument("--device", required=True, help="serial device")
16 parser.add_argument("--source-system", dest='SOURCE_SYSTEM', type=int,
17  default=255, help='MAVLink source system for this GCS')
18 args = parser.parse_args()
19 
21  '''wait for a heartbeat so we know the target system IDs'''
22  print("Waiting for APM heartbeat")
23  msg = m.recv_match(type='HEARTBEAT', blocking=True)
24  print("Heartbeat from APM (system %u component %u)" % (m.target_system, m.target_system))
25 
26 # create a mavlink serial instance
27 master = mavutil.mavlink_connection(args.device, baud=args.baudrate, source_system=args.SOURCE_SYSTEM)
28 
29 # wait for the heartbeat msg to find the system ID
30 wait_heartbeat(master)
31 
32 print("Sending all message types")
33 mavtest.generate_outputs(master.mav)
34 


mavlink
Author(s): Lorenz Meier
autogenerated on Sun Apr 7 2019 02:06:02