Gazebo | Ignition | Community
Ask Your Question

Implement a gpu_ray plugin with custom shape

asked 2022-05-27 11:26:42 -0500

cantolini gravatar image

updated 2022-06-01 11:31:30 -0500

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.


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] [] EXCEPTION: Camera horizontal field of view invalid.
[gazebo-1] [Err] [] EXCEPTION: Camera horizontal field of view invalid.
[gazebo-1] [Err] [] Unable to remove sensor[default::example::base_footprint::my_lidar_gpu] because it does not exist.

Anybody knows why I could get this error?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-06-02 07:33:08 -0500

nkoenig gravatar image

I believe you'll need to write your own shaders. The [GpuLaser[( 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.

edit flag offensive delete link more


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

cantolini gravatar imagecantolini ( 2022-06-03 05:39:56 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2022-05-27 11:26:42 -0500

Seen: 41 times

Last updated: Jun 02