I analyse my ulogs with Python by importing them with px4tools.
I can read the parameters and the messages of PX4 over the comand-line tool pyulog in Ubuntu. But if I would like to get this information directly with Python as well, how could I achieve that? If possible not only in Ubuntu but also on Windows, as I work on both systems.
bkueng
November 12, 2018, 6:44pm
2
Hi
Please have a look at how the scripts are doing it, you can do the same thing in python directly:
#! /usr/bin/env python
"""
Display logged messages from an ULog file
"""
from __future__ import print_function
import argparse
from .core import ULog
#pylint: disable=invalid-name
def main():
"""Commande line interface"""
parser = argparse.ArgumentParser(description='Display logged messages from an ULog file')
parser.add_argument('filename', metavar='file.ulg', help='ULog input file')
args = parser.parse_args()
This file has been truncated. show original
#! /usr/bin/env python
"""
Extract parameters from an ULog file
"""
from __future__ import print_function
import argparse
import sys
from .core import ULog
#pylint: disable=unused-variable, too-many-branches
def main():
"""Commande line interface"""
parser = argparse.ArgumentParser(description='Extract parameters from an ULog file')
parser.add_argument('filename', metavar='file.ulg', help='ULog input file')
parser.add_argument('-d', '--delimiter', dest='delimiter', action='store',
This file has been truncated. show original
That is exactly what I was looking for. Thanks a lot
DRUMKC
June 27, 2019, 3:09am
4
I try using this parser and keep getting this message:
SyntaxError: from future imports must occur at the beginning of the file
Does anyone know what the problem could be?
bkueng
July 10, 2019, 9:56am
5
Hi @DRUMKC
The error message tells you already: the future import must be moved to the top of the file.