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

Support sdf <laser_retro> for lidar #181

Closed
doisyg opened this issue Nov 30, 2020 · 7 comments
Closed

Support sdf <laser_retro> for lidar #181

doisyg opened this issue Nov 30, 2020 · 7 comments
Labels
close the gap Features from Gazebo-classic enhancement New feature or request help wanted Extra attention is needed

Comments

@doisyg
Copy link
Contributor

doisyg commented Nov 30, 2020

Hello,
In the process of evaluating the portability of our sim from gazebo to ignition, I tried the ignition lidar plugin but noticed that it seems to ignore the sdf <laser_retro> value.
Am I missing something ? Or is it not implemented yet ? And if not where should I start to implement it ?

@chapulina chapulina added close the gap Features from Gazebo-classic enhancement New feature or request help wanted Extra attention is needed labels Nov 30, 2020
@iche033
Copy link
Contributor

iche033 commented Dec 1, 2020

the <laser_retro> flag is not implemented yet. The implementation depends on which render engine you plan to use in ignition (ogre 1.x or 2.x) since the OgreGpuRays and Ogre2GpuRays implementations are a bit different.

The work is likely not very trivial and requires some knowledge of how ogre / ogre2 render target and shader system works.
Here is a very high level idea: We need to add an extra pass in the GpuRays render pipeline to swap the visuals to use a custom laser retro material when the sensor is updating. The custom laser retro material is a set of shaders that change the visual's color to the laser retro value. The texture containing the retro values created in this step is then passed to the GpuRays' shaders so it can pack the retro values alongside of the range data. It works in a similar way to how a thermal camera reads temperature values of a visual. So the OgreThermalCamera / Ogre2ThermalCamera class maybe a good example to look at.

@doisyg
Copy link
Contributor Author

doisyg commented Dec 30, 2020

Hello,
I am completely new to ogre2 and shaders but by copy pasting from Ogre2ThermalCamera I got a prototype which is successfully applying retro values set to a visual with SetUserData (similar that what exists for Ogre2ThermalCamera):

  float laser_retro = 310.0;
  std::string userDataKey = "laser_retro";
  visual->SetUserData(userDataKey, laser_retro);

However, I am interested in these values to be set from a sdf file. The parsing of laser_retro can be easily added to the sdformat9 package but what I have trouble to understand is how the link between the parsed sdf and the rendering::v3::Visual is done.
Is there a typical example that I can use as a reference ?

@chapulina
Copy link
Contributor

how the link between the parsed sdf and the rendering::v3::Visual is done

Ignition Gazebo creates a rendering::Visual from an sdf::Visual on SceneManager::CreateVisual.

@doisyg
Copy link
Contributor Author

doisyg commented Dec 30, 2020

Thanks! That helps a lot.
If I succeed I will then do a PR on 3 packages to support laser_retro:

  1. sdformat - Merged - Add laser_retro in Visual sdformat#454
  2. ignition-gazebo - Merged - Add laser_retro support gz-sim#603
  3. ignition-rendering (targeting Ogre2) - Merged - Add laser retro support in Ogre2 #194

@doisyg
Copy link
Contributor Author

doisyg commented Jan 6, 2021

I have it now working locally, so pushing the first PR: gazebosim/sdformat#454
I will proceed with the next one once the first is accepted

@doisyg
Copy link
Contributor Author

doisyg commented Feb 2, 2021

Last PR: gazebosim/gz-sim#603

@chapulina
Copy link
Contributor

All merged! Thanks for the contribution, @doisyg !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
close the gap Features from Gazebo-classic enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants