discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying Offset Stream Tag


From: Jeff Long
Subject: Re: Modifying Offset Stream Tag
Date: Sun, 21 Jun 2020 19:01:40 -0400

Not familiar with this OOT module, but it sounded interesting ...

The OOT you're referring to is not the same gr-adsb in the PyBOMBs recipes. A reference to https://github.com/mhostetter/gr-adsb would be good.

The PMT being assembled on demod.py:111 is being used in messages output on the "demodulated" port, which would be connected to the "demodulated" input port on the decoder block in the same OOT. There, it is used internally and also included in messages output by the decoder block. PMTs can carry a uint64 or a double, both of which have enough resolution.

tag.offset is the sample number that a tag references.

There doesn't seem to be a GR-related problem with what you're doing, and it doesn't look like you need to modify anything unless you're having a specific problem.

On Sun, Jun 21, 2020 at 5:57 PM Adam Gorski <Adam.Gorski@vt-arc.org> wrote:

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):

  • ~/gnuradio/gnuradio-runtime/python/gnuradio/gr/packet_utils.py
  • ~/gnuradio/gr-digital/python/digital/utils/tagged_streams.py

 

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:

  • Is one (or both) of the files indicated above the correct file to modify?
  • How do I test modifications to GNU Radio source code files?
  • Are there other methods of changing the offset tag resolution I should consider?

 

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

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]