Mar 29, 2019
02:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 29, 2019
02:25 AM
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?
1 Reply
Apr 09, 2019
01:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 09, 2019
01:49 AM
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.
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.