Robotics StackExchange | Archived questions

Implement a gpu_ray plugin with custom shape

Hi all,

I would like to create a gpu_ray plugin for a 3D lidar having a custom pattern, different from the typical velodyne type. I have the equation of each of the curved beams composing it, and need to find a way to modify the collision shape of the lidar's plugin.

I've managed to do so with the (non gpu) ray plugin, using physics multiRayShape, but if I understand it right, gpu_ray sensor does not use gazebo physics as the ray sensor does. Seeing how slow the simulation goes without gpu, I really need find a way to implement it.

So if anyone knows how that could be done, or has any information or tip about gazebo's gpu_ray sensor and how to modify its shape, I would really appreciate the help.

[EDIT]

By looking more into it, I think that what I need to modify is the gazebo::rendering::GpuLaser::CreateMesh function, as it seems to be where the shape of the lidar's pattern is defined. But as I am trying to implement a custom GpuRayPlugin, using in the robot's sdf file the gpu_ray sensor type, I am encountering the following error:

[gazebo-1] [Err] [Camera.cc:168] EXCEPTION: Camera horizontal field of view invalid.
[gazebo-1] [Err] [Camera.cc:168] EXCEPTION: Camera horizontal field of view invalid.
[gazebo-1] [Err] [SensorManager.cc:612] Unable to remove sensor[default::example::base_footprint::my_lidar_gpu] because it does not exist.

Anybody knows why I could get this error?

Thanks!

Asked by cantolini on 2022-05-27 11:26:42 UTC

Comments

Answers

I believe you'll need to write your own shaders. The [GpuLaser[(https://github.com/osrf/gazebo/blob/gazebo11/gazebo/rendering/GpuLaser.cc#L178) uses the laser_* fragment and vertex shaders to generate the laser data. See also the gazebo.material file.

There currently isn't a hook to the GpuLaser class that would let you supply your own shader. You'll have to modify the shaders directly and compile Gazebo from source.

Asked by nkoenig on 2022-06-02 07:33:08 UTC

Comments

Thank you for your response. Do you mean that modifying the CreateMesh function as mentioned above wouldn't work? Do you know what it does then?

And would you have some documentation about shaders, or how what you're suggesting could be done? I don't have much knowledge about it, and can't seem to find information

Asked by cantolini on 2022-06-03 05:39:56 UTC