Announcements

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

cross mob
User20244
Level 1
Level 1
First question asked
Hi,

I have recently purchased two Demo Position2Go boards. I want to retrieve processed data (range, velocity, angle) from both of the radar devices simultaneously--i.e., at each time instant I want to obtain the target data reported by radar 1 followed by radar 2. I am using C interface of the Radar Host Communication library.
I modified the example file given (extract_raw_data.c) to get the processed target info instead of the raw ADC data and it works for one device.
However, when two of the radar devices are connected to two USB ports, even after registering two callbacks and providing the appropriate protocol handle and endpoint for each radar, only the data from first radar device is recorded. i.e., the same data (from radar 1) is repeated for the call to ep_targetdetect_get_targets() function with protocol handle and endpoint for radar device 2.
Could you kindly help me with this, pls.?

Thanks,
Dory.
0 Likes
1 Solution
Montassar-BR
Employee
Employee
5 questions asked 250 sign-ins 25 likes received
Hello Dory,

Yes, it is possible to read two radar data streams at one time, 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 P2G devices, and then call get_next_frame() alternatingly for both devices. Here devices are working simultaneously, but ComLib usage is not really simultaneously.
For both devices always the same callback function with the same context pointer is called, and 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 handled in different threads. That will become somewhat complicated, because ComLib 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 user wants to do the setup in different threads, than there is a need for some wrapper code around ComLib that handles locking.

Best Regards,
Montassar.

View solution in original post

0 Likes
2 Replies
Montassar-BR
Employee
Employee
5 questions asked 250 sign-ins 25 likes received
Hello Dory,

Yes, it is possible to read two radar data streams at one time, 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 P2G devices, and then call get_next_frame() alternatingly for both devices. Here devices are working simultaneously, but ComLib usage is not really simultaneously.
For both devices always the same callback function with the same context pointer is called, and 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 handled in different threads. That will become somewhat complicated, because ComLib 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 user wants to do the setup in different threads, than there is a need for some wrapper code around ComLib that handles locking.

Best Regards,
Montassar.
0 Likes
User20843
Level 1
Level 1
Two data streams? What are the hardware requirements?
0 Likes