unitreerobotics / unilidar_sdk

SDK for Unitree L1 LiDAR
BSD 3-Clause "New" or "Revised" License
59 stars 23 forks source link

Slow sample rate in C++ #13

Open gh0st-gh opened 6 months ago

gh0st-gh commented 6 months ago

Using the C++ SDK example and polling at 1500 Hz up to 10x this rate (and as low as 100 Hz just for testing) resulted in extremely slow responses (10s to 100s of ms) from the lidarreader object. Over a battery of sampling using 2 different hardware units resulted in point/second sampling rates of 50 to 200 points per second, averaging ~120 points/s. Our host hardware is fine. We're at < 5% CPU usage. Advertised for the L1 RM is 22,600 samples/second. Running the ROS sample package produced decent, usable visualizations by comparison on the same hardware.

What is the discrepancy here? It seems like, if anything, the direct C++ access should be the same or faster than ROS. Is there any other sample C++ code which is proven to accumulate new data points anywhere near the advertised rate rather than just polling the lidarreader parse() function? Any projects someone can link to which use strictly C++ and demonstrate this?

An example would be helpful. I've tried adjusting all of the (poorly documented) parameters, and none seem to help.