mav_accel.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 '''
4 show accel calibration for a set of logs
5 '''
6 from __future__ import print_function
7 
8 from argparse import ArgumentParser
9 parser = ArgumentParser()
10 parser.add_argument("--no-timestamps", dest="notimestamps", action='store_true', help="Log doesn't have timestamps")
11 parser.add_argument("--planner", action='store_true', help="use planner file format")
12 parser.add_argument("--robust", action='store_true', help="Enable robust parsing (skip over bad data)")
13 parser.add_argument("logs", metavar="LOG", nargs="+")
14 
15 args = parser.parse_args()
16 
17 from pymavlink import mavutil
18 
19 
20 def process(logfile):
21  '''display accel cal for a log file'''
22  mlog = mavutil.mavlink_connection(filename,
23  planner_format=args.planner,
24  notimestamps=args.notimestamps,
25  robust_parsing=args.robust)
26 
27  m = mlog.recv_match(type='SENSOR_OFFSETS')
28  if m is not None:
29  z_sensor = (m.accel_cal_z - 9.805) * (4096/9.81)
30  print("accel cal %5.2f %5.2f %5.2f %6u %s" % (
31  m.accel_cal_x, m.accel_cal_y, m.accel_cal_z,
32  z_sensor,
33  logfile))
34 
35 
36 total = 0.0
37 for filename in args.logs:
38  process(filename)


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