Skip to content

Cast each LiDAR tick's rays in one parallel batch - #170

Merged
WouterJansen merged 1 commit into
Cosys-Lab:5.8devfrom
jcfurey:fix/lidar-batched-rays
Oct 5, 2026
Merged

WouterJansen merged 1 commit into
Cosys-Lab:5.8devfrom
jcfurey:fix/lidar-batched-rays

Conversation

@jcfurey

@jcfurey jcfurey commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

The LiDAR ran a ParallelFor per horizontal angle with one ray per channel, so most of its time went into dispatching and waiting for tiny batches. The rays of consecutive angles now go in one batch, shot before a finished sweep is published, so the points are the same.

Also fixes two bugs in that code:

  • The range-noise generator was shared by the parallel rays (a data race); samples are now drawn before each batch.
  • With DrawDebugPoints, the debug-point index wrote one row past the end of its array.

In HERCULES (a Cosys-AirSim fork, UE 5.8.3), four 16-channel LiDARs went from ~25 ms to ~6 ms of game-thread time per frame in a dense scene. Also built from this tree with UE 5.8.3 (Windows): in Blocks, a 16-channel LiDAR with noise returns full 5,760-point sweeps.

🤖 Generated with Claude Code

The LiDAR ran a ParallelFor per horizontal angle with one ray per
channel, so a 16-channel LiDAR at 10 Hz issued hundreds of tiny batches
per second and the calling thread spent most of its time handing out and
waiting for work. The rays of consecutive angles now go in one batch,
shot before a completed sweep is published, so the points are the same.

- The range noise generator was shared by the parallel rays (a data
  race); noise samples are drawn before each batch.
- The debug-point index used the 1-based step and wrote one row past
  the end of point_cloud_draw_ when DrawDebugPoints was on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JmWqXFCY6vDdpRe4VHoaQX
@jcfurey
jcfurey marked this pull request as ready for review October 4, 2026 05:46
@WouterJansen
WouterJansen changed the base branch from main to 5.8dev October 5, 2026 06:52
@WouterJansen

Copy link
Copy Markdown
Contributor

Thank you for the nice improvements in these pull requests! Much appreciated!

@WouterJansen
WouterJansen merged commit a8b072d into Cosys-Lab:5.8dev Oct 5, 2026
@jcfurey

jcfurey commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Happy to help! Thanks for the merges!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants