This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IWR6843AOPEVM: Unable to parse Range profile data

Part Number: IWR6843AOPEVM

Hi,

   I have dumped Range profile data from TI demo visualizer running out of box demo code.

Then i used the TI provided script from : C:\ti\mmwave_sdk_03_06_00_00-LTS\packages\ti\demo\parser_scripts

When i run the script as below, i get error : 

Attaching .dat file obtained from range profile using record start and record stop button provided in TI demo visualizer. Can you please help me on this.

xwr68xx_AOP_processed_stream_2023_03_09T10_27_36_018.zip

(tf_gpu) C:\ti\mmwave_sdk_03_06_00_00-LTS\packages\ti\demo\parser_scripts>python mmw_demo_example_script.py c:\Users\VinayKulkarni\Downloads\xwr68xx_AOP_processed_strea_03_09T10_27_36_018.dat
readNumBytes: 83328
allBinData: 2 1 4 3
headerStartIndex = 0
totalPacketNumBytes = 4160
platform = b'000a6843'
frameNumber = 49
timeCpuCycles = 704189836
numDetObj = 6
numTlv = 1
subFrameNumber = 0
The 1st TLV
type 5
len 4096 bytes
The 2nd TLV
type 1
len 123105 bytes
x(m) y(m) z(m) v(m/s) Com0range(m) azimuth(deg) elevAngle(deg) snr(0.1dB) noise(0.1dB)
Traceback (most recent call last):
File "C:\ti\mmwave_sdk_03_06_00_00-LTS\packages\ti\demo\parser_scripts\mmw_demo_example_script.py", line 97, in <module>
detectedNoise_array = parser_one_mmw_demo_output_packet(allBinData[totalBytesParsed::1], readNumBytes-totalBytesParsed)
File "C:\ti\mmwave_sdk_03_06_00_00-LTS\packages\ti\demo\parser_scripts\parser_mmw_demo.py", line 298, in parser_one_mmw_demo_output_packet
print(" obj%3d: %12f %12f %12f %12f %12f %12f %12d %12d %12d" % (obj, detectedX_array[obj], detectedY_array[obj], detectedZ_array[obj], detectedV_array[obj], detectedRange_array[obj], detectedAzimuth_array[obj], detectedElevAngle_array[obj], detectedSNR_array[obj], detectedNoise_array[obj]))
IndexError: list index out of range

  • Saw that tlvType it was showing 5, which Range doppler heat map. Hence repeated the experiment to select Range profile alone and dumped the .dat file as attached.

    Here i am getting tlvType as 2 , which is Range Profile but still getting same error : 

    xwr68xx_AOP_processed_stream_2023_03_14T13_59_07_511.zip

    (tf_gpu) C:\ti\mmwave_sdk_03_06_00_00-LTS\packages\ti\demo\parser_scripts>python mmw_demo_example_script.py c:\Users\VinayKulkarni\Downloads\xwr68xx_AOP_processed_stream_2023_03_14T13_59_07_511.dat
    readNumBytes: 57856
    allBinData: 2 1 4 3
    headerStartIndex = 0
    totalPacketNumBytes = 576
    platform = b'000a6843'
    frameNumber = 660
    timeCpuCycles = 3709079754
    numDetObj = 21
    numTlv = 1
    subFrameNumber = 0
    The 1st TLV
    type 2
    len 512 bytes
    The 2nd TLV
    type 1
    len 382573 bytes
    x(m) y(m) z(m) v(m/s) Com0range(m) azimuth(deg) elevAngle(deg) snr(0.1dB) noise(0.1dB)
    Traceback (most recent call last):
    File "C:\ti\mmwave_sdk_03_06_00_00-LTS\packages\ti\demo\parser_scripts\mmw_demo_example_script.py", line 97, in <module>
    detectedNoise_array = parser_one_mmw_demo_output_packet(allBinData[totalBytesParsed::1], readNumBytes-totalBytesParsed)
    File "C:\ti\mmwave_sdk_03_06_00_00-LTS\packages\ti\demo\parser_scripts\parser_mmw_demo.py", line 298, in parser_one_mmw_demo_output_packet
    print(" obj%3d: %12f %12f %12f %12f %12f %12f %12d %12d %12d" % (obj, detectedX_array[obj], detectedY_array[obj], detectedZ_array[obj], detectedV_array[obj], detectedRange_array[obj], detectedAzimuth_array[obj], detectedElevAngle_array[obj], detectedSNR_array[obj], detectedNoise_array[obj]))
    IndexError: list index out of range

  • Hi Vinay,

    It doesn't appear that the demo parser supports decoding the range azimuth heat map. It looks like you'll need to modify it to add this packet based off the packet format given in the documentation. My recommendation would be to start by modifying the parser_mmw_demo.py as shown below, then parsing out the range profile data as described in the documentation

    C:/ti/mmwave_sdk_03_06_00_00-LTS/packages/ti/demo/xwr68xx/mmw/docs/doxygen/html/index.html

    Best,

    Nate

  • Thanks Nathan.

    I wrote the code for handling  Range profile (type==2) as below:

    But when i go to second TLV , i dont TLV type as 2, instead its 1 and Length is 382573 bytes , which is higher than 57856 that data has.

    It seem like reading of 2nd TLV, is going wrong or my first read of TLV itself is wrong ?Please help

                if tlvType == 2 and tlvLen < totalPacketNumBytes: #MMWDEMO_OUTPUT_MSG_RANGE_PROFILE
                    # perform Range profile processing here
                    range_prof_data = []
                    payload_start = tlvStart + 8 # 8 is coming due to Type and Length each of 4 bytes.
                    for i in range(tlvLen//2):
                        range_prof_data.append(getUint16(data[payload_start+2*i:payload_start+2*i+2:1])) # Take only two bytes of Range data.
                   
                    # Range profile data captured is in Q7.9 format.
                    range_prof_data = np.array(range_prof_data)
               # Process the 2nd TLV
                tlvStart = tlvStart + 8 + tlvLen
                                                       
                tlvType    = getUint32(data[tlvStart+0:tlvStart+4:1])
                tlvLen     = getUint32(data[tlvStart+4:tlvStart+8:1])      
                offset = 8
                       
                print("The 2nd TLV")
                print("    type %d" % (tlvType))
                print("    len %d bytes" % (tlvLen))
  • Hello Vinay, 

    Nathan is out of the office this week, so please be patient with us if there are delays in support.

    In general, the parser scripts are provided as is for examples, so it is not in our scope to debug custom modifications, however, we can provide some assistance. Do you believe you are reading in TLV headers correctly? If you are getting a TLV type one, is the guiMonitor command of your configuration file not selecting the type of TLV you want to output? 

    Please review Nathan's linked document and this: Understanding UART Output Format Guide

    Regards,

    Luke

  • I found answer for this issue. The fix involved not reading next TLV within same TLV, which i have fixed it along with comments on prints.

    For those who land here searching for the Range profile tapping:

    You can add code in parser_mmw_demo.py , after parsing of TLV type==1 , you can add below code to get smoothly the Range profile data:

               if tlvType == 2 and tlvLen < totalPacketNumBytes: #MMWDEMO_OUTPUT_MSG_RANGE_PROFILE
                    # perform Range profile processing here
                   
                    payload_start = tlvStart + 8 # 8 is coming due to Type and Length each of 4 bytes.
                    for i in range(tlvLen//2):
                       
                        range_prof_data.append(getint16_Q7_9(data[payload_start+2*i:payload_start+2*i+2:1])) # Take only two bytes of Range data.
                   
                    # Range profile data captured is in Q6.9 format.
                    range_prof_data = np.array(range_prof_data)



                # Process the 2nd TLV, Ignore second TLV if Range profile is of interest.
                if(tlvType != 2):

                    tlvStart = tlvStart + 8 + tlvLen
                                                           
                    tlvType    = getUint32(data[tlvStart+0:tlvStart+4:1])
                    tlvLen     = getUint32(data[tlvStart+4:tlvStart+8:1])      
                    offset = 8
                           
                    print("The 2nd TLV")
                    print("    type %d" % (tlvType))
                    print("    len %d bytes" % (tlvLen))
                                                               
                if tlvType == 7:
                   
                    # TLV type 7 contains snr and noise of all detect objects.
                    # each snr and noise are 16-bit integer represented by 2 bytes, so every 4 bytes represent snr and noise of one detect objects.    
               
                    # for each detect objects, extract snr and noise                                            
                    for obj in range(numDetObj):
                        # byte0 and byte1 represent snr. convert 2 bytes to 16-bit integer
                        snr   = getUint16(data[tlvStart + offset + 0:tlvStart + offset + 2:1])
                        # byte2 and byte3 represent noise. convert 2 bytes to 16-bit integer
                        noise = getUint16(data[tlvStart + offset + 2:tlvStart + offset + 4:1])

                        detectedSNR_array.append(snr)
                        detectedNoise_array.append(noise)
                                                                       
                        offset = offset + 4
                else:
                    for obj in range(numDetObj):
                        detectedSNR_array.append(0)
                        detectedNoise_array.append(0)
                # end of if tlvType == 7

                #print("                  x(m)         y(m)         z(m)        v(m/s)    Com0range(m)  azimuth(deg)  elevAngle(deg)  snr(0.1dB)    noise(0.1dB)")
                #for obj in range(numDetObj):
                #    print("    obj%3d: %12f %12f %12f %12f %12f %12f %12d %12d %12d" % (obj, detectedX_array[obj], detectedY_array[obj], detectedZ_array[obj], detectedV_array[obj], detectedRange_array[obj], detectedAzimuth_array[obj], detectedElevAngle_array[obj], detectedSNR_array[obj], detectedNoise_array[obj]))

        return (result, headerStartIndex, totalPacketNumBytes, numDetObj, numTlv, subFrameNumber, detectedX_array, detectedY_array, detectedZ_array, detectedV_array, detectedRange_array, detectedAzimuth_array, detectedElevAngle_array, detectedSNR_array, detectedNoise_array,range_prof_data)

    Please note that i have directly used Range profile data reprsentation of Q7.9 for which you can use below function. Other option is to use getUint16 provided by TI script.

    def getint16_Q7_9(data):
        """!
           This function converts Range profile of 2 bytes to a 16-bit signed integer in form of Q7.9.

            @param data : 1-demension byte array
            @return     : 16-bit signed integer in form of Q7.9
        """
        temp = data[1]
        if(data[1] > 127): # Check if MSBit is 1, if so, we have received negative number.
            temp = data[1] - 256
        return (data[0] +
                temp*256)