Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Lidar lag spike from RaycastLiDARSensor.cs #169

Closed

Conversation

alexandrefch
Copy link
Contributor

Fixed a performance bug when using lidar by changing the minimum raycast calculation per job.

As we see in the unity editor's profiling tool, there's a lag spike every time lidar run, and a single job seems to perform all the calculations.

Screenshot from 2024-09-12 15-58-44

After changing the minCommandsPerJob parameter from RaycastCommand.ScheduleBatch inside RaycastLiDARSensor.cs with a constant value of 256 (arbitrary value), we can see an improvement: there are no more lag peaks, the frame rate is now stable and tasks are better distributed between jobs.

after

Fix performance bug when using lidar by changing minimum raycast computation per job
@alexandrefch alexandrefch closed this by deleting the head repository Sep 23, 2024
@RyodoTanaka
Copy link
Member

@alexandrefch
Sorry for late reply.
But, I am checking your nice PR.
Thus, I am wondering why you closed this PR.
If it is because the delay, we would like to have more time.

@alexandrefch
Copy link
Contributor Author

Hello, don't worry there is no problem, I just want to solve another performance issue related to camera sensor, but I was working on master branch and not feature, that was blocking me, I will reopen it after my tweak.

@RyodoTanaka
Copy link
Member

@alexandrefch
I see.
Thank you for your reply.
And I am looking forward to your new PR.

FYI, We also have a big PR on #163.
This may also includes the Camera problem.

@alexandrefch
Copy link
Contributor Author

I just checked your linked commit and the camera issue still, in fact here, image publisher is based on compressed image, but image serializer is using EncodeToJPG method from Unity that was intended for screenshot purpose, not realtime encoding.

To allow a fast and high quality image topic (1920x1080 at 30fps), like in ZeroSimROSUnity the publisher need to send raw image by simply use the rendertexture data without encoding anything.

@RyodoTanaka
Copy link
Member

I see.
Thank you for your comment.
I did not know ZeroSimROSUnity. I will check details.
And also looking forward to hear your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants