mynewt-dw1000-apps
mynewt-dw1000-apps copied to clipboard
Query related twr_tag_nranges_tdma
I ran the main.c of the twr_tag_nranges_tdma application. I used 1 tag and 1 node. I'm getting the expected output.
OUTPUT:
{"utime": 18724444,"nrng": {"seq": 133,"mask": 1,"rng": [1047851887],"tdoa": [0]}} {"utime": 18737894,"nrng": {"seq": 134,"mask": 1,"rng": [1042658236],"tdoa": [0]}} {"utime": 18751337,"nrng": {"seq": 135,"mask": 1,"rng": [1044546836],"tdoa": [0]}} {"utime": 18764774,"nrng": {"seq": 136,"mask": 1,"rng": [1046907587],"tdoa": [0]}} {"utime": 18791667,"nrng": {"seq": 138,"mask": 1,"rng": [1044074686],"tdoa": [0]}} {"utime": 18805103,"nrng": {"seq": 139,"mask": 1,"rng": [1041713936],"tdoa": [0]}} {"utime": 18818546,"nrng": {"seq": 140,"mask": 1,"rng": [1041399169],"tdoa": [0]}} {"utime": 18845439,"nrng": {"seq": 142,"mask": 1,"rng": [1045648520],"tdoa": [0]}} {"utime": 18858876,"nrng": {"seq": 143,"mask": 1,"rng": [1042973003],"tdoa": [0]}} {"utime": 18872319,"nrng": {"seq": 144,"mask": 1,"rng": [1044704220],"tdoa": [0]}} {"utime": 18885769,"nrng": {"seq": 145,"mask": 1,"rng": [1042658236],"tdoa": [0]}} {"utime": 18899206,"nrng": {"seq": 146,"mask": 1,"rng": [1044389453],"tdoa": [0]}} {"utime": 18926099,"nrng": {"seq": 148,"mask": 1,"rng": [1041871319],"tdoa": [0]}} {"utime": 18939542,"nrng": {"seq": 149,"mask": 1,"rng": [1040612252],"tdoa": [0]}} {"utime": 18966422,"nrng": {"seq": 151,"mask": 1,"rng": [1044389453],"tdoa": [0]}}
My query is I'm not able to find the print statement which outputs the above statement in the code. I tried searching everywhere. I don't know where the twr calculation is being done.
I'm a beginner, please forgive if the query is unintelligent.
Hi Shivmohith, Have a look at mynewt-dw1000-core/lib/nrng/src/nrng_encode.c for the json encoded. The calculations are performed in mynewt-dw1000-core/lib/twr_ss_nrng/src/twr_ss_nrng.c.
Note the rng numbers are IEEE 754 floating-point type cast to a UINT32 and encapulate this within the JSON string. So [1047851887] is 0.2392m.
For example In matlab
typecast(uint32( [1047851887]),'single') ans =
single
0.2392
Hi Paul, Thank you so much! But I'm still not able to figure where the following print statement is executed,
{"utime": 18724444,"nrng": {"seq": 133,"mask": 1,"rng": [1047851887],"tdoa": [0]}}
Can you tell me in which file this statement is executed and also line number if possible?
Regards Shivmohith
Hi Shivmohith, Have a look at the following function. This builds the JSON string object by object.
https://github.com/Decawave/mynewt-dw1000-core/blob/5e36c2252e1ef94d10e6768b022815d390e14369/lib/nrng/src/nrng_encode.c#L65
Regards Paul.
Hello @Shivmohith
Were you able to get this output using UART or using RTT?
regards Asmita
Hello @asmitajha I got the output using RTT.
Regards, Shiv Mohith
Hello @Shivmohith I am getting these output using UART but when doing through RTT I am unable to see any ranging information.
asmita@asmita-Lenovo-G50-80:~$ telnet localhost 19021 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. SEGGER J-Link V6.46g - Real time terminal output J-Link OB-STM32F072-128KB-CortexM compiled Jan 7 2019 14:08:04 V1.0, SN=760085218 Process: JLinkGDBServerCLExe {"utime": 1640,"msg": "dw1000_dev_init"} {"utime": 2046,"msg": "dw1000_pkg_init"} {"utime": 10055,"msg": "ccp_pkg_init"} {"utime": 10686,"msg": "tdma_pkg_init"} {"utime": 11376,"msg": "pan_pkg_init"} {"utime": 11710,"msg": "rng_pkg_init"} {"utime": 12026,"msg": "twr_ss_pkg_init"} {"utime": 12331,"msg": "twr_ds_pkg_init"} {"utime": 12637,"msg": "twr_ds_ext_pkg_init"} {"utime": 18684,"exec": "apps/twr_node_tdma/src/main.c"} {"utime": 18684,"msg": "device_id = 0xDECA0130"} {"utime": 18684,"msg": "PANID = 0xDECA"} {"utime": 18684,"msg": "DeviceID = 0x4300"} {"utime": 18684,"msg": "partID = 0xD4044300"} {"utime": 18684,"msg": "lotID = 0x4325100"} {"utime": 18684,"msg": "xtal_trim = 0x17"} {"utime": 18684,"msg": "frame_duration = 195 usec"} {"utime": 18684,"msg": "SHR_duration = 139 usec"} {"utime": 18684,"msg": "holdoff = 821 usec"}
After this nothing is happening, I am unable to see any ranging information. I am unable to understand where am I doing wrong.
Regards Asmita
Hello @asmitajha I guess you are running https://github.com/Decawave/mynewt-dw1000-apps/tree/master/apps/twr_node_tdma and https://github.com/Decawave/mynewt-dw1000-apps/tree/master/apps/twr_tag_tdma.
I ran https://github.com/Decawave/mynewt-dw1000-apps/tree/master/apps/twr_tag_nranges_tdma and https://github.com/Decawave/mynewt-dw1000-apps/tree/master/apps/twr_node_nranges_tdma.
I also did not get the output for twr_node_tdma and twr_tag_tdma. Please tell me how to use UART to see the output.
Regards and thanks, Shiv Mohith
Hello @Shivmohith
I am running the twr_tag_nranges_tdma with correct configuration of Console_RTT=1 and Console_UART=0 Currently, I have 5 pieces of DWM1001-Dev kit, on which I am implementing https://github.com/Decawave/mynewt-dw1000-apps/tree/master/apps/twr_tag_nranges_tdma
4 pieces have been configured as anchors (1 master node and 3 slave node) with twr_node_nranges_tdma and 5th piece is used as Tag with twr_tag_nranges_tdma. The tag is connected to PC running using newt run command and another terminal open with telnet localhost 19021. I have attached the image.
Thanks
Asmita
Hello @asmitajha I performed the exact steps and I got the output. I am not sure what is wrong.
Regards Shiv Mohith
Hello @Shivmohith Thanks. For UART I did the following changes: https://github.com/Decawave/mynewt-dw1000-apps/issues/18#issuecomment-504074582
Regards Asmita
Hi Shivmohith, Have a look at mynewt-dw1000-core/lib/nrng/src/nrng_encode.c for the json encoded. The calculations are performed in mynewt-dw1000-core/lib/twr_ss_nrng/src/twr_ss_nrng.c.
Note the rng numbers are IEEE 754 floating-point type cast to a UINT32 and encapulate this within the JSON string. So [1047851887] is 0.2392m.
For example In matlab
typecast(uint32( [1047851887]),'single') ans = single
0.2392
Hello @pkettle , @Shivmohith Thanks , now I understood clearly how to decode this. I want few queries: (1) Is this 0.2392 meter is range in terms of radius from the respective anchor to tag? (2) This is twr based example but what the values under tdoa indicate? (3) Is there some example through which we can get x,y,z coordinates? (4) What is seq and mask used for?
Thanks & regards
Asmita
Hello
As per Survey.h file, it is given as:
ccp->seq number to determine what node make use of this slot. - (there are 4 nodes but seq is sequentially increasing) typedef struct _survey_nrng_t{ uint16_t mask; //!< slot bitmask, the bit position in the mask decodes as the node slot_id float rng[]; //!< Ranging corresponding to above slot mask. When broadcasting the survey results we one transmit sucessful range requests. //!< Use NumberOfBits() BitIndex() to decode the bitmask }survey_nrng_t;