wbarnha / gr-gmuground

GNU Radio blocks for GMU's ECE/VSE Satellite Communications Ground Station
GNU General Public License v3.0
5 stars 2 forks source link

New GUI design #15

Closed wbarnha closed 4 years ago

wbarnha commented 4 years ago

Design GUI for displaying received telemetry data.

wbarnha commented 4 years ago

The easiest way of doing this is to fork gr-display and create a UTF-8, since Message Debug prints a PDU to stdout in terminal with UTF-8 encoding. I created a UTF-8 to ASCII block in my own fork, however, a block needs to be created to convert these PDUs into a sequence of bytes.

I recommend taking a look at my fork here and see what I did with my UTF-8 to ASCII converter. I recommend taking a look on the following files (1, 2, and 3) to determine how to implement the PDU parsing technique to produce a stream of bytes for ASCII.

wbarnha commented 4 years ago

I could be wrong on the ASCII part, though. There's an example of the text display blocks being used in gr-ax25 in APRS. As reference, the AFSK1200 and AX25Decode blocks are directly connected to the text display block.

wbarnha commented 4 years ago
void message_debug_impl::print_pdu(pmt::pmt_t pdu)
{
    pmt::pmt_t meta = pmt::car(pdu);
    pmt::pmt_t vector = pmt::cdr(pdu);
    std::cout << "* MESSAGE DEBUG PRINT PDU VERBOSE *\n";
    pmt::print(meta);
    size_t len = pmt::blob_length(vector);
    std::cout << "pdu_length = " << len << std::endl;
    std::cout << "contents = " << std::endl;
    size_t offset(0);
    const uint8_t* d = (const uint8_t*)pmt::uniform_vector_elements(vector, offset);
    for (size_t i = 0; i < len; i += 16) {
        printf("%04x: ", ((unsigned int)i));
        for (size_t j = i; j < std::min(i + 16, len); j++) {
            printf("%02x ", d[j]);
        }

        std::cout << std::endl;
    }

    std::cout << "***********************************\n";
}

Implement in Python rather than C++, since we don't want to repeat issues with Swig as experienced in #18 .

wbarnha commented 4 years ago

I tested my fork and it seems I'm getting the error:

handler caught exception: work() got an unexpected keyword argument 'input_items'
Traceback (most recent call last):
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/gateway.py", line 60, in eval
    try: self._callback()
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/gateway.py", line 230, in __gr_block_handle
    ) for i in range(noutputs)],
TypeError: work() got an unexpected keyword argument 'input_items'
thread[thread-per-block[16]: <block pdu2char(20)>]: SWIG director method error. Error detected when calling 'feval_ll.eval'
wbarnha commented 4 years ago

Fixed the previous issue. Now we have a new one:

handler caught exception: name 'msg_pmt' is not defined
Traceback (most recent call last):
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/gateway.py", line 60, in eval
    try: self._callback()
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/gateway.py", line 230, in __gr_block_handle
    ) for i in range(noutputs)],
  File "/usr/local/lib/python3/dist-packages/display/pdu2char.py", line 40, in work
    msg = pmt.cdr(msg_pmt)
NameError: name 'msg_pmt' is not defined
thread[thread-per-block[16]: <block pdu2char(20)>]: SWIG director method error. Error detected when calling 'feval_ll.eval'

Looks like I probably made a mistake by doing this in the work() function.

wbarnha commented 4 years ago

Working on gr-fosphor integration and layout.

wbarnha commented 4 years ago

I forgot to mention that I was looking at PDU to Kiss and Kiss to PDU Python programs from gr-satellites when I was working on PDU2Char.

wbarnha commented 4 years ago

image This looks like a promising layout. Where should telemetry be displayed?

wbarnha commented 4 years ago

Managed to integrate some C++ into my fork for gr-display, but it seems there are some new errors when I run the text display sink in GNU Radio:

File "/home/wbarnhart/gr-satellites/examples/satellite_decoder.py", line 139, in <module>
    main()
  File "/home/wbarnhart/gr-satellites/examples/satellite_decoder.py", line 117, in main
    tb = top_block_cls()
  File "/home/wbarnhart/gr-satellites/examples/satellite_decoder.py", line 94, in __init__
    self.msg_connect((self.satellites_satellite_decoder_0, 'out'), (self.show_text_0, 'in'))
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/hier_block2.py", line 60, in wrapped
    func(self, src.to_basic_block(), srcport, dst.to_basic_block(), dstport)
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/hier_block2.py", line 132, in msg_connect
    self.primitive_msg_connect(*args)
  File "/usr/local/lib/python3/dist-packages/gnuradio/gr/runtime_swig.py", line 5473, in primitive_msg_connect
    return _runtime_swig.top_block_sptr_primitive_msg_connect(self, *args)
RuntimeError: invalid msg port in connect() or disconnect()
wbarnha commented 4 years ago

image Starting to look better, integrated the APT processor from gr-display into our UI. image

wbarnha commented 4 years ago

Integrate modules from gr-guiextra where possible to save time.

wbarnha commented 4 years ago

Screenshot from 2020-03-09 19-24-01 Starting to look really good!

jamilkallas commented 4 years ago

previous error corrected, new error is:

Traceback (most recent call last):
  File "/home/stars/gr-satellites/examples/satellite_decoder.py", line 27, in <module>
    import display
  File "/usr/local/lib/python3/dist-packages/display/__init__.py", line 45, in <module>
    from .display_swig import *
  File "/usr/local/lib/python3/dist-packages/display/display_swig.py", line 17, in <module>
    _display_swig = swig_import_helper()
  File "/usr/local/lib/python3/dist-packages/display/display_swig.py", line 16, in swig_import_helper
    return importlib.import_module('_display_swig')
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_display_swig'

the file display_swig.i not being imported correctly.

wbarnha commented 4 years ago

It looks like Swig isn't being handled properly for being used in a display. When did this bug start showing up?

domnguyen19962000 commented 4 years ago

Monday when Jamil and I try to fix the other bug.

wbarnha commented 4 years ago

Oh, I know what's going on here. You're using the example decoder from gr-satellites, and you're using the new text display block. I'll try running it on my end since I had to rebuild my development environment. Swig has some quirks going on that keep us from developing.

wbarnha commented 4 years ago

image This looks promising. Not readable, but it's definitely a leap of progress.

wbarnha commented 4 years ago

When I saved the test data above and opened it up using bvi, I see the following bytestream:

00000000  EF BF BD EF BF BD EF BF BD 10 EF BF BD EF BF BD EF BF BD EF ....................
00000014  BF BD 65 67 66 66 07 03 EF BF BD EF BF BD 10 EF BF BD EF BF ..egff..............
00000028  BD EF BF BD EF BF BD 65 67 66 66 07 03 EF BF BD 10 EF BF BD .......egff.........
0000003C  EF BF BD EF BF BD EF BF BD 65 67 66 66 07 03 10 EF BF BD EF .........egff.......
00000050  BF BD EF BF BD EF BF BD 65 67 66 66 07 03 EF BF BD EF BF BD ........egff........
00000064  EF BF BD EF BF BD 65 67 66 66 07 03 EF BF BD EF BF BD EF BF ......egff..........
00000078  BD 65 67 66 66 07 03 EF BF BD EF BF BD 65 67 66 66 07 03 EF .egff........egff...
0000008C  BF BD 65 67 66 66 07 03 65 67 66 66 07 03 67 66 66 07 03 66 ..egff..egff..gff..f
000000A0  66 07 03 66 07 03 07 03 03 05 EF BF BD 68 EF BF BD 10 EF BF f..f.........h......
000000B4  BD 68 EF BF BD 10 68 EF BF BD 10 EF BF BD 10 10 65 65 0A 30 .h....h.........ee.0
000000C8  65 0A 30 0A 30 30 59 03 03 02 02 66 EF BF BD 09 23 03 03 02 e.0.00Y....f....#...
000000DC  02 66 EF BF BD 09 23 03 02 02 66 EF BF BD 09 23 02 02 66 EF .f....#...f....#..f.
000000F0  BF BD 09 23 02 66 EF BF BD 09 23 66 EF BF BD 09 23 EF BF BD ...#.f....#f....#...
00000104  09 23 09 23 23 EF BF BD EF BF BD EF BF BD 10 EF BF BD EF BF .#.##...............
00000118  BD EF BF BD EF BF BD 64 67 66 66 07 04 EF BF BD EF BF BD 10 .......dgff.........
0000012C  EF BF BD EF BF BD EF BF BD EF BF BD 64 67 66 66 07 04 EF BF ............dgff....
00000140  BD 10 EF BF BD EF BF BD EF BF BD EF BF BD 64 67 66 66 07 04 ..............dgff..
00000154  10 EF BF BD EF BF BD EF BF BD EF BF BD 64 67 66 66 07 04 EF .............dgff...
00000168  BF BD EF BF BD EF BF BD EF BF BD 64 67 66 66 07 04 EF BF BD ...........dgff.....
0000017C  EF BF BD EF BF BD 64 67 66 66 07 04 EF BF BD EF BF BD 64 67 ......dgff........dg
00000190  66 66 07 04 EF BF BD 64 67 66 66 07 04 64 67 66 66 07 04 67 ff.....dgff..dgff..g
000001A4  66 66 07 04 66 66 07 04 66 07 04 07 04 04 05 EF BF BD 68 EF ff..ff..f.........h.
000001B8  BF BD 10 EF BF BD 68 EF BF BD 10 68 EF BF BD 10 EF BF BD 10 ......h....h........
000001CC  10 65 65 0A 35 65 0A 35 0A 35 35 59 03 03 02 02 EF BF BD 22 .ee.5e.5.55Y......."
000001E0  EF BF BD EF BF BD 03 03 02 02 EF BF BD 22 EF BF BD EF BF BD ............."......
000001F4  03 02 02 EF BF BD 22 EF BF BD EF BF BD 02 02 EF BF BD 22 EF ......"...........".
00000208  BF BD EF BF BD 02 EF BF BD 22 EF BF BD EF BF BD EF BF BD 22 ........."........."
0000021C  EF BF BD EF BF BD 22 EF BF BD EF BF BD EF BF BD EF BF BD EF ......".............
00000230  BF BD     
                                            ..

For easier viewing: image

Expected values should be something along the lines of:

0000: 00 a5 92 82 10 b2 99 99 98 65 67 66 66 07 03 00 
0010: 05 f3 68 b2 10 00 00 65 65 0a 30 00 00 59 03 03 
0020: 02 02 66 be 09 23 

0000: 00 a5 92 82 10 b3 8d 8d 8c 64 67 66 66 07 04 00 
0010: 05 f4 68 b3 10 00 00 65 65 0a 35 00 00 59 03 03 
0020: 02 02 c3 22 80 fd 

On closer inspection, you can seen the 67 66 66 07 04 patterns repeat! If we get rid of the repeating patterns of EF BF BD EF, etc., we're golden.

domnguyen19962000 commented 4 years ago

Look sooo much better.

Get Outlook for iOShttps://aka.ms/o0ukef


From: wbarnha notifications@github.com Sent: Wednesday, March 11, 2020 10:04:18 PM To: wbarnha/gr-gmuground gr-gmuground@noreply.github.com Cc: dnguye73 dnguye73@masonlive.gmu.edu; Comment comment@noreply.github.com Subject: Re: [wbarnha/gr-gmuground] New GUI design (#15)

When I saved the test data above and opened it up using bvi, I see the following data: [image]https://user-images.githubusercontent.com/25623043/76480093-1c7f0080-63e4-11ea-9d57-b883378d0a21.png Expected values should be something along the lines of:

0000: 00 a5 92 82 10 b2 99 99 98 65 67 66 66 07 03 00 0010: 05 f3 68 b2 10 00 00 65 65 0a 30 00 00 59 03 03 0020: 02 02 66 be 09 23

0000: 00 a5 92 82 10 b3 8d 8d 8c 64 67 66 66 07 04 00 0010: 05 f4 68 b3 10 00 00 65 65 0a 35 00 00 59 03 03 0020: 02 02 c3 22 80 fd

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/wbarnha/gr-gmuground/issues/15#issuecomment-597969359, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANWCECVLSYIYFFMJGDF7U2LRHA7KFANCNFSM4KWIVSCA.

wbarnha commented 4 years ago

image image

All set!

wbarnha commented 4 years ago

What about processing CW data?

wbarnha commented 4 years ago

CW seems to be broken or undocumented for now in gr-satnogs. Since we have no means of testing anything, we can't develop it. I tried to fix the Morse generators myself, but their repository is setup in a manner that prevents me from completing my tasks.