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.

IWR1642BOOST: An error occurs when tracking processing of "tm_demo.m" is operated with GtrackLib (MEX function)

Part Number: IWR1642BOOST

Hello.

My English isn't so good so feel free to ask me if there is anything unclear.

"tm_demo.m" is tracking with GtrackLib which was reworked for MATLAB.(trackerRun = 'PCMatlab')
I want to run "tm_demo.m" with GtrakLib in C language.
That is, I would like to perform tracking processing by MEX function.(trackerRun = 'PCMex')
I tried it with the following procedure.

------------------------------
1.Create "gtrackMex.lib" using VisualStudio 2012.
2.Copy the created "gtrackMex.lib" into "C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\src\mss\gtrack\lib".
3.Correct GTRACK_PATH in "C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\src\mss\gtrack\test\win\matlab\mex\mex_compile.m" according to your environment.
4.Execute the following command in MATLAB so that the MEX function can be used.

 cd C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\src\mss\gtrack\test\win\matlab\mex
 mex -g -I"C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\src\mss\gtrack" -L"C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\src\mss\gtrack\lib" -lgtrackMex gtrack_create_mex.c gtrack_osal.c 
 mex -g -I"C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\src\mss\gtrack" -L"C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\src\mss\gtrack\lib" -lgtrackMex gtrack_step_mex.c gtrack_osal.c 

------------------------------

You are now ready to use C language GtrakLib.
Correct the trackerRun of "tm_demo.m" to always be 'PCMex' and execute 'tm_demo.m'.
The cfg file to use is "C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\chirp_configs\mmw_tm_demo_ph2.cfg".
In "Other Mandatory Parameters" enter "-5, 0, 4".
Then, the error "Scenery Parameters wrong unumber of inputs" occurs in "gtrack_create_mex" function.
The following code of "gtrack_create_mex.c" causes an error.

if (mxGetN(field) != 1+4*config->advParams->sceneryParams->numBoundaryBoxes+1+4*config->advParams->sceneryParams->numStaticBoxes)
    mexErrMsgTxt( "Scenery Parameters wrong unumber of inputs");

In this IF statement, the right side is 6.
I think that this is wrong regardless of how it is thought.

Is my setting wrong?
Or, is "gtrack_create_mex.c" wrong?

Please give me advice.
Thanks.

  • Former Member
    0 Former Member

    Hello Koji,

    tm_demo is aimed for data collection. tm_play can be used to rerun the data with PCMex. Can you please use this instead?

    dev.ti.com/.../

    Amanda

  • Hello Amanda.
    Thank you very much for always replying.

    There was a mistake in my question.
    I am faced with this problem using "tm_play.m", not "tm_demo.m".

    When using the MEX function in "tm_play.m", I analyzed what is happening.
    The result is as follows, but it may be incorrect as it is speculation.

    The problematic code is as follows.
    C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\src\mss\gtrack\test\win\matlab\mex\gtrack_create_mex.c L210
    ----------
    if (mxGetN(field) != 1+4*config->advParams->sceneryParams->numBoundaryBoxes+1+4*config->advParams->sceneryParams->numStaticBoxes)
    mexErrMsgTxt( "Scenery Parameters wrong unumber of inputs");
    ----------

    "MxGetN (field)" on the left side of the IF statement is 18.
    The basis of "18" can be found from the following code.
    C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\gui\setup_replaygtrack.m L62
    ----------
    handles.box = struct('numBoundary', 1, 'boundaryBox', [-2 15, 10.0, 75.0; 0, 0, 0, 0], 'numStatic', 1, 'staticBox',[1.25 11.0, 20.0, 50.0; 0, 0, 0, 0]);
    ----------

    But, "1 + 4 * config-> advParams-> sceneryParams-> numBoundaryBoxes + 1 + 4 * config-> advParams-> sceneryParams-> numStaticBoxes" will be 6.
    Explanation is as follows.

    'Config-> advParams-> sceneryParams-> numBoundaryBoxes' will be 1.
    'Config-> advParams-> sceneryParams-> numStaticBoxes' will be 0.

    Therefore,

    1+4*1+1+4*0
    =1 + (4 * 1) + 1 + (4 * 0)
    =6

    Since 18 and 6 do not match, an error occurs.
    "6" on the right side is obviously wrong.
    Why will it be "6"?

    The "Scenery Parameter" set is as follows.

    Notice that 'Boundary 2' and 'Static 2' are all 0's.

    This setting is passed to gtrack_create_mex.c with the following data array.
    [1, -2, 15, 10, 75, 0, 0, 0, 0, 1, 1.25, 11, 20, 50, 0, 0, 0, 0]

    gtrack_create_mex.c stores this data one by one in the following order.
    ----------
    config->advParams->sceneryParams->numBoundaryBoxes = 1
    config->advParams->sceneryParams->boundaryBox[0].left = -2
    config->advParams->sceneryParams->boundaryBox[0].right = 15
    config->advParams->sceneryParams->boundaryBox[0].bottom = 10
    config->advParams->sceneryParams->boundaryBox[0].top = 75
    config->advParams->sceneryParams->numStaticBoxes = 0
    config->advParams->sceneryParams->staticBox[0].left = 0
    config->advParams->sceneryParams->staticBox[0].right = 0
    config->advParams->sceneryParams->staticBox[0].bottom = 0
    config->advParams->sceneryParams->staticBox[0].top = 1
    ----------

    As described above, since "Boundary 2" data acquisition is not executed, "config-> advParams-> sceneryParams-> numStaticBoxes" becomes 0.

    Is there a problem with the logic of gtrack_create_mex.c?
    Or, Is there a problem with setting "Boundary 2" and "Static 2" all 0?
    (I think that I am the former)

    My English is not good, so it may be confusing.
    I'm sorry.


    Thanks.

  • Former Member
    0 Former Member in reply to koji fukumoto
    Hello Koji,

    When the tm_play tool was released it was only intended to support 'target' and 'PCMatlab' mode. There were two different versions of gtrack and it looks like since it wasn't supported the mex lib wasn't migrated. I'll need try it from the SDK and will get back to you. For now can you use the PCMatlab?

    Amanda
  • Hello Amanda.

    Thank you for your prompt reply.
    I really appreciate you taking your time for me to solve the problem.

    I am able to run tm_play with PCMatlab.
    However, I need to run GtrackLib on PCMex, so I am waiting for your findings.

    Thanks.
  • Former Member
    0 Former Member in reply to koji fukumoto

    Hello Koji,

    The PCMex isn't officially supported so the tm_play tool GUI wasn't created or tested to work with PCMex mode. The error you are seeing is because the parsing in gtrack_create_mex isn't compatible with the format from the tm_play.

    Can you try modifying tm_play.m to be compatible?

    replace line 172

        trackerConfig.advParams.scenery =  [hSetup.box.numBoundary  reshape(hSetup.box.boundaryBox', 1, []) hSetup.box.numStatic reshape(hSetup.box.staticBox', 1, [])]; 
    

    with

        bbTemp = reshape(hSetup.box.boundaryBox', 1, []);
        sbTemp = reshape(hSetup.box.staticBox', 1, []);
        trackerConfig.advParams.scenery =  [hSetup.box.numBoundary bbTemp(1:4*hSetup.box.numBoundary) hSetup.box.numStatic sbTemp(1:4*hSetup.box.numStatic)];

    -Amanda

  • Hello Amanda.

    Thanks to your advice, I was able to avoid the errors I encounter.
    thank you very much !


    My final goal is to do the same tracking as 'PCMatlab' mode in 'PCMex' mode.
    However, tracking results in 'PCMex' mode are very different.
    ("snail trail" and "clustering 3D ellipse" are not displayed)

    The cfg file and the fHist file and the tracking parameters are the same.

    <Cfg file>
    C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\chirp_configs\mmw_tm_demo_ph2.cfg

    <fHist file>
    C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\gui\sample_fhist\fHistRT_0002.mat

    <Tracking parameters>


    Do you know the reason for the different tracking results?

    Thanks.

  • Former Member
    0 Former Member in reply to koji fukumoto
    Hello Koji,

    Could you attach the mex lib you built so I can test it with my tm_play.m?

    Thanks,
    Amanda
  • Hello Amanda.

    I attach gtrackMex.lib that I am using.
    Sorry to trouble you, but please confirm.

    Thanks.

    gtrackMex.lib

  • Former Member
    0 Former Member in reply to koji fukumoto
    Hello Koji,

    As an update I am still looking into replicating the issue you have described. However, the gtrackMex function is not supported currently and will not be in the future.

    Amanda
  • Hello Amanda.
    Thanks for the reply.

    What is the current situation?
    I am waiting for your findings.

    Thanks
  • Former Member
    0 Former Member in reply to koji fukumoto
    Hello Koji,

    Unfortunately we will not be supporting PCMex mode for tm_play.

    Amanda
  • Hello Amanda.
    Thank you for taking the time for me.

    I understood that "traffic monitoring lab" can not use "GtrackLib created in C language".
      Are there other labs that can use "GtrackLib created in C language"?
    -----
    "traffic monitoring lab" means the following things.
    "C:\ti\mmwave_industrial_toolbox_2_4_0\labs\lab0013_traffic_monitoring_16xx\"

    "GtrackLib created in C language" means the following things.
    "C:\ti\mmwave_sdk_02_00_00_04\packages\ti\alg\gtrack\"
    -----

    In other words, I want to know the system where "GtrackLib created in C language" works.

    Thanks.
  • Former Member
    0 Former Member in reply to koji fukumoto
    Hello Koji,

    The traffic monitoring and people counting labs both use the gtracklib from the C language. If you import the labs you can see that the device firmware for both labs uses the gtracklib that has been precompiled and provided in the lab.

    To be clear neither replay for people counting or traffic monitoring enable the PCMex replay but the real time data collection involves the use of the gtracklib.

    Amanda