RobotecAI / RGLGazeboPlugin

Other
61 stars 11 forks source link

Implement support for non-repetitive/alternating lidar scan patterns #52

Open Roboterbastler opened 2 weeks ago

Roboterbastler commented 2 weeks ago

Change description

As described in issue https://github.com/RobotecAI/RGLGazeboPlugin/issues/31 there are some lidar sensors using non-repetitive patterns. To accurately model their point cloud data I modified the implementation so that presets for these type of sensors can be created.

The basic idea is that for alternating patterns each update step only uses a subset of samples of the total pattern vector and this subset cycles through the vector until the pattern sequence eventually repeats again. For this I introduced lidarPatternSampleSize which in the case of an alternating pattern is an integer divisor of the total pattern vector size. Otherwise it just equals lidarPattern.size(). To swap the alternating pattern in each update the compute graph nodes are already created in advance and only re-linked. In my specific testing case (Livox Mid360) this re-linking step adds about 10-20 microseconds which is not really significant compared to the total time of one update step. In the static pattern case the graph is not changed.

Since personally my motivation was to simulate the Livox Mid360 sensor I added the preset for it and while I was at it also added the other sensors whose patterns were available here. For reference I used this small program to convert the Livox config files to the file format used by RGLGazeboPlugin. I think it could be very useful for the community to have these presets readily available, the only potential problem I see is the file size for this git repository.

I did not implement an option to specify an alternating pattern via <pattern_preset_path>, this would require either extending the XML config or the file format to accommodate the lidar pattern sample size. Could be added in the future though.

Small gallery of added pattern presets (only showing one sub-pattern each):

How to test


Fixes #31

PawelLiberadzki commented 1 week ago

@Roboterbastler Thank you for your contribution, we greatly appreciate it! Now all team members are busy with ongoing work, but within incoming 2-3 weeks we will review this code and help you merge it.