mav_accel.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 '''
00004 show accel calibration for a set of logs
00005 '''
00006 
00007 import sys, time, os
00008 
00009 from argparse import ArgumentParser
00010 parser = ArgumentParser()
00011 parser.add_argument("--no-timestamps", dest="notimestamps", action='store_true', help="Log doesn't have timestamps")
00012 parser.add_argument("--planner", action='store_true', help="use planner file format")
00013 parser.add_argument("--robust", action='store_true', help="Enable robust parsing (skip over bad data)")
00014 parser.add_argument("logs", metavar="LOG", nargs="+")
00015 
00016 args = parser.parse_args()
00017 
00018 from pymavlink import mavutil
00019 
00020 
00021 def process(logfile):
00022     '''display accel cal for a log file'''
00023     mlog = mavutil.mavlink_connection(filename,
00024                                       planner_format=args.planner,
00025                                       notimestamps=args.notimestamps,
00026                                       robust_parsing=args.robust)
00027 
00028     m = mlog.recv_match(type='SENSOR_OFFSETS')
00029     if m is not None:
00030         z_sensor = (m.accel_cal_z - 9.805) * (4096/9.81)
00031         print("accel cal %5.2f %5.2f %5.2f %6u  %s" % (
00032             m.accel_cal_x, m.accel_cal_y, m.accel_cal_z,
00033             z_sensor,
00034             logfile))
00035 
00036 
00037 total = 0.0
00038 for filename in args.logs:
00039     process(filename)


mavlink
Author(s): Lorenz Meier
autogenerated on Wed Sep 9 2015 18:06:17