Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

You are here: Forum Home → ANT+ Forums → ANT+ Bike Radar → Thread

   

Decoding ANT+ RADAR Payload

Rank

Total Posts: 7

Joined 2019-10-15

PM

this is the Payload I am getting from the RADAR

payload = [
48, // page #48 (0x30)
21, // Threat Level Target [1,2,3,4] each 2 bits
0,
195, // Range Target [1,2,3,4], each 6 bits
130, // Range Target [1,2,3,4], each 6 bits
137, // Range Target [1,2,3,4], each 6 bits
64,
4
]

From the ANT+ RADAR Profile, the bits 3-5 are the Range Target for each of the Target vehicles (it is tracking)
What I am unsure of is how to interpret the bits 3-5. In the common data pages examples (eg: Product Info pages, it is using 137-130-195 - ??little endian?? or should I be using 195-130-137? Basically which order?

Additionally, on the product info page example, the bits (4-7) are combined together before getting decoded into it's serial number. Am I supposed to do that for the Range Target as well?

thanks for any / all help.

or in pointing me to a direction where I can google or read up more.
     
RankRankRankRank

Total Posts: 122

Joined 2010-10-25

PM

It will be little endian. The only profile I remember with anything big endian is the the CTF bit if bike power where they explicitly label the bytes in the spec and make a note that it's big endian.

I have the following code.

range = (ANTRxMessage[SensorBaseChannel.PAGE_OFFSET + 3] & 0xff)
| ((ANTRxMessage[SensorBaseChannel.PAGE_OFFSET + 4] & 0xff) << 8)
| ((ANTRxMessage[SensorBaseChannel.PAGE_OFFSET + 5] & 0xff) << 16);
speed = (ANTRxMessage[SensorBaseChannel.PAGE_OFFSET + 6] & 0xff)
| ((ANTRxMessage[SensorBaseChannel.PAGE_OFFSET + 7] & 0xff) << 8);

for (int i = 0; i < 4; i++){
mSpeed[base_index + i] = ((float) ((speed >> (i*4)) & 0xf)) * 3.04f;
mRange[base_index + i] = ((float) ((range >> (i*6)) & 0x3f)) * 3.125f;
}
     
Rank

Total Posts: 7

Joined 2019-10-15

PM

Thanks very much ifor. I finally also found out how to get it done thanks to another poster in another forum. The whole bit about the bit-shift and bit mask was a little tough for me but given the example code, I managed to piece some of it together.