TauLabs/TauLabs — pull request #1072 by solidgoldbomb (2014-01-13 04:56:27+00:00)
Title: Python UAVO XML and UAVO log parser

This adds a python library for parsing UAVO XML files and builds a log parser/viewer tool on top of the UAVO library.

The log viewer will find the UAVO XML files from any git hash that exists in the local repository.

Basically, this allows you to do something like this:
````
./python/logview.py log_20130824_020632.tll
````
And see something like this:
````
$ ./python/logview.py log_20130824_020632.tll
Reading Log file: log_20130824_020632.tll
Log file is based on git hash: 271d0e91
Exporting UAVO XML files from git repo
Found 101 unique UAVO definitions
Processing Log File Records
Processed 42926 Log File Records

Welcome to pylab, a matplotlib-based Python environment [backend: TkAgg].
For more information, type 'help(pylab)'.
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
Type "copyright", "credits" or "license" for more information.

IPython 0.13.2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

Analyzing log file: /home/stac/taulabs/TauLabs/log_20130824_020632.tll

In [1]: %whos
Variable Type Data/Info
---------------------------------------
base_time int 2927659517
githash str 271d0e91
log_file str /home/stac/taulabs/TauLab<...>s/log_20130824_020632.tll
uavo_defs UAVOCollection {'1336d0f4': taulabs.uavo<...>18', name='PathDesired')}
uavo_list UAVOList [UAVO_Waypoint(name='Wayp<...>-127, -127, -127, -127))]

In [2]:

````

This drops you into an ipython shell in a full pylab (ie. numpy + matplotlib) environment where you can plot the data like this:
````
accels = uavo_list.as_numpy_array(UAVO_Accels)
accels['time'] -= base_time
plot(accels['time'], accels['x'], accels['time'], accels['y'], accels['time'], accels['z']);
````
or like this:
````
nedpos = uavo_list.as_numpy_array(UAVO_NEDPosition)
t, n, e, d = zip(*map(operator.itemgetter('time', 'North', 'East', 'Down'), nedpos))
t = map(lambda x: x - base_time, t)
plot(n,e);
xlabel('North');
ylabel('East');
legend(('NED Position',), loc='best');
title('NED Position, North vs. East');
````
![screenshot from 2014-01-12 23 55 09](https://f.cloud.github.com/assets/71638/1898139/f882e9e4-7c0e-11e3-9e74-2c241459c934.png)