Accessing TWR data

The procedure for listening to TWR data is exactly the same as the procedure for listening to the RPT messages, which you can find an example of here: How to parse position data emitted by DWUSB GUI?.

The only things you will need to change when dealing with TWR data are the following:

  1. You will need to use the TWR data’s subscription method (uwbtalk_twr_t_subscribe) in order to subscribe to its data stream, instead of the call to uwbtalk_pos3_t_subscribe in the linked example.
  2. You will need to use the proper TWR channel in your subscription method. The files provided on our website for v1.3.30 of the UWBTALK protocol did not include a definition for the TWR data’s channel. However, the TWR data’s channel is simply the character string “TWR”, and thus, you will still be able to subscribe to the TWR data’s channel if you replace the RPT data’s channel (UWBTALK_CHAN_POS3) with the TWR data’s channel (“TWR”) in the linked example.
  3. In the callback function you pass into the uwbtalk_twr_t_subscribe function, you will want to have as the data structure parameter the twr_t data structure (as opposed to the POS3_receive_callback in the linked example which has the uwbtalk_pos3_t as the data structure).

If you do all of the above, you will be able to listen to the two way ranging data directly instead of only being able to see it through our GUI.