Parsing "tlm-data-logger"

Hey there!

I am willing to use the data logger CLI tool a.k.a. tlm-data-logger to provide feedback to ML models. Despite I know there are parsing tools available for logs recorded with the --datalog option at Sphinx, I know no script with the same functionality for tlm-data-logger.

Do you use or know any? Do you mind sharing it? If not, what would be the easiest way to parse its output in a nearly-real-time fashion? I’d run it like tlm-data-logger ... | script.py.

Thanks in advance!

espetro

Hello,

You probably want to look at the telemetry library itself:

You need a workspace to build this library. You can use the ARSDK workspace if you already have it installed:
https://developer.parrot.com/docs/SDK3/#how-to-build-the-sdk
The ARSDK workspace does not contain the telemetry library but you can clone it inside the packages directory along with its dependencies (I believe libshdata is required).

Then, inside your workspace, you can build tlm-data-logger:

./build.sh -p arsdk-native -A tlm-data-logger

And execute it while sphinx is running:

. out/arsdk-native/staging/native-wrapper.sh
tlm-data-logger -r 0 inet:127.0.0.1:9060

Now, you can have a look at the source code in telemetry/tools/gndctrl_datalogger.cpp. Basically, GndCtrlApp::sample is called each time a new sample is received. The parameters sectionId and varId can help you identify the variables you are interested in.

If you plan on parsing your data in python, you may prefer to reproduce the code contained in this file directly in your application:


It works the same way as tlm-data-logger.

It’d be nice to see some comments in the code, it’s quite daunting to get into such a file when even the filename isn’t understandable.

Anyway, so far I’ve been trying to run tlm-data-logger using a pipe

tlm-data-logger inet:127.0.0.1:9060 | rostopic pub sphinx/raw std_msgs/String

also like

tlm-data-logger inet:127.0.0.1:9060 | process_tlm.py

Neither way I got the data piped from the tlm tool. I think this may be because the first process piped doesn’t end, so the next one isn’t executed.

I am currently logging all the data generated in a file, then reading it from a Python script

tlm-data-logger inet:127.0.0.1:9060 > telemetry_log.txt

However, this way is quite inefficient. With this knowledge, am I able to reproduce some of your code or toolings in a such a way that the telemetry datalogs can be directly inputted in a Python script (without using intermediate files) ?

Thanks in advance!

Also, this script has heavy dependencies on pomp Py module, which seems to be somewhat related to Parrot’s libpomp. I tried installing both and running the script, but I’m still getting pomp-related errors. Is there any documentation available?

Thank you

Hello
I want to use tlm-data-logger on another computer without installing Sphinix. How can I do?
Thanks

Hello,
tlm-data-logger is not distributed as a standalone. You’ll have to either install parrot-sphinx or build tlm-data-logger on that machine:

cd $HOME
mkdir -p code/parrot-groundsdk
cd code/parrot-groundsdk
pwd
repo init -u https://github.com/Parrot-Developers/groundsdk-manifest.git
repo sync
git clone https://github.com/Parrot-Developers/libshdata.git packages/common/libshdata
git clone https://github.com/Parrot-Developers/telemetry.git packages/common/telemetry
./build.sh -p olympe -A tlm-data-logger final
. out/olympe-linux/staging/native-wrapper.sh
tlm-data-logger inet:<sphinx_ip_address>:9060

The $HOME/code/parrot-groundsdk/out/olympe-linux/final/usr directory will contain the tlm-data-logger executable and its dependencies.

Thanks. I will try this.

Hello @ocrave ,
I tried to compile but I the following error:
[E] Task ‘alchemy’ failed (Command failed (returncode = 2))

The machine is Jetson TX2 (arm64).
I think the problem is the configuration:
TARGET_ARCH = aarch64
What can I do?
Thanks

Have you tried this command?

TARGET_ARCH=arm64 ./build.sh -p olympe -A tlm-data-logger final

Thanks ocrave,

No, but I will try.
I have also tried to use SDK (POSITIONCHANGED) to get the position. But the time between events is very long (about 1 second). How can I decrease this time? I would like 100 milliseconds of time between measurements.
Equivalent to the command “tlm-data-logger -s 100 inet: 127.0.0.1: 9060”
thanks

Not work

nvidia@tegra-ubuntu:~/code/parrot-groundsdk$ TARGET_ARCH=arm64 ./build.sh -p olympe -A tlm-data-logger final
[I] Starting task 'alchemy' with args: tlm-data-logger final
[I] In '/home/nvidia/code/parrot-groundsdk': ALCHEMY_TARGET_CONFIG_DIR="/home/nvidia/code/parrot-groundsdk/products/olympe/linux/config" ALCHEMY_TARGET_OUT="/home/nvidia/code/parrot-groundsdk/out/olympe-linux" ALCHEMY_TARGET_PRODUCT="olympe" ALCHEMY_TARGET_PRODUCT_VARIANT="linux" ALCHEMY_TARGET_SCAN_ADD_DIRS=" /home/nvidia/code/parrot-groundsdk/packages" ALCHEMY_TARGET_SCAN_PRUNE_DIRS=" /home/nvidia/code/parrot-groundsdk" ALCHEMY_USE_COLORS="1" ALCHEMY_WORKSPACE_DIR="/home/nvidia/code/parrot-groundsdk" PARROT_BUILD_PROP_GROUP="drones" PARROT_BUILD_PROP_PRODUCT="olympe" PARROT_BUILD_PROP_PROJECT="olympe" PARROT_BUILD_PROP_UID="olympe-linux-20190925-2020-0.0.0" PARROT_BUILD_PROP_VARIANT="linux" PARROT_BUILD_PROP_VERSION="0.0.0" /home/nvidia/code/parrot-groundsdk/build/alchemy/scripts/alchemake -j 1 tlm-data-logger final
----------------------------------------------------------------------
+ ALCHEMY_WORKSPACE_DIR = /home/nvidia/code/parrot-groundsdk
+ TARGET_PRODUCT = olympe
+ TARGET_PRODUCT_VARIANT = linux
+ TARGET_OS = linux
+ TARGET_OS_FLAVOUR = native
+ TARGET_LIBC = native
+ TARGET_ARCH = arm64
+ TARGET_CPU = 
+ TARGET_OUT = /home/nvidia/code/parrot-groundsdk/out/olympe-linux
+ TARGET_CONFIG_DIR = /home/nvidia/code/parrot-groundsdk/products/olympe/linux/config
+ TARGET_CC_PATH = /usr/bin/cc
+ TARGET_CC_VERSION = 5.4.0
----------------------------------------------------------------------
Scanning /home/nvidia/code/parrot-groundsdk/packages for makefiles...
Found 45 makefiles
Found 105 modules
Computing modules dependencies...
Checking modules dependencies...
/home/nvidia/code/parrot-groundsdk/build/alchemy/main.mk:360: *** /home/nvidia/code/parrot-groundsdk/packages/common/ffmpeg: module 'ffmpeg-libav' depends on unknown module 'zlib'.  Stop.
[E] Task 'alchemy' failed (Command failed (returncode=2))

Finally I was able to compile with the code:

‘/home/pj/parrot/out/arsdk-native/staging/native-wrapper.sh’ ./build.sh -p arsdk-native -A tlm-data-logger

thanks

1 Like