-
Notifications
You must be signed in to change notification settings - Fork 58
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
Publish lidar scan only if there are lidar scan connections #447
Conversation
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linters
/github/workspace/src/Lidar.cc:453: Lines should be <= 80 characters long [whitespace/line_length] [2]
/github/workspace/src/Lidar.cc:469: Lines should be <= 80 characters long [whitespace/line_length] [2]
/// outside the detectable range. | ||
/// NAN values will be clamped to max range. | ||
/// \return Clamped range value. | ||
private: double Clamp(double _range) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you don't use std::clamp ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed to use special handling for clamping nan and inf values. Used std::clamp
inside the function. 5c28cce
Signed-off-by: Ian Chen <[email protected]>
fixed. 5c28cce |
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
🦟 Bug fix
Summary
The GpuLidarSensor publishes to 2 topics: 1) lidar scan and 2) points cloud. Previously if the user subscribes to just the point cloud topic, we perform extra computation to pack and publish lidar scans as well. This PR adds an additional check to make sure we don't do extra work when there are not lidar scan subscribers.
In order to make this work, I also had to modify functions for directly accessing lidar scan data. They were accessing the lidar scan msg (which now never gets populated if there are no subscribers), so I modified them to access data from the raw laser buffer instead.
I also fixed the frame id for the lidar scan msg.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.