File format problem of record.cpp

Discussion in 'Module Connector (MC)' started by EREN VARDARLI, Jan 28, 2018.

  1. EREN VARDARLI

    EREN VARDARLI New Member

    When I compile and run the record.cpp file located in \ModuleConnector-win32_win64-1.4.3\examples folder, I get
    such files as output:

    xethru_recording_meta.writing
    xethru_sleep_20180128_015402.writing

    I cannot open these file extensions and neither can playback_recording.cpp or read_recording.cpp

    Is there a way to get .dat or .csv file formats ?

    Thanks for your answer,
    Eren
     
  2. Charlie Shao

    Charlie Shao Moderator Staff Member

    Hi Eren,
    I did tests on this program, every time when I stop this program with CTRL+C, it will create .dat and .csv file. The files you got are just temporary files, so I wonder how you get those file, did you stop this program with CTRL+C?
     
  3. EREN VARDARLI

    EREN VARDARLI New Member

    Hi Charlie,
    Yes I terminate with ctrl+c. I am using g++ compiler through a mingw64 shell on a windows 8. Could it be a platform issue ??
     
  4. Charlie Shao

    Charlie Shao Moderator Staff Member

    Hi EREN,

    It seems this is an issue with Ctrl+C handling in the terminal. It doesn't run the signal handler, thus killing the process before it has time to shut down properly.
    This is not our bug, but rather the particular environment doesn't behave nicely. (If this is the same issue, it seems it will be fixed soon: https://github.com/git-for-windows/msys2-runtime/pull/16 ).

    Here is the suggestion from our software engineer:
    A quick workaround for the problem is to switch the exit mechanism. Instead of
    while (!stop_recording) {

    usleep(1000);

    }

    which waits for the signal handler to tell it to stop, write:


    printf("Press enter to stop recording.\n");

    getchar();
     
    Last edited: Feb 5, 2018
  5. EREN VARDARLI

    EREN VARDARLI New Member

    Hi Charlie ,

    Thanks for your support. I am switching to raspberry pi 3 as my platform . After I install the setup.py and try running the record.py I came across a syntax error as shown below. Has anybody came across this type of error? Thanks...

    pi@raspberrypi:~/Downloads/python34-arm-linux-gnueabihf/pymoduleconnector/examples $ python record.py
    Traceback (most recent call last):
    File "record.py", line 9, in <module>
    from pymoduleconnector import ModuleConnector
    File "/usr/local/lib/python2.7/dist-packages/pymoduleconnector-1.4.3-py2.7.egg/pymoduleconnector/__init__.py", line 2, in <module>
    from .moduleconnector import DataReader
    File "/usr/local/lib/python2.7/dist-packages/pymoduleconnector-1.4.3-py2.7.egg/pymoduleconnector/moduleconnector.py", line 5, in <module>
    from .moduleconnectorwrapper import \
    File "/usr/local/lib/python2.7/dist-packages/pymoduleconnector-1.4.3-py2.7.egg/pymoduleconnector/moduleconnectorwrapper/__init__.py", line 107
    def value(self) -> "PyObject *":
    ^
    SyntaxError: invalid syntax
     
  6. Charlie Shao

    Charlie Shao Moderator Staff Member

    This seems caused by mismatched python version.
     
  7. Jameson

    Jameson New Member

    Hi Charlie,

    I am facing the same issue running the C++ code on a Raspberry pi. Running XEP_recorder, I am getting an output folder with xethru_recording_* and 4 files in there (so far so good...)
    I have tried to terminate the program as normal using Ctrl+c, and I have also modified the program to end upon hitting the enter button, and I am getting the data file renamed from a .writing to a .dat file, however the meta file is left as a .writing file, so that renders the data unreadable from what I understand. I have tried to edit the code per the suggestion above, and I have tried to use different signals (SIGTERM etc...) to call handle_sigint(), and I have also tried to manually set the stop_recording bit to 1 after an "Enter" press, but I haven't had any success in renaming the meta file from .writing file to a .dat.

    There was a possible solution mentioned previously (https://github.com/git-for-windows/msys2-runtime/pull/16), however this doesn't seem to apply to the Pi.

    Could it be possible to manually call the functions necessary to close the meta file out and rename it to .dat in a way that won't corrupt the file?

    Thanks,
    Jameson
     
  8. Harvord Sun

    Harvord Sun New Member

    Hello,would you like to tell me how to output .csv file?
     
  9. Charlie Shao

    Charlie Shao Moderator Staff Member

    This can be opened by MS Excel or any text editor. If you have the recording folder. You are able to palyback the recording data.
     
  10. Harvord Sun

    Harvord Sun New Member

    Thanks for your replying! I have tried to use the Excel to open xethru_recording_meta.dat file, but it turned out that I got whole messy code that could not be readable when the data format is baseband ap or iq. I wonder what the problem would be.
     
  11. NSANGOU CHOUAIBOU

    NSANGOU CHOUAIBOU Active Member

    Hi Harvord,
    .dat is an HEX file format. You cannot read it with Excel. Use an HEX file reader.

    B.R,
    Chouaibou.
     
  12. Harvord Sun

    Harvord Sun New Member

    Thank you for your advice, I'll try soon.
     
  13. Harvord Sun

    Harvord Sun New Member

    I was recently using X4M200 to collect the baseband ap data of radar frame, and I got xethru_recording_meta.dat file and xethru_baseband_ap_XXXXXXX.dat file. I want to know that what information they express respectively. And I an trying to use the example of MC, playback_recording.cpp, to play back the information, what preparations should I make in advance? Namely, I want to know the detailed function and instructions of playback_recording.cpp example.
    Thank you very much!
    Looking forward to your replying!
     
  14. Charlie Shao

    Charlie Shao Moderator Staff Member

  15. Harvord Sun

    Harvord Sun New Member

    Hi Charlie Shao,

    I have tried xt_modules_print_record_playback_radar_raw_data_message.cpp to get raw data like this:[​IMG]
    upload_2018-12-20_23-4-49.png
    but I have no idea what the data explains. Is this the echo from the radar?
     
  16. Charlie Shao

    Charlie Shao Moderator Staff Member

    It could be one frame of raw rf data or baseband data. Just google to learn about radar data type.