|
From: | Adam Gorski |
Subject: | Modifying Offset Stream Tag |
Date: | Sun, 21 Jun 2020 21:40:23 +0000 |
Hello community, I am currently using an out of tree module (gr-adsb) with GNU Radio 3.7 that captures received ADSB messages. I would like to change the timestamp resolution for each message received from microseconds to nanoseconds. The timestamp of each
message is declared in the demod.py (attached) by adding the start time of the block to the offset stream tag (line 111 in demod.py).
The offset stream tag is not declared within the out of tree module, but somewhere in the GNU Radio source code. There are a handful of python files within the GNU Radio source code that include the offset tag, however I believe the declaration
may lie in one of the following files (these have essentially the same code):
I would like to declare the offset tag with a nanosecond resolution. I have been able to accomplish this type of declaration with the demod block start time by calling a c function within a shared library, however I’m unsure how to do the
same within GNU Radio source code as any sort of test print statements within the two files listed above never gets displayed in the flowgraph output.
My questions:
The c function and shared library code is as follows. I chose this way due to the flowgraph code builder in GNU Radio 3.7 using python2; if I used a python3 function I believe I’d have to rewrite the flowgraph code builder in python3. Time_ns.c: #include <stdio.h> #include <time.h> long long time_ns() { struct timespec t0; clock_gettime(CLOCK_REALTIME, &t0); long long ns = (t0.tv_sec * 1000000000) + t0.tv_nsec; return ns; } int main() { return 0; } Next use this command to create a shared library: cc -fPIC -shared -o time_ns.so time_ns.c Ns.py: from ctypes import * so_file = '~/time_ns.so' c_time_ns = CDLL(so_file) c_time_ns.time_ns.restype = c_longlong return c_time_ns.time_ns() Thanks, Adam Gorski Virginia Tech Applied Research Corporation (VT-ARC) Wireless Communications Systems Engineer 410-818-3188 |
demod.py
Description: demod.py
[Prev in Thread] | Current Thread | [Next in Thread] |