We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ign-rendering6
SetSize
LidarVisual
Marker
point_cloud_point.material
lidar_visual
diff --git a/examples/lidar_visual/GlutWindow.cc b/examples/lidar_visual/GlutWindow.cc index 51f51cdb..5287edab 100644 --- a/examples/lidar_visual/GlutWindow.cc +++ b/examples/lidar_visual/GlutWindow.cc @@ -64,7 +64,7 @@ ir::ImagePtr g_image; bool g_initContext = false; bool g_clear = false; std::vector<double> g_lidarData; -ir::LidarVisualPtr g_lidar; +std::vector<ir::LidarVisualPtr> g_lidars; bool g_lidarVisualUpdateDirty = false; bool g_showNonHitting = true; LidarVisualType g_lidarVisType = LidarVisualType::LVT_TRIANGLE_STRIPS; @@ -249,16 +249,19 @@ void updateLidarVisual() // change detected due to key press if (g_lidarVisualUpdateDirty) { - if (g_clear == true) + for (auto lidar : g_lidars) { - g_lidar->ClearPoints(); - } - else - { - g_lidar->SetDisplayNonHitting(g_showNonHitting); - g_lidar->SetPoints(g_lidarData); - g_lidar->SetType(g_lidarVisType); - g_lidar->Update(); + if (g_clear == true) + { + lidar->ClearPoints(); + } + else + { + lidar->SetDisplayNonHitting(g_showNonHitting); + lidar->SetPoints(g_lidarData); + lidar->SetType(g_lidarVisType); + lidar->Update(); + } } g_lidarVisualUpdateDirty = false; g_clear = false; @@ -399,7 +402,7 @@ void initCamera(ir::CameraPtr _camera) ////////////////////////////////////////////////// void initLidarVisual(ir::LidarVisualPtr _lidar) { - g_lidar = _lidar; + g_lidars.push_back(_lidar); } ////////////////////////////////////////////////// @@ -457,6 +460,7 @@ void run(std::vector<ir::CameraPtr> _cameras, initCamera(_cameras[0]); initLidarVisual(_nodes[0]); + initLidarVisual(_nodes[1]); initContext(); printUsage(); g_lidarData.clear(); diff --git a/examples/lidar_visual/Main.cc b/examples/lidar_visual/Main.cc index 71e3eebf..e2d4fec9 100644 --- a/examples/lidar_visual/Main.cc +++ b/examples/lidar_visual/Main.cc @@ -239,6 +239,45 @@ LidarVisualPtr createLidar(ScenePtr _scene) return lidar; } +////////////////////////////////////////////////// +LidarVisualPtr createLidar2(ScenePtr _scene) +{ + // create lidar visual + LidarVisualPtr lidar = _scene->CreateLidarVisual(); + lidar->SetMinHorizontalAngle(hMinAngle); + lidar->SetHorizontalRayCount(hRayCount); + lidar->SetMaxHorizontalAngle(hMaxAngle); + lidar->SetVerticalRayCount(vRayCount); + lidar->SetMinVerticalAngle(vMinAngle); + lidar->SetMaxVerticalAngle(vMaxAngle); + lidar->SetMaxRange(maxRange); + lidar->SetMinRange(minRange); + lidar->SetSize(50.0); + + // the types can be set as follows:- + // LVT_POINTS -> Lidar Points at the range value + // LVT_RAY_LINES -> Lines along the lidar sensor to the obstacle + // LVT_TRIANGLE_STRIPS -> Coloured triangle strips denoting hitting and + // non-hitting parts of the scan + lidar->SetType(LidarVisualType::LVT_TRIANGLE_STRIPS); + lidar->SetPoints(pts); + + VisualPtr root = _scene->RootVisual(); + root->AddChild(lidar); + + // set this value to false if only the rays that are hitting another obstacle + // are to be displayed. + lidar->SetDisplayNonHitting(true); + + lidar->SetWorldPosition(testPose.Pos() + math::Vector3d(1.0, 0.0, 0.0)); + lidar->SetWorldRotation(testPose.Rot()); + + // update lidar visual + lidar->Update(); + + return lidar; +} + ////////////////////////////////////////////////// CameraPtr createCamera(const std::string &_engineName) { @@ -290,6 +329,7 @@ int main(int _argc, char** _argv) cameras.push_back(camera); sensors.push_back(createGpuRaySensor(camera->Scene())); nodes.push_back(createLidar(camera->Scene())); + nodes.push_back(createLidar2(camera->Scene())); } } catch (...)
2
I believe this is happening because we're modifying the material itself instead of just modifying that instance:
https://github.com/ignitionrobotics/ign-rendering/blob/8e7b7fbbbff519a6fb567efdd4ec08468e8d8f6a/ogre2/src/Ogre2LidarVisual.cc#L481-L485
The same here:
https://github.com/ignitionrobotics/ign-rendering/blob/8e7b7fbbbff519a6fb567efdd4ec08468e8d8f6a/ogre2/src/Ogre2Marker.cc#L110-L114
I think the same happens with the color when set globally for all points (as opposed to per-point like in #494 )
The text was updated successfully, but these errors were encountered:
hmm one thing to try is to clone the material before setting it to marker's ogre item.
Sorry, something went wrong.
chapulina
No branches or pull requests
Environment
ign-rendering6
branchDescription
SetSize
(added on Add SetSize API for LidarVisual #392) on aLidarVisual
/Marker
should only affect points on that visual.point_cloud_point.material
.Steps to reproduce
lidar_visual
with this diff to have 2 separate visuals, one with size 5, the other with size 50:diff
2
to change to points. You'll see that both visuals have the same size, 50, which was the last set:I believe this is happening because we're modifying the material itself instead of just modifying that instance:
https://github.com/ignitionrobotics/ign-rendering/blob/8e7b7fbbbff519a6fb567efdd4ec08468e8d8f6a/ogre2/src/Ogre2LidarVisual.cc#L481-L485
The same here:
https://github.com/ignitionrobotics/ign-rendering/blob/8e7b7fbbbff519a6fb567efdd4ec08468e8d8f6a/ogre2/src/Ogre2Marker.cc#L110-L114
I think the same happens with the color when set globally for all points (as opposed to per-point like in #494 )
The text was updated successfully, but these errors were encountered: