Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Dec 15, 2023
2 parents 3901411 + 4cfe2aa commit aa7b1df
Show file tree
Hide file tree
Showing 95 changed files with 3,793 additions and 1,589 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/nanoflann
Submodule nanoflann updated 33 files
+81 −0 .circleci/check_style.sh
+83 −0 .circleci/clang_format_codebase.sh
+40 −0 .circleci/clang_git_format/.gitignore
+202 −0 .circleci/clang_git_format/LICENSE
+116 −0 .circleci/clang_git_format/README.md
+10 −0 .circleci/clang_git_format/clang_git_format/__init__.py
+159 −0 .circleci/clang_git_format/clang_git_format/clang_format.py
+2 −0 .circleci/clang_git_format/clang_git_format/config.py
+38 −0 .circleci/clang_git_format/clang_git_format/custom_exceptions.py
+343 −0 .circleci/clang_git_format/clang_git_format/repo.py
+80 −0 .circleci/clang_git_format/clang_git_format/utils.py
+578 −0 .circleci/clang_git_format/format_code.py
+25 −0 .circleci/clang_git_format/scripts/convert_inline_dox_comments_file.sh
+72 −9 .circleci/config.yml
+3 −0 .circleci/python_reqs.txt
+40 −0 .github/workflows/check-clang-format.yml
+85 −0 .github/workflows/ci-linux.yml
+48 −23 CHANGELOG.md
+10 −1 CMakeLists.txt
+20 −1 README.md
+1 −1 appveyor.yml
+1 −0 examples/CMakeLists.txt
+6 −4 examples/KDTreeVectorOfVectorsAdaptor.h
+16 −4 examples/examples_gui/nanoflann_gui_example_R3/CMakeLists.txt
+57 −5 examples/examples_gui/nanoflann_gui_example_R3/nanoflann_gui_example_R3.cpp
+4 −4 examples/examples_gui/nanoflann_gui_example_bearings/nanoflann_gui_example_bearings.cpp
+2 −2 examples/matrix_example.cpp
+2 −2 examples/pointcloud_custom_metric.cpp
+125 −0 examples/pointcloud_custom_resultset.cpp
+10 −0 examples/saveload_example.cpp
+1 −1 examples/vector_of_vectors_example.cpp
+707 −423 include/nanoflann.hpp
+252 −20 tests/test_main.cpp
2 changes: 1 addition & 1 deletion 3rdparty/nanogui
Submodule nanogui updated 1 files
+4 −4 src/tabheader.cpp
43 changes: 40 additions & 3 deletions apps/RawLogViewer/CScanAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,6 @@ bool CScanAnimation::update_opengl_viz(const CSensoryFrame& sf)

CSetOfObjects::Ptr gl_objs;

CColouredPointsMap pointMap;
pointMap.loadFromVelodyneScan(*obs);

// Already in the map with the same sensor label?
auto it_gl = m_gl_objects.find(sNameInMap);
if (it_gl != m_gl_objects.end())
Expand Down Expand Up @@ -496,6 +493,46 @@ bool CScanAnimation::update_opengl_viz(const CSensoryFrame& sf)
obs->point_cloud.clear_deep();
obs->unload();
}
else if (IS_CLASS(*it, CObservationRotatingScan))
{
CObservationRotatingScan::Ptr obs =
std::dynamic_pointer_cast<CObservationRotatingScan>(it);
obs->load();

hasToRefreshViz = true;
if (tim_last == INVALID_TIMESTAMP || tim_last < obs->timestamp)
tim_last = obs->timestamp;

CSetOfObjects::Ptr gl_objs;

// Already in the map with the same sensor label?
auto it_gl = m_gl_objects.find(sNameInMap);
if (it_gl != m_gl_objects.end())
{
// Update existing object:
TRenderObject& ro = it_gl->second;
gl_objs = std::dynamic_pointer_cast<CSetOfObjects>(ro.obj);
ro.timestamp = obs->timestamp;
}
else
{
// Create object:
gl_objs = CSetOfObjects::Create();

TRenderObject ro;
ro.obj = gl_objs;
ro.timestamp = obs->timestamp;
m_gl_objects[sNameInMap] = ro;
m_plot3D->getOpenGLSceneRef()->insert(gl_objs);
}

auto& p = theMainWindow->getViewOptions()->m_params;

// convert to viz object:
obsRotatingScan_to_viz(obs, p, *gl_objs);

obs->unload();
}
else if (IS_CLASS(*it, CObservationPointCloud))
{
auto obs = std::dynamic_pointer_cast<CObservationPointCloud>(it);
Expand Down
129 changes: 103 additions & 26 deletions apps/RawLogViewer/main_show_selected_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,21 @@ using namespace mrpt::poses;
using namespace mrpt::rtti;
using namespace std;

static void showImageInGLView(CMyGLCanvas& canvas, const mrpt::img::CImage& im)
namespace
{
void showImageInGLView(
mrpt::opengl::Viewport& view, const mrpt::img::CImage& im)
{
view.setImageView(im, true);
}

void showImageInGLView(CMyGLCanvas& canvas, const mrpt::img::CImage& im)
{
auto scene = canvas.getOpenGLSceneRef();
scene->getViewport()->setImageView(im);
showImageInGLView(*scene->getViewport(), im);
canvas.Refresh();
}
}

// Update selected item display:
void xRawLogViewerFrame::SelectObjectInTreeView(
Expand Down Expand Up @@ -157,6 +166,10 @@ void xRawLogViewerFrame::SelectObjectInTreeView(
Notebook1->ChangeSelection(8);
auto obs = std::dynamic_pointer_cast<CObservation2DRangeScan>(sel_obj);

// Hide unused viewports:
bmp3Dobs_depth->setViewportVisibility(false);
bmp3Dobs_int->setViewportVisibility(false);

// Additional text description: This is not within
// getDescriptionAsTextValue() because mrpt-maps is not available within
// mrpt-obs:
Expand Down Expand Up @@ -184,8 +197,8 @@ void xRawLogViewerFrame::SelectObjectInTreeView(
// Update 3D view ==========
#if RAWLOGVIEWER_HAS_3D
auto openGLSceneRef = m_gl3DRangeScan->getOpenGLSceneRef();
openGLSceneRef->clear();
openGLSceneRef->insert(glPts);
openGLSceneRef->getViewport()->clear();
openGLSceneRef->getViewport()->insert(glPts);

m_gl3DRangeScan->Refresh();
#endif
Expand Down Expand Up @@ -339,6 +352,10 @@ void xRawLogViewerFrame::SelectObjectInTreeView(
obs->load(); // Make sure the 3D point cloud, etc... are all
// loaded in memory.

// Hide unused viewports:
bmp3Dobs_depth->setViewportVisibility(false);
bmp3Dobs_int->setViewportVisibility(false);

// Render options
// --------------------------------
const auto& p = pnViewOptions->m_params;
Expand All @@ -347,15 +364,6 @@ void xRawLogViewerFrame::SelectObjectInTreeView(

obs3Dscan_to_viz(obs, p, *glPts);

// Update 3D view ==========
#if RAWLOGVIEWER_HAS_3D
auto openGLSceneRef = m_gl3DRangeScan->getOpenGLSceneRef();
openGLSceneRef->clear();
openGLSceneRef->insert(glPts);

m_gl3DRangeScan->Refresh();
#endif

// Update intensity image ======
{
CImage im;
Expand Down Expand Up @@ -387,6 +395,15 @@ void xRawLogViewerFrame::SelectObjectInTreeView(

obs->confidenceImage.unload(); // For externally-stored datasets
}

// Update 3D view ==========
#if RAWLOGVIEWER_HAS_3D
auto openGLSceneRef = m_gl3DRangeScan->getOpenGLSceneRef();
openGLSceneRef->getViewport()->clear();
openGLSceneRef->getViewport()->insert(glPts);

m_gl3DRangeScan->Refresh();
#endif
obs->unload();
}

Expand All @@ -398,6 +415,10 @@ void xRawLogViewerFrame::SelectObjectInTreeView(
Notebook1->ChangeSelection(8);
auto obs = std::dynamic_pointer_cast<CObservationVelodyneScan>(sel_obj);

// Hide unused viewports:
bmp3Dobs_depth->setViewportVisibility(false);
bmp3Dobs_int->setViewportVisibility(false);

obs->generatePointCloud();
const auto& p = pnViewOptions->m_params;

Expand All @@ -407,8 +428,8 @@ void xRawLogViewerFrame::SelectObjectInTreeView(
// Update 3D view ==========
#if RAWLOGVIEWER_HAS_3D
auto openGLSceneRef = m_gl3DRangeScan->getOpenGLSceneRef();
openGLSceneRef->clear();
openGLSceneRef->insert(glPts);
openGLSceneRef->getViewport()->clear();
openGLSceneRef->getViewport()->insert(glPts);

this->m_gl3DRangeScan->Refresh();

Expand All @@ -425,6 +446,10 @@ void xRawLogViewerFrame::SelectObjectInTreeView(
Notebook1->ChangeSelection(8);
auto obs = std::dynamic_pointer_cast<CObservationPointCloud>(sel_obj);

// Hide unused viewports:
bmp3Dobs_depth->setViewportVisibility(false);
bmp3Dobs_int->setViewportVisibility(false);

const auto& p = pnViewOptions->m_params;

auto glPts = mrpt::opengl::CSetOfObjects::Create();
Expand All @@ -433,8 +458,8 @@ void xRawLogViewerFrame::SelectObjectInTreeView(
// Update 3D view ==========
#if RAWLOGVIEWER_HAS_3D
auto openGLSceneRef = m_gl3DRangeScan->getOpenGLSceneRef();
openGLSceneRef->clear();
openGLSceneRef->insert(glPts);
openGLSceneRef->getViewport()->clear();
openGLSceneRef->getViewport()->insert(glPts);

this->m_gl3DRangeScan->Refresh();
#endif
Expand All @@ -450,12 +475,16 @@ void xRawLogViewerFrame::SelectObjectInTreeView(
// ----------------------------------------------------------------------
Notebook1->ChangeSelection(8);

// Hide unused viewports:
bmp3Dobs_depth->setViewportVisibility(false);
bmp3Dobs_int->setViewportVisibility(false);

// Update 3D view ==========
#if RAWLOGVIEWER_HAS_3D
auto openGLSceneRef = m_gl3DRangeScan->getOpenGLSceneRef();

openGLSceneRef->clear();
openGLSceneRef->insert(viz->getVisualization());
openGLSceneRef->getViewport()->clear();
openGLSceneRef->getViewport()->insert(viz->getVisualization());

this->m_gl3DRangeScan->Refresh();
#endif
Expand All @@ -466,20 +495,68 @@ void xRawLogViewerFrame::SelectObjectInTreeView(
// ----------------------------------------------------------------------
// CObservationRotatingScan
// ----------------------------------------------------------------------
Notebook1->ChangeSelection(3);
Notebook1->ChangeSelection(8);
auto obs = std::dynamic_pointer_cast<CObservationRotatingScan>(sel_obj);

// Show viewports:
bmp3Dobs_depth->setViewportVisibility(true);
bmp3Dobs_int->setViewportVisibility(true);

// Get range image as bitmap:
// ---------------------------
mrpt::img::CImage img_range;
img_range.setFromMatrix(obs->rangeImage, false);
int rangeHeight = 40;
{
mrpt::img::CImage img_range;

float maxActualRange = obs->rangeImage.maxCoeff();
if (maxActualRange == 0) maxActualRange = 1.0f;

img_range.setFromMatrix(
obs->rangeImage.asEigen().cast<float>() *
(1.0f / maxActualRange),
true /*already in [0,1]*/, true /*flip_vertical*/);

showImageInGLView(*bmp3Dobs_depth, img_range);

rangeHeight = img_range.getHeight();
bmp3Dobs_depth->setViewportPosition(
50, -2 - rangeHeight, -30, rangeHeight);
}

showImageInGLView(*bmpObsStereoLeft, img_range);
int intensityHeight = 40;

mrpt::img::CImage img_intensity;
img_intensity.setFromMatrix(obs->intensityImage, false);
if (!obs->intensityImage.empty())
{
mrpt::img::CImage img_intensity;

float maxActualInt = obs->intensityImage.maxCoeff();
if (maxActualInt == 0) maxActualInt = 1.0f;

img_intensity.setFromMatrix(
obs->intensityImage.asEigen().cast<float>() *
(1.0f / maxActualInt),
true /*already in [0,1]*/, true /*flip_vertical*/);

showImageInGLView(*bmp3Dobs_int, img_intensity);

intensityHeight = img_intensity.getHeight();
bmp3Dobs_int->setViewportPosition(
50, -2 - rangeHeight - 2 - intensityHeight, -30,
intensityHeight);
}

bmp3Dobs_3dcloud->addTextMessage(2, -2 - rangeHeight / 2, "Range", 0);
bmp3Dobs_3dcloud->addTextMessage(
2, -2 - rangeHeight - 2 - intensityHeight / 2, "Intensity", 1);

// 3D points:
const auto& p = pnViewOptions->m_params;

auto glPts = mrpt::opengl::CSetOfObjects::Create();
obsRotatingScan_to_viz(obs, p, *glPts);

showImageInGLView(*bmpObsStereoRight, img_intensity);
bmp3Dobs_3dcloud->clear();
bmp3Dobs_3dcloud->insert(glPts);
}

if (classID->derivedFrom(CLASS_ID(CObservation)))
Expand Down
55 changes: 27 additions & 28 deletions apps/RawLogViewer/xRawLogViewerMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ xRawLogViewerFrame::xRawLogViewerFrame(wxWindow* parent, wxWindowID id)
wxMenuItem* MenuItem26;
wxMenuItem* MenuItem25;
wxMenuItem* MenuItem2;
wxFlexGridSizer* FlexGridSizer10;
wxFlexGridSizer* FlexGridSizer3;
wxMenuItem* MenuItem55;
wxMenuItem* MenuItem1;
Expand Down Expand Up @@ -394,7 +393,6 @@ xRawLogViewerFrame::xRawLogViewerFrame(wxWindow* parent, wxWindowID id)
wxMenuBar* MenuBar1;
wxFlexGridSizer* FlexGridSizer6;
wxFlexGridSizer* fgzMain;
wxFlexGridSizer* FlexGridSizer11;
wxMenuItem* MenuItem43;
wxMenu* Menu2;
wxMenuItem* MenuItem18;
Expand Down Expand Up @@ -809,51 +807,54 @@ xRawLogViewerFrame::xRawLogViewerFrame(wxWindow* parent, wxWindowID id)
pn_CObservationBearingRange->SetSizer(BoxSizer4);
BoxSizer4->Fit(pn_CObservationBearingRange);
BoxSizer4->SetSizeHints(pn_CObservationBearingRange);

// Panel[8]: pn_CObservation3DRangeScan
pn_CObservation3DRangeScan = new wxPanel(
Notebook1, ID_PANEL19, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL, _T("ID_PANEL19"));
FlexGridSizer8 = new wxFlexGridSizer(1, 1, 0, 0);
FlexGridSizer8->AddGrowableCol(0);
FlexGridSizer8->AddGrowableRow(0);

// Tabs for 3D observations channels & options:
nb_3DObsChannels = new wxNotebook(
pn_CObservation3DRangeScan, ID_NOTEBOOK_3DOBS, wxDefaultPosition,
wxDefaultSize, 0, _T("ID_NOTEBOOK_3DOBS"));

// Tab: 3D view + range + intensity:
pn3Dobs_3D = new wxPanel(
nb_3DObsChannels, ID_PANEL20, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL, _T("ID_PANEL20"));
FlexGridSizer9 = new wxFlexGridSizer(1, 1, 0, 0);
FlexGridSizer9->AddGrowableCol(0);
FlexGridSizer9->AddGrowableRow(0);

m_gl3DRangeScan = new CMyGLCanvas(
pn3Dobs_3D, ID_XY_GLCANVAS, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL, _T("ID_XY_GLCANVAS"));
FlexGridSizer9->Add(m_gl3DRangeScan, 1, wxEXPAND, 0);
FlexGridSizer9->Add(m_gl3DRangeScan, 1, wxEXPAND, 2);

// OpenGL Views:
bmp3Dobs_depth =
m_gl3DRangeScan->getOpenGLSceneRef()->createViewport("depth");
bmp3Dobs_depth->setCustomBackgroundColor({.0f, .0f, .0f});

bmp3Dobs_int =
m_gl3DRangeScan->getOpenGLSceneRef()->createViewport("intensity");
bmp3Dobs_int->setCustomBackgroundColor({.0f, .0f, .0f});

bmp3Dobs_3dcloud =
m_gl3DRangeScan->getOpenGLSceneRef()->getViewport("main");

// The correct sizes will be updated anyway in SelectObjectInTreeView()
bmp3Dobs_depth->setViewportPosition(2, -50 - 2, 1.0, 50);
bmp3Dobs_int->setViewportPosition(2, -100 - 2 * 2, 1.0, 50);

// panel done:
pn3Dobs_3D->SetSizer(FlexGridSizer9);
FlexGridSizer9->Fit(pn3Dobs_3D);
FlexGridSizer9->SetSizeHints(pn3Dobs_3D);
pn3Dobs_Depth = new wxPanel(
nb_3DObsChannels, ID_PANEL21, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL, _T("ID_PANEL21"));
FlexGridSizer10 = new wxFlexGridSizer(1, 1, 0, 0);
FlexGridSizer10->AddGrowableCol(0);
FlexGridSizer10->AddGrowableRow(0);
bmp3Dobs_depth = new CMyGLCanvas(pn3Dobs_Depth, ID_STATICBITMAP4);
FlexGridSizer10->Add(bmp3Dobs_depth, 1, wxEXPAND, 0);
pn3Dobs_Depth->SetSizer(FlexGridSizer10);
FlexGridSizer10->Fit(pn3Dobs_Depth);
FlexGridSizer10->SetSizeHints(pn3Dobs_Depth);
pn3Dobs_Int = new wxPanel(
nb_3DObsChannels, ID_PANEL22, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL, _T("ID_PANEL22"));
FlexGridSizer11 = new wxFlexGridSizer(1, 1, 0, 0);
FlexGridSizer11->AddGrowableCol(0);
FlexGridSizer11->AddGrowableRow(0);
bmp3Dobs_int = new CMyGLCanvas(pn3Dobs_Int, ID_STATICBITMAP5);
FlexGridSizer11->Add(bmp3Dobs_int, 1, wxEXPAND, 0);
pn3Dobs_Int->SetSizer(FlexGridSizer11);
FlexGridSizer11->Fit(pn3Dobs_Int);
FlexGridSizer11->SetSizeHints(pn3Dobs_Int);

pn3Dobs_Conf = new wxPanel(
nb_3DObsChannels, ID_PANEL23, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL, _T("ID_PANEL23"));
Expand All @@ -869,9 +870,7 @@ xRawLogViewerFrame::xRawLogViewerFrame(wxWindow* parent, wxWindowID id)
pnViewOptions = new ViewOptions3DPoints(
nb_3DObsChannels, ID_PANEL_VIEW_3D_POINT_OPTIONS);

nb_3DObsChannels->AddPage(pn3Dobs_3D, _("3D view"), false);
nb_3DObsChannels->AddPage(pn3Dobs_Depth, _("Depth"), false);
nb_3DObsChannels->AddPage(pn3Dobs_Int, _("Intensity"), false);
nb_3DObsChannels->AddPage(pn3Dobs_3D, _("3D/Range/Intensity"), true);
nb_3DObsChannels->AddPage(pn3Dobs_Conf, _("Confidence"), false);
nb_3DObsChannels->AddPage(pnViewOptions, _("Visualization options"), false);

Expand Down
Loading

0 comments on commit aa7b1df

Please sign in to comment.