Skip to content

Commit 137c837

Browse files
committed
WIP: new mrpt-viz library
1 parent 2270811 commit 137c837

File tree

247 files changed

+18665
-901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

247 files changed

+18665
-901
lines changed

libs/apps/src/CGridMapAlignerApp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include <mrpt/math/ops_containers.h>
2424
#include <mrpt/math/wrap2pi.h>
2525
#include <mrpt/obs/CSensoryFrame.h>
26-
#include <mrpt/opengl/CGridPlaneXY.h>
27-
#include <mrpt/opengl/CSetOfLines.h>
28-
#include <mrpt/opengl/Scene.h>
2926
#include <mrpt/poses/CPoint2D.h>
3027
#include <mrpt/poses/CPose3DPDFGaussian.h>
3128
#include <mrpt/poses/CPosePDFParticles.h>
@@ -34,6 +31,9 @@
3431
#include <mrpt/system/datetime.h>
3532
#include <mrpt/system/filesystem.h>
3633
#include <mrpt/system/os.h>
34+
#include <mrpt/viz/CGridPlaneXY.h>
35+
#include <mrpt/viz/CSetOfLines.h>
36+
#include <mrpt/viz/Scene.h>
3737

3838
using namespace mrpt::apps;
3939

@@ -188,7 +188,7 @@ void CGridMapAlignerApp::run()
188188
using namespace mrpt::slam;
189189
using namespace mrpt::maps;
190190
using namespace mrpt::obs;
191-
using namespace mrpt::opengl;
191+
using namespace mrpt::viz;
192192
using namespace mrpt::tfest;
193193
using namespace mrpt::math;
194194
using namespace mrpt::serialization;

libs/apps/src/ICP_SLAM_App.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
#include <mrpt/io/vector_loadsave.h>
1717
#include <mrpt/maps/COccupancyGridMap2D.h>
1818
#include <mrpt/obs/CObservationOdometry.h>
19-
#include <mrpt/opengl/CGridPlaneXY.h>
20-
#include <mrpt/opengl/CPlanarLaserScan.h> // from lib [mrpt-maps]
21-
#include <mrpt/opengl/Scene.h>
22-
#include <mrpt/opengl/stock_objects.h>
2319
#include <mrpt/serialization/CArchive.h>
2420
#include <mrpt/slam/CMetricMapBuilderICP.h>
2521
#include <mrpt/system/CRateTimer.h>
2622
#include <mrpt/system/filesystem.h>
2723
#include <mrpt/system/memory.h>
2824
#include <mrpt/system/os.h>
2925
#include <mrpt/system/thread_name.h>
26+
#include <mrpt/viz/CGridPlaneXY.h>
27+
#include <mrpt/viz/CPlanarLaserScan.h> // from lib [mrpt-maps]
28+
#include <mrpt/viz/Scene.h>
29+
#include <mrpt/viz/stock_objects.h>
3030

3131
using namespace mrpt::apps;
3232

@@ -75,7 +75,7 @@ void ICP_SLAM_App_Base::run()
7575
using namespace mrpt::slam;
7676
using namespace mrpt::obs;
7777
using namespace mrpt::maps;
78-
using namespace mrpt::opengl;
78+
using namespace mrpt::viz;
7979
using namespace mrpt::gui;
8080
using namespace mrpt::io;
8181
using namespace mrpt::gui;
@@ -279,7 +279,7 @@ void ICP_SLAM_App_Base::run()
279279
// Save a 3D scene view of the mapping process:
280280
if ((LOG_FREQUENCY > 0 && 0 == (step % LOG_FREQUENCY)) || (SAVE_3D_SCENE || win3D))
281281
{
282-
auto scene = mrpt::opengl::Scene::Create();
282+
auto scene = mrpt::viz::Scene::Create();
283283

284284
Viewport::Ptr view = scene->getViewport("main");
285285
ASSERT_(view);
@@ -290,7 +290,7 @@ void ICP_SLAM_App_Base::run()
290290
view_map->setTransparent(false);
291291

292292
{
293-
mrpt::opengl::CCamera& cam = view_map->getCamera();
293+
mrpt::viz::CCamera& cam = view_map->getCamera();
294294
cam.setAzimuthDegrees(-90);
295295
cam.setElevationDegrees(90);
296296
cam.setPointingAt(robotPose);
@@ -299,8 +299,8 @@ void ICP_SLAM_App_Base::run()
299299
}
300300

301301
// The ground:
302-
mrpt::opengl::CGridPlaneXY::Ptr groundPlane =
303-
mrpt::opengl::CGridPlaneXY::Create(-200, 200, -200, 200, 0, 5);
302+
mrpt::viz::CGridPlaneXY::Ptr groundPlane =
303+
mrpt::viz::CGridPlaneXY::Create(-200, 200, -200, 200, 0, 5);
304304
groundPlane->setColor(0.4f, 0.4f, 0.4f);
305305
view->insert(groundPlane);
306306
view_map->insert(CRenderizable::Ptr(groundPlane)); // A copy
@@ -310,7 +310,7 @@ void ICP_SLAM_App_Base::run()
310310
{
311311
scene->enableFollowCamera(true);
312312

313-
mrpt::opengl::CCamera& cam = view_map->getCamera();
313+
mrpt::viz::CCamera& cam = view_map->getCamera();
314314
cam.setAzimuthDegrees(-45);
315315
cam.setElevationDegrees(45);
316316
cam.setPointingAt(robotPose);

libs/apps/src/KFSLAMApp.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
#include <mrpt/io/vector_loadsave.h>
1818
#include <mrpt/math/ops_containers.h>
1919
#include <mrpt/obs/CRawlog.h>
20-
#include <mrpt/opengl/CGridPlaneXY.h>
21-
#include <mrpt/opengl/CSetOfLines.h>
22-
#include <mrpt/opengl/stock_objects.h>
2320
#include <mrpt/slam/CRangeBearingKFSLAM.h>
2421
#include <mrpt/slam/CRangeBearingKFSLAM2D.h>
2522
#include <mrpt/system/filesystem.h>
2623
#include <mrpt/system/os.h>
2724
#include <mrpt/system/string_utils.h>
25+
#include <mrpt/viz/CGridPlaneXY.h>
26+
#include <mrpt/viz/CSetOfLines.h>
27+
#include <mrpt/viz/stock_objects.h>
2828

2929
#include <fstream>
3030

@@ -84,7 +84,7 @@ void KFSLAMApp::run()
8484
using namespace mrpt;
8585
using namespace mrpt::slam;
8686
using namespace mrpt::maps;
87-
using namespace mrpt::opengl;
87+
using namespace mrpt::viz;
8888
using namespace mrpt::system;
8989
using namespace mrpt::math;
9090
using namespace mrpt::poses;
@@ -587,8 +587,8 @@ void KFSLAMApp::Run_KF_SLAM()
587587
if (++path_decim > 10)
588588
{
589589
path_decim = 0;
590-
mrpt::opengl::CSetOfObjects::Ptr xyz =
591-
mrpt::opengl::stock_objects::CornerXYZSimple(0.3f, 2.0f);
590+
mrpt::viz::CSetOfObjects::Ptr xyz =
591+
mrpt::viz::stock_objects::CornerXYZSimple(0.3f, 2.0f);
592592
xyz->setPose(CPose3D(it));
593593
scene3D->insert(xyz);
594594
}
@@ -597,8 +597,7 @@ void KFSLAMApp::Run_KF_SLAM()
597597

598598
// finally a big corner for the latest robot pose:
599599
{
600-
mrpt::opengl::CSetOfObjects::Ptr xyz =
601-
mrpt::opengl::stock_objects::CornerXYZSimple(1.0, 2.5);
600+
mrpt::viz::CSetOfObjects::Ptr xyz = mrpt::viz::stock_objects::CornerXYZSimple(1.0, 2.5);
602601
xyz->setPose(robotPoseMean3D);
603602
scene3D->insert(xyz);
604603
}
@@ -652,7 +651,7 @@ void KFSLAMApp::Run_KF_SLAM()
652651
{
653652
const typename ekfslam_t::TDataAssocInfo& da = mapping.getLastDataAssociation();
654653

655-
mrpt::opengl::CSetOfLines::Ptr lins = mrpt::opengl::CSetOfLines::Create();
654+
mrpt::viz::CSetOfLines::Ptr lins = mrpt::viz::CSetOfLines::Create();
656655
lins->setLineWidth(1.2f);
657656
lins->setColor(1, 1, 1);
658657
for (auto it = da.results.associations.begin(); it != da.results.associations.end(); ++it)
@@ -683,7 +682,7 @@ void KFSLAMApp::Run_KF_SLAM()
683682

684683
if (win3d)
685684
{
686-
mrpt::opengl::Scene::Ptr& scn = win3d->get3DSceneAndLock();
685+
mrpt::viz::Scene::Ptr& scn = win3d->get3DSceneAndLock();
687686
scn = scene3D;
688687

689688
// Update text messages:

libs/apps/src/MonteCarloLocalization_App.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@
3131
#include <mrpt/obs/CActionRobotMovement3D.h>
3232
#include <mrpt/obs/CObservationOdometry.h>
3333
#include <mrpt/obs/CRawlog.h>
34-
#include <mrpt/opengl/CDisk.h>
35-
#include <mrpt/opengl/CEllipsoid2D.h>
36-
#include <mrpt/opengl/CEllipsoid3D.h>
37-
#include <mrpt/opengl/CGridPlaneXY.h>
38-
#include <mrpt/opengl/CPointCloud.h>
39-
#include <mrpt/opengl/stock_objects.h>
4034
#include <mrpt/poses/CPose2D.h>
4135
#include <mrpt/poses/CPose2DInterpolator.h>
4236
#include <mrpt/random.h>
@@ -46,6 +40,12 @@
4640
#include <mrpt/system/CTicTac.h>
4741
#include <mrpt/system/filesystem.h>
4842
#include <mrpt/system/os.h>
43+
#include <mrpt/viz/CDisk.h>
44+
#include <mrpt/viz/CEllipsoid2D.h>
45+
#include <mrpt/viz/CEllipsoid3D.h>
46+
#include <mrpt/viz/CGridPlaneXY.h>
47+
#include <mrpt/viz/CPointCloud.h>
48+
#include <mrpt/viz/stock_objects.h>
4949

5050
#include <Eigen/Dense>
5151

@@ -90,7 +90,7 @@ void MonteCarloLocalization_Base::initialize(int argc, const char** argv)
9090
using namespace mrpt;
9191
using namespace mrpt::slam;
9292
using namespace mrpt::maps;
93-
using namespace mrpt::opengl;
93+
using namespace mrpt::viz;
9494
using namespace mrpt::gui;
9595
using namespace mrpt::math;
9696
using namespace mrpt::system;
@@ -409,8 +409,8 @@ void MonteCarloLocalization_Base::do_pf_localization()
409409
mrpt::math::TBoundingBoxf bbox({-50, -50, 0}, {50, 50, 0});
410410
if (auto pts = metricMap->getAsSimplePointsMap(); pts) bbox = pts->boundingBox();
411411

412-
scene.insert(mrpt::opengl::CGridPlaneXY::Create(
413-
bbox.min.x, bbox.max.x, bbox.min.y, bbox.max.y, 0, 5));
412+
scene.insert(
413+
mrpt::viz::CGridPlaneXY::Create(bbox.min.x, bbox.max.x, bbox.min.y, bbox.max.y, 0, 5));
414414

415415
if (win3D)
416416
win3D->setCameraZoom(2 * std::max(bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y));

libs/apps/src/RBPF_SLAM_App.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
#include <mrpt/obs/CActionRobotMovement3D.h>
2020
#include <mrpt/obs/CObservationGasSensors.h>
2121
#include <mrpt/obs/CRawlog.h>
22-
#include <mrpt/opengl/CEllipsoid2D.h>
23-
#include <mrpt/opengl/CEllipsoid3D.h>
24-
#include <mrpt/opengl/CGridPlaneXY.h>
25-
#include <mrpt/opengl/CSetOfLines.h>
26-
#include <mrpt/opengl/stock_objects.h>
2722
#include <mrpt/poses/CPosePDFGaussian.h>
2823
#include <mrpt/random.h>
2924
#include <mrpt/system/filesystem.h> // ASSERT_FILE_EXISTS_()
3025
#include <mrpt/system/memory.h> // getMemoryUsage()
26+
#include <mrpt/viz/CEllipsoid2D.h>
27+
#include <mrpt/viz/CEllipsoid3D.h>
28+
#include <mrpt/viz/CGridPlaneXY.h>
29+
#include <mrpt/viz/CSetOfLines.h>
30+
#include <mrpt/viz/stock_objects.h>
3131

3232
using namespace mrpt::apps;
3333

@@ -76,7 +76,7 @@ void RBPF_SLAM_App_Base::run()
7676
using namespace mrpt::slam;
7777
using namespace mrpt::obs;
7878
using namespace mrpt::maps;
79-
using namespace mrpt::opengl;
79+
using namespace mrpt::viz;
8080
using namespace mrpt::gui;
8181
using namespace mrpt::io;
8282
using namespace mrpt::gui;
@@ -396,15 +396,15 @@ void RBPF_SLAM_App_Base::run()
396396
scene = std::make_shared<Scene>();
397397

398398
// The ground:
399-
mrpt::opengl::CGridPlaneXY::Ptr groundPlane =
400-
mrpt::opengl::CGridPlaneXY::Create(-200, 200, -200, 200, 0, 5);
399+
mrpt::viz::CGridPlaneXY::Ptr groundPlane =
400+
mrpt::viz::CGridPlaneXY::Create(-200, 200, -200, 200, 0, 5);
401401
groundPlane->setColor(0.4f, 0.4f, 0.4f);
402402
scene->insert(groundPlane);
403403

404404
// The camera pointing to the current robot pose:
405405
if (CAMERA_3DSCENE_FOLLOWS_ROBOT)
406406
{
407-
mrpt::opengl::CCamera::Ptr objCam = mrpt::opengl::CCamera::Create();
407+
mrpt::viz::CCamera::Ptr objCam = mrpt::viz::CCamera::Create();
408408
CPose3D robotPose;
409409
curPDF.getMean(robotPose);
410410

@@ -419,7 +419,7 @@ void RBPF_SLAM_App_Base::run()
419419

420420
// Draw the robot particles:
421421
size_t M = mapBuilder->mapPDF.particlesCount();
422-
mrpt::opengl::CSetOfLines::Ptr objLines = mrpt::opengl::CSetOfLines::Create();
422+
mrpt::viz::CSetOfLines::Ptr objLines = mrpt::viz::CSetOfLines::Create();
423423
objLines->setColor(0, 1, 1);
424424
for (size_t i = 0; i < M; i++)
425425
{

libs/graphs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ define_mrpt_lib(
55
# Lib name
66
graphs
77
# Dependencies
8-
mrpt-opengl
8+
mrpt-viz
99
)
1010

1111

libs/graphs/include/mrpt/graphs/CMRVisualizer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ class CMRVisualizer :
4242

4343
~CMRVisualizer() override;
4444
void drawNodePoints(
45-
mrpt::opengl::CSetOfObjects::Ptr& object,
45+
mrpt::viz::CSetOfObjects::Ptr& object,
4646
const mrpt::containers::yaml* viz_params = nullptr) const override;
4747
void drawEdges(
48-
mrpt::opengl::CSetOfObjects::Ptr& object,
48+
mrpt::viz::CSetOfObjects::Ptr& object,
4949
const mrpt::containers::yaml* viz_params = nullptr) const override;
5050

5151
private:
@@ -70,10 +70,10 @@ class CMRVisualizer<CPOSE, MAPS_IMPLEMENTATION, TMRSlamNodeAnnotations, EDGE_ANN
7070

7171
~CMRVisualizer();
7272
void drawNodePoints(
73-
mrpt::opengl::CSetOfObjects::Ptr& object,
73+
mrpt::viz::CSetOfObjects::Ptr& object,
7474
const mrpt::containers::yaml* viz_params = nullptr) const;
7575
void drawEdges(
76-
mrpt::opengl::CSetOfObjects::Ptr& object,
76+
mrpt::viz::CSetOfObjects::Ptr& object,
7777
const mrpt::containers::yaml* viz_params = nullptr) const;
7878

7979
private:

libs/graphs/include/mrpt/graphs/CMRVisualizer_impl.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ CMRVisualizer<CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS>::~
3535

3636
template <class CPOSE, class MAPS_IMPLEMENTATION, class NODE_ANNOTATIONS, class EDGE_ANNOTATIONS>
3737
void CMRVisualizer<CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS>::drawNodePoints(
38-
mrpt::opengl::CSetOfObjects::Ptr& object,
39-
const mrpt::containers::yaml* viz_params /*=NULL*/) const
38+
mrpt::viz::CSetOfObjects::Ptr& object, const mrpt::containers::yaml* viz_params /*=NULL*/) const
4039
{
4140
}
4241

4342
template <class CPOSE, class MAPS_IMPLEMENTATION, class NODE_ANNOTATIONS, class EDGE_ANNOTATIONS>
4443
void CMRVisualizer<CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS>::drawEdges(
45-
mrpt::opengl::CSetOfObjects::Ptr& object,
46-
const mrpt::containers::yaml* viz_params /*=NULL*/) const
44+
mrpt::viz::CSetOfObjects::Ptr& object, const mrpt::containers::yaml* viz_params /*=NULL*/) const
4745
{
4846
}
4947

@@ -68,10 +66,10 @@ CMRVisualizer<CPOSE, MAPS_IMPLEMENTATION, TMRSlamNodeAnnotations, EDGE_ANNOTATIO
6866
template <class CPOSE, class MAPS_IMPLEMENTATION, class EDGE_ANNOTATIONS>
6967
void CMRVisualizer<CPOSE, MAPS_IMPLEMENTATION, TMRSlamNodeAnnotations, EDGE_ANNOTATIONS>::
7068
drawNodePoints(
71-
mrpt::opengl::CSetOfObjects::Ptr& object,
69+
mrpt::viz::CSetOfObjects::Ptr& object,
7270
const mrpt::containers::yaml* viz_params /*=NULL*/) const
7371
{
74-
using namespace mrpt::opengl;
72+
using namespace mrpt::viz;
7573
using namespace mrpt::graphs;
7674
using namespace mrpt::img;
7775
using namespace std;
@@ -143,10 +141,9 @@ void CMRVisualizer<CPOSE, MAPS_IMPLEMENTATION, TMRSlamNodeAnnotations, EDGE_ANNO
143141

144142
template <class CPOSE, class MAPS_IMPLEMENTATION, class EDGE_ANNOTATIONS>
145143
void CMRVisualizer<CPOSE, MAPS_IMPLEMENTATION, TMRSlamNodeAnnotations, EDGE_ANNOTATIONS>::drawEdges(
146-
mrpt::opengl::CSetOfObjects::Ptr& object,
147-
const mrpt::containers::yaml* viz_params /*=NULL*/) const
144+
mrpt::viz::CSetOfObjects::Ptr& object, const mrpt::containers::yaml* viz_params /*=NULL*/) const
148145
{
149-
using namespace mrpt::opengl;
146+
using namespace mrpt::viz;
150147
using namespace mrpt::img;
151148

152149
ASSERTMSG_(viz_params, "Pointer to viz_params was not provided.");

libs/graphs/include/mrpt/graphs/CNetworkOfPoses.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
#include <mrpt/io/CFileGZInputStream.h>
2424
#include <mrpt/io/CFileGZOutputStream.h>
2525
#include <mrpt/math/utils.h>
26-
#include <mrpt/opengl/CSetOfObjects.h>
2726
#include <mrpt/poses/poses_frwds.h>
2827
#include <mrpt/serialization/CSerializable.h>
2928
#include <mrpt/serialization/stl_serialization.h>
3029
#include <mrpt/system/os.h>
30+
#include <mrpt/viz/CSetOfObjects.h>
3131

3232
#include <iostream>
3333
#include <iterator>
@@ -294,7 +294,7 @@ class CNetworkOfPoses : public mrpt::graphs::CDirectedGraph<CPOSE, EDGE_ANNOTATI
294294
* class instance.
295295
*/
296296
inline void getAs3DObject(
297-
mrpt::opengl::CSetOfObjects::Ptr object, const mrpt::containers::yaml& viz_params) const
297+
mrpt::viz::CSetOfObjects::Ptr object, const mrpt::containers::yaml& viz_params) const
298298
{
299299
using visualizer_t = mrpt::graphs::detail::CVisualizer<
300300
CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS>;

0 commit comments

Comments
 (0)