-
Notifications
You must be signed in to change notification settings - Fork 281
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
Visualize Lidar Plugin for ign-gazebo #301
Conversation
c980c5e
to
7eb3efe
Compare
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.
one small feature request is to add a checkbox for toggling visibility of the lidar visual in case user has multiple plugins running and they want to selectively disable/enable visualizations
#include <ignition/common/MeshManager.hh> | ||
#include <ignition/common/Profiler.hh> | ||
#include <ignition/common/Uuid.hh> | ||
#include <ignition/common/VideoEncoder.hh> |
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.
most of these headers are not needed. Can you remove the ones not used?
{ | ||
parent = child; | ||
foundChild = true; | ||
if (i+1 == lidarURIVec.size()-1) |
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.
I think the logic in this block assumes the model > link > sensor hierarchy?
We also support nested models, i.e.g model > model > link > sensor, in which case the logic above may not work?
igndbg << "Creating lidar visual" << std::endl; | ||
|
||
auto root = scene->RootVisual(); | ||
this->dataPtr->lidar = scene->CreateLidarVisual(); |
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.
I don't see the visual destroyed? we need to be careful not to leave any dangling visuals around when the plugin exits
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.
following up on this, we should destroy the visual when the user closes the plugin, i.e. by clicking on X
in the corner of the plugin window. Currently I see that lidar visual remains in the scene after exiting the plugin, and when I open the same plugin again, a duplicate lidar visual gets created.
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.
there are a couple of minor code check errors:
./src/gui/plugins/visualize_lidar/VisualizeLidar.cc:323: Lines should be <= 80 characters long [whitespace/line_length] [2]
./src/gui/plugins/visualize_lidar/VisualizeLidar.cc:374: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
if (!_value) | ||
{ | ||
ignmsg << "Lidar Visual Display OFF." << std::endl; | ||
this->dataPtr->lidar->SetType(rendering::LidarVisualType::LVT_NONE); |
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.
you should be able to call this->dataPtr->lidar->SetVisible(false)
to make it invisible, which is a faster operation than clearing all the lidar data. Same for re-enabling the lidar visual display below
igndbg << "Creating lidar visual" << std::endl; | ||
|
||
auto root = scene->RootVisual(); | ||
this->dataPtr->lidar = scene->CreateLidarVisual(); |
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.
following up on this, we should destroy the visual when the user closes the plugin, i.e. by clicking on X
in the corner of the plugin window. Currently I see that lidar visual remains in the scene after exiting the plugin, and when I open the same plugin again, a duplicate lidar visual gets created.
one small issue:
|
@iche033 Thanks for bringing it to my attention. I think this is happening whenever the I can solve this by not updating the visual in the plugin if the display option is off. |
sounds like once we clear the visual data and create new ones in ign-rendering, we need to call |
fixed in gazebosim/gz-rendering#133 |
changes look good. Can you merge with / rebase on |
20c1799
to
c185c8d
Compare
Signed-off-by: Mihir Kulkarni <[email protected]>
Signed-off-by: Mihir Kulkarni <[email protected]>
Signed-off-by: Mihir Kulkarni <[email protected]>
Signed-off-by: Mihir Kulkarni <[email protected]>
…aying visual Signed-off-by: Mihir Kulkarni <[email protected]>
c185c8d
to
bd34996
Compare
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.
LGTM, two small comments
Signed-off-by: Mihir Kulkarni <[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.
The Mac build failed, I think we need to bump the ign-rendering
revision on homebrew-simulation
:
/Users/jenkins/workspace/ignition_gazebo-ci-pr_any-homebrew-amd64/ign-gazebo/src/gui/plugins/visualize_lidar/VisualizeLidar.cc:49:10: fatal error: 'ignition/rendering/LidarVisual.hh' file not found
#include "ignition/rendering/LidarVisual.hh"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@osrf-jenkins run tests, let's see what happens now |
@osrf-jenkins run tests 🤞 |
Co-authored-by: Louise Poubel <[email protected]>
@ahcorde Can you please review it.
This PR integrates the LidarVisual from ignition rendering into ign-gazebo. Options are provided to select the visual type, the subscribed topic and to display or ignore lidar rays that do not hit an obstacle.