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

Remove clamping from lidar noise #132

Merged
merged 2 commits into from
Jun 4, 2021
Merged

Conversation

peci1
Copy link
Contributor

@peci1 peci1 commented Jun 3, 2021

🦟 Bug fix

Fixes #131

Summary

This PR removes clamping from application of lidar noise. The clamping generates wrong points for missed rays, as it clamps even the +-Inf values to the lidar range. Removing the clamping might lead to having some points with distance larger than range_max of the sensor, but I'd argue that's okay in case of noise. If not, then the code should explicitly check to not clamp infinite values.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me and fixes the issue. I don't have a physical lidar to validate whether or not it's possible to return data larger than the max range in their spec.

I checked the depth camera (and rgbd) implementation, and the values are clamped in the shaders after adding noise. So I'm leaning towards adding a isinf check here to be consistent with the behavior of other depth based sensors, e.g.

        if (!std::isinf(range))
        {
          range = ignition::math::clamp(range,
              this->RangeMin(), this->RangeMax());
        }

Signed-off-by: Martin Pecka <[email protected]>
@peci1
Copy link
Contributor Author

peci1 commented Jun 3, 2021

Okay, being consistent is good. I just swapped !isinf for isfinite to also correctly cover NaNs.

@iche033 iche033 merged commit bf437e5 into gazebosim:ign-sensors4 Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔮 dome Ignition Dome
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants