Retrieving processed data from multiple Position2Go boards

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User16845
Level 1
Level 1
How to retrieve interleaved processed data (velocity, range, angle) from multiple Position2Go demo boards simultaneously using the Radar Host Communication C API? Tried to register multiple callbacks to obtain target info and passed the appropriate protocol handle and endpoint for each radar device. However, only the data from first radar device (at com port 1) is recorded. Any help with this?
0 Likes
1 Reply
Montassar-BR
Employee
Employee
5 questions asked 250 sign-ins 25 likes received
Hi meera,

Yes it is possible, but there are some pitfalls.

In general the ComLib is capable to handle multiple connections at the same time. That’s why the connection handle must always be specified in each function call.
You can easily start two Position2Go devices, and then call get_next_frame alternatively for both devices. OK, here the COM lib usage is not really simultaneously, but the devices are working simultaneously.

The callback functions will be a little more complicated, because for both devices always the same callback with the same context pointer is called.
The callback function must check the connection handle to find out what device sent the callback and route the data accordingly.

To be really simultaneous, both devices must be handles in different threads. That will become somewhat complicated, because CommLib is not thread safe.
It’s not possible to open different connections and register callbacks from different threads. If that setup part is kept in a common main thread, then fetching data from different threads should work.

If you further want to do the setup in different threads, than there is a need for some wrapper code around ComLib that handles locking.

Cheers,
Montassar.
0 Likes