From 489362bdbf87fbd49d18700ea43c9fd2faa55102 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Mon, 23 Oct 2023 16:16:52 +0200 Subject: [PATCH 1/6] patch version bump --- appveyor.yml | 2 +- doc/source/doxygen-docs/changelog.md | 3 +++ package.xml | 2 +- version_prefix.txt | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index cf906242a5..4099c44fc0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ # version format -version: 2.11.1-{branch}-build{build} +version: 2.11.2-{branch}-build{build} os: Visual Studio 2019 diff --git a/doc/source/doxygen-docs/changelog.md b/doc/source/doxygen-docs/changelog.md index f920aeeb52..51b0dbc56d 100644 --- a/doc/source/doxygen-docs/changelog.md +++ b/doc/source/doxygen-docs/changelog.md @@ -1,5 +1,8 @@ \page changelog Change Log +# Version 2.11.2: UNRELEASED +(none yet) + # Version 2.11.1: Released Oct 23rd, 2023 - Changes in libraries: - \ref mrpt_math_grp diff --git a/package.xml b/package.xml index beea563a7d..efb834030d 100644 --- a/package.xml +++ b/package.xml @@ -7,7 +7,7 @@ mrpt2 - 2.11.1 + 2.11.2 Mobile Robot Programming Toolkit (MRPT) version 2.x Jose-Luis Blanco-Claraco diff --git a/version_prefix.txt b/version_prefix.txt index 84519a1082..348a6a3c77 100644 --- a/version_prefix.txt +++ b/version_prefix.txt @@ -1,4 +1,4 @@ -2.11.1 +2.11.2 # IMPORTANT: This file is parsed by CMake, don't add any comment to # the first line. # This file is used in both Windows and Linux scripts to automatically From 1fc8637c621d1f3fd407048325c27d5a17fd63c1 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Mon, 23 Oct 2023 21:56:06 +0200 Subject: [PATCH 2/6] Fix wx UI scaling problems (Closes #1114) --- apps/RawLogViewer/main_timeline.cpp | 8 +- apps/camera-calib/CDlgCalibWizardOnline.cpp | 3 +- apps/camera-calib/CDlgPoseEst.cpp | 3 +- doc/source/doxygen-docs/changelog.md | 6 +- libs/gui/include/mrpt/gui/WxUtils.h | 6 +- libs/gui/src/CWxGLCanvasBase.cpp | 11 +- libs/gui/src/WxUtils.cpp | 9 + libs/gui/src/mathplots/mathplot.cpp | 229 ++------------------ libs/opengl/src/Viewport.cpp | 4 +- 9 files changed, 47 insertions(+), 232 deletions(-) diff --git a/apps/RawLogViewer/main_timeline.cpp b/apps/RawLogViewer/main_timeline.cpp index c592077d55..c20e121a7a 100644 --- a/apps/RawLogViewer/main_timeline.cpp +++ b/apps/RawLogViewer/main_timeline.cpp @@ -143,7 +143,7 @@ void xRawLogViewerFrame::rebuildBottomTimeLine() auto& tl = m_timeline; tl.clearStats(); - const auto clsz = m_glTimeLine->GetClientSize(); + const auto clsz = mrpt::gui::GetScaledClientSize(m_glTimeLine); auto px2x = [clsz](int u) { return -1.0 + (2.0 / clsz.GetWidth()) * u; }; auto px2y = [clsz](int v) { return +1.0 - (2.0 / clsz.GetHeight()) * v; }; @@ -365,7 +365,7 @@ void xRawLogViewerFrame::bottomTimeLineUpdateCursorFromTreeScrollPos() return; } - const auto clsz = m_glTimeLine->GetClientSize(); + const auto clsz = mrpt::gui::GetScaledClientSize(m_glTimeLine); auto px2x = [clsz](int u) { return -1.0 + (2.0 / clsz.GetWidth()) * u; }; auto px2y = [clsz](int v) { return +1.0 - (2.0 / clsz.GetHeight()) * v; }; @@ -557,7 +557,7 @@ void xRawLogViewerFrame::OnTimeLineMouseWheel(wxMouseEvent& e) mrpt::keep_max(xFocus, -1.0); mrpt::keep_min(xFocus, 1.0); - const auto clsz = m_glTimeLine->GetClientSize(); + const auto clsz = mrpt::gui::GetScaledClientSize(m_glTimeLine); auto px2x = [clsz](int u) { return -1.0 + (2.0 / clsz.GetWidth()) * u; @@ -613,7 +613,7 @@ std::optional> const std::optional& forceThisSensorLabel, const mrpt::optional_ref& outSelectedSensorLabel) const { - const auto clsz = m_glTimeLine->GetClientSize(); + const auto clsz = mrpt::gui::GetScaledClientSize(m_glTimeLine); auto& tl = m_timeline; diff --git a/apps/camera-calib/CDlgCalibWizardOnline.cpp b/apps/camera-calib/CDlgCalibWizardOnline.cpp index 751f51cf2d..bdf5700d66 100644 --- a/apps/camera-calib/CDlgCalibWizardOnline.cpp +++ b/apps/camera-calib/CDlgCalibWizardOnline.cpp @@ -439,7 +439,8 @@ void CDlgCalibWizardOnline::OntimCaptureTrigger(wxTimerEvent& event) // Resize the display area, if needed: if (std::abs( - (int)(this->m_realtimeview->GetClientSize().GetWidth()) - + (int)(mrpt::gui::GetScaledClientSize(m_realtimeview) + .GetWidth()) - int(img_to_show.getWidth())) > 30) { this->m_realtimeview->SetSize( diff --git a/apps/camera-calib/CDlgPoseEst.cpp b/apps/camera-calib/CDlgPoseEst.cpp index 9e75f2aafd..87afd58005 100644 --- a/apps/camera-calib/CDlgPoseEst.cpp +++ b/apps/camera-calib/CDlgPoseEst.cpp @@ -479,7 +479,8 @@ void CDlgPoseEst::OntimCaptureTrigger(wxTimerEvent& event) // Resize the display area, if needed: if (std::abs( - (int)(this->m_realtimeview->GetClientSize().GetWidth()) - + (int)(mrpt::gui::GetScaledClientSize(m_realtimeview) + .GetWidth()) - int(img_to_show.getWidth())) > 30) { this->m_realtimeview->SetSize( diff --git a/doc/source/doxygen-docs/changelog.md b/doc/source/doxygen-docs/changelog.md index 51b0dbc56d..e5e26efda8 100644 --- a/doc/source/doxygen-docs/changelog.md +++ b/doc/source/doxygen-docs/changelog.md @@ -1,7 +1,11 @@ \page changelog Change Log # Version 2.11.2: UNRELEASED -(none yet) +- Changes in libraries: + - \ref mrpt_gui_grp + - New function mrpt::gui::GetScaledClientSize(). +- BUG FIXES: + - Fix wrong rendering of all wxWidgets-based OpenGL windows when using Ubuntu's display settings to change UI to a size different than 100% (Fixes [issue #1114](https://github.com/MRPT/mrpt/issues/1114)). # Version 2.11.1: Released Oct 23rd, 2023 - Changes in libraries: diff --git a/libs/gui/include/mrpt/gui/WxUtils.h b/libs/gui/include/mrpt/gui/WxUtils.h index 260dd882fc..642c57b748 100644 --- a/libs/gui/include/mrpt/gui/WxUtils.h +++ b/libs/gui/include/mrpt/gui/WxUtils.h @@ -64,10 +64,14 @@ namespace gui /** \addtogroup mrpt_gui_wxutils Utilities for MRPT-wxWidgets interfacing (in #include ) * \ingroup mrpt_gui_grp - * @{ */ #if MRPT_HAS_WXWIDGETS +/** Returns the size of a window, including the optional magnification scale set + * by users in Display->Appearance. + */ +wxSize GetScaledClientSize(const wxWindow* w); + #ifndef WX_START_TRY #define WX_START_TRY \ diff --git a/libs/gui/src/CWxGLCanvasBase.cpp b/libs/gui/src/CWxGLCanvasBase.cpp index c5b648a80c..d9e0a84cd8 100644 --- a/libs/gui/src/CWxGLCanvasBase.cpp +++ b/libs/gui/src/CWxGLCanvasBase.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #if MRPT_HAS_WXWIDGETS && MRPT_HAS_OPENGL_GLUT @@ -223,9 +224,8 @@ void CWxGLCanvasBase::Render() lck.unlock(); - int width, height; - GetClientSize(&width, &height); - double At = renderCanvas(width, height); + const auto sz = mrpt::gui::GetScaledClientSize(this); + double At = renderCanvas(sz.GetWidth(), sz.GetHeight()); OnPostRenderSwapBuffers(At, dc); } @@ -241,8 +241,7 @@ void CWxGLCanvasBase::OnSize(wxSizeEvent& event) if (!m_parent->IsShown()) return; // set GL viewport (not called by wxGLCanvas::OnSize on all platforms...) - int w, h; - GetClientSize(&w, &h); + const auto sz = mrpt::gui::GetScaledClientSize(this); if (this->IsShownOnScreen()) { @@ -256,7 +255,7 @@ void CWxGLCanvasBase::OnSize(wxSizeEvent& event) SetCurrent(*m_gl_context); } - resizeViewport(w, h); + resizeViewport(sz.GetWidth(), sz.GetHeight()); } } diff --git a/libs/gui/src/WxUtils.cpp b/libs/gui/src/WxUtils.cpp index fa9e664f39..f65e909e06 100644 --- a/libs/gui/src/WxUtils.cpp +++ b/libs/gui/src/WxUtils.cpp @@ -9,6 +9,7 @@ #include "gui-precomp.h" // Precompiled headers // +#include #include #include #include @@ -933,4 +934,12 @@ mrptKeyModifier mrpt::gui::keyEventToMrptKeyModifier(const wxKeyEvent& ev) return mrptKeyModifier(mod); } +wxSize mrpt::gui::GetScaledClientSize(const wxWindow* w) +{ + int width, height; + w->GetClientSize(&width, &height); + const double s = w->GetContentScaleFactor(); + return wxSize(mrpt::round(s * width), mrpt::round(s * height)); +} + #endif // MRPT_HAS_WXWIDGETS diff --git a/libs/gui/src/mathplots/mathplot.cpp b/libs/gui/src/mathplots/mathplot.cpp index f2bb686835..d4c7bbe1f6 100644 --- a/libs/gui/src/mathplots/mathplot.cpp +++ b/libs/gui/src/mathplots/mathplot.cpp @@ -90,6 +90,14 @@ double mpWindow::zoomIncrementalFactor = 1.5; IMPLEMENT_ABSTRACT_CLASS(mpLayer, wxObject) +static void MyGetScaledClientSize(const wxWindow* w, int& width, int& height) +{ + w->GetClientSize(&width, &height); + const double s = w->GetContentScaleFactor(); + width = static_cast(s * width); + height = static_cast(s * height); +} + mpLayer::mpLayer() { SetPen((wxPen&)*wxBLACK_PEN); @@ -1501,8 +1509,6 @@ void mpWindow::OnMouseWheel(wxMouseEvent& event) return; } - // GetClientSize( &m_scrX,&m_scrY); - if (event.m_controlDown) { wxPoint clickPt(event.GetX(), event.GetY()); @@ -1695,7 +1701,7 @@ void mpWindow::Fit( else { // Normal case (screen): - GetClientSize(&m_scrX, &m_scrY); + MyGetScaledClientSize(this, m_scrX, m_scrY); } double Ax, Ay; @@ -1839,7 +1845,7 @@ void mpWindow::ZoomIn(const wxPoint& centerPoint) wxPoint c(centerPoint); if (c == wxDefaultPosition) { - GetClientSize(&m_scrX, &m_scrY); + MyGetScaledClientSize(this, m_scrX, m_scrY); c.x = (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft; // c.x = m_scrX/2; c.y = (m_scrY - m_marginTop - m_marginBottom) / 2 - @@ -1882,7 +1888,7 @@ void mpWindow::ZoomOut(const wxPoint& centerPoint) wxPoint c(centerPoint); if (c == wxDefaultPosition) { - GetClientSize(&m_scrX, &m_scrY); + MyGetScaledClientSize(this, m_scrX, m_scrY); c.x = (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft; // c.x = m_scrX/2; c.y = (m_scrY - m_marginTop - m_marginBottom) / 2 - @@ -2022,7 +2028,7 @@ void mpWindow::OnPrintMenu(wxCommandEvent& WXUNUSED(event)) void mpWindow::OnFit(wxCommandEvent& WXUNUSED(event)) { Fit(); } void mpWindow::OnCenter(wxCommandEvent& WXUNUSED(event)) { - GetClientSize(&m_scrX, &m_scrY); + MyGetScaledClientSize(this, m_scrX, m_scrY); int centerX = (m_scrX - m_marginLeft - m_marginRight) / 2; // + m_marginLeft; // c.x = m_scrX/2; int centerY = (m_scrY - m_marginTop - m_marginBottom) / @@ -2131,68 +2137,6 @@ void mpWindow::OnPaint(wxPaintEvent&) if (m_enableScrollBars) {} } -// void mpWindow::OnScroll2(wxScrollWinEvent &event) -// { -// #ifdef MATHPLOT_DO_LOGGING -// wxLogMessage(_("[mpWindow::OnScroll2] Init: m_posX=%f m_posY=%f, sc_pos = -// %d"),m_posX,m_posY, event.GetPosition()); -// #endif -// // If scrollbars are not enabled, Skip operation -// if (!m_enableScrollBars) { -// event.Skip(); -// return; -// } -// // m_scrollX = (int) floor((m_posX - m_minX)*m_scaleX); -// // m_scrollY = (int) floor((m_maxY - m_posY /*- m_minY*/)*m_scaleY); -// // Scroll(m_scrollX, m_scrollY); -// -// // GetClientSize( &m_scrX, &m_scrY); -// //Scroll(x2p(m_desiredXmin), y2p(m_desiredYmin)); -// int pixelStep = 1; -// if (event.GetOrientation() == wxHORIZONTAL) { -// //m_desiredXmin -= (m_scrollX - event.GetPosition())/m_scaleX; -// //m_desiredXmax -= (m_scrollX - event.GetPosition())/m_scaleX; -// m_posX -= (m_scrollX - event.GetPosition())/m_scaleX; -// m_scrollX = event.GetPosition(); -// } -// Fit(m_desiredXmin, m_desiredXmax, m_desiredYmin, m_desiredYmax); -// // /* int pixelStep = 1; -// // if (event.GetOrientation() == wxHORIZONTAL) { -// // m_posX -= (px - -// event.GetPosition())/m_scaleX;//(pixelStep/m_scaleX); -// // m_desiredXmax -= (px - -// event.GetPosition())/m_scaleX;//(pixelStep/m_scaleX); -// // m_desiredXmin -= (px - -// event.GetPosition())/m_scaleX;//(pixelStep/m_scaleX); -// // //SetPosX( (double)px / GetScaleX() + m_minX + -// (double)(width>>1)/GetScaleX()); -// // // m_posX = p2x(px); //m_minX + (double)(px /*+ -// (m_scrX)*/)/GetScaleX(); -// // } else { -// // m_posY += (py - -// event.GetPosition())/m_scaleY;//(pixelStep/m_scaleY); -// // m_desiredYmax += (py - -// event.GetPosition())/m_scaleY;//(pixelStep/m_scaleY); -// // m_desiredYmax += (py - -// event.GetPosition())/m_scaleY;//(pixelStep/m_scaleY); -// // //SetPosY( m_maxY - (double)py / GetScaleY() - -// (double)(height>>1)/GetScaleY()); -// // //m_posY = m_maxY - (double)py / GetScaleY() - -// (double)(height>>1)/GetScaleY(); -// // // m_posY = p2y(py);//m_maxY - (double)(py /*+ -// (m_scrY)*/)/GetScaleY(); -// // }*/ -// #ifdef MATHPLOT_DO_LOGGING -// int px, py; -// GetViewStart( &px, &py); -// wxLogMessage(_("[mpWindow::OnScroll2] End: m_posX = %f, m_posY = %f, px -// = %f, py = %f"),m_posX, m_posY, px, py); -// #endif -// -// UpdateAll(); -// // event.Skip(); -// } - void mpWindow::SetMPScrollbars(bool status) { // Temporary behaviour: always disable scrollbars @@ -2204,36 +2148,6 @@ void mpWindow::SetMPScrollbars(bool status) } // else the scroll bars will be updated in UpdateAll(); UpdateAll(); - - // EnableScrolling(false, false); - // m_enableScrollBars = status; - // EnableScrolling(status, status); - /* m_scrollX = (int) floor((m_posX - m_minX)*m_scaleX); - m_scrollY = (int) floor((m_posY - m_minY)*m_scaleY);*/ - // int scrollWidth = (int) floor((m_maxX - m_minX)*m_scaleX) - m_scrX; - // int scrollHeight = (int) floor((m_minY - m_maxY)*m_scaleY) - m_scrY; - - // /* m_scrollX = (int) floor((m_posX - m_minX)*m_scaleX); - // m_scrollY = (int) floor((m_maxY - m_posY /*- m_minY*/)*m_scaleY); - // int scrollWidth = (int) floor(((m_maxX - m_minX) - (m_desiredXmax - - // m_desiredXmin))*m_scaleX); - // int scrollHeight = (int) floor(((m_maxY - m_minY) - (m_desiredYmax - - // m_desiredYmin))*m_scaleY); - // #ifdef MATHPLOT_DO_LOGGING - // wxLogMessage(_("mpWindow::SetMPScrollbars() scrollWidth = %d, - // scrollHeight = %d"), scrollWidth, scrollHeight); - // #endif - // if(status) { - // SetScrollbars(1, - // 1, - // scrollWidth, - // scrollHeight, - // m_scrollX, - // m_scrollY); - // // SetVirtualSize((int) (m_maxX - m_minX), (int) (m_maxY - - // m_minY)); - // } - // Refresh(true);*/ } bool mpWindow::UpdateBBox() @@ -2271,63 +2185,6 @@ bool mpWindow::UpdateBBox() return first == FALSE; } -// void mpWindow::UpdateAll() -// { -// GetClientSize( &m_scrX,&m_scrY); -/* if (m_enableScrollBars) { - // The "virtual size" of the scrolled window: - const int sx = (int)((m_maxX - m_minX) * GetScaleX()); - const int sy = (int)((m_maxY - m_minY) * GetScaleY()); - SetVirtualSize(sx, sy); - SetScrollRate(1, 1);*/ -// const int px = (int)((GetPosX() - m_minX) * GetScaleX());// - -// m_scrX); //(cx>>1)); - -// J.L.Blanco, Aug 2007: Formula fixed: -// const int py = (int)((m_maxY - GetPosY()) * GetScaleY());// - -// m_scrY); //(cy>>1)); -// int px, py; -// GetViewStart(&px0, &py0); -// px = (int)((m_posX - m_minX)*m_scaleX); -// py = (int)((m_maxY - m_posY)*m_scaleY); - -// SetScrollbars( 1, 1, sx - m_scrX, sy - m_scrY, px, py, TRUE); -// } - -// Working code -// UpdateBBox(); -// Refresh( FALSE ); -// end working code - -// Old version -/* bool box = UpdateBBox(); - if (box) -{ - int cx, cy; - GetClientSize( &cx, &cy); - - // The "virtual size" of the scrolled window: - const int sx = (int)((m_maxX - m_minX) * GetScaleX()); - const int sy = (int)((m_maxY - m_minY) * GetScaleY()); - - const int px = (int)((GetPosX() - m_minX) * GetScaleX() - (cx>>1)); - - // J.L.Blanco, Aug 2007: Formula fixed: - const int py = (int)((m_maxY - GetPosY()) * GetScaleY() - (cy>>1)); - - SetScrollbars( 1, 1, sx, sy, px, py, TRUE); - -#ifdef MATHPLOT_DO_LOGGING - wxLogMessage(_("[mpWindow::UpdateAll] Size:%ix%i -ScrollBars:%i,%i"),sx,sy,px,py); -#endif -} - - FitInside(); - Refresh( FALSE ); -*/ -// } - void mpWindow::UpdateAll() { if (UpdateBBox()) @@ -2335,7 +2192,7 @@ void mpWindow::UpdateAll() if (m_enableScrollBars) { int cx, cy; - GetClientSize(&cx, &cy); + MyGetScaledClientSize(this, cx, cy); // Do x scroll bar { // Convert margin sizes from pixels to coordinates @@ -2660,66 +2517,6 @@ void mpWindow::SetColourTheme( } } -// void mpWindow::EnableCoordTooltip(bool value) -// { -// m_coordTooltip = value; -// // if (value) GetToolTip()->SetDelay(100); -// } - -/* -double mpWindow::p2x(wxCoord pixelCoordX, bool drawOutside ) -{ - if (drawOutside) { - return m_posX + pixelCoordX/m_scaleX; - } - // Draw inside margins - double marginScaleX = ((double)(m_scrX - m_marginLeft - -m_marginRight))/m_scrX; - return m_marginLeft + (m_posX + pixelCoordX/m_scaleX)/marginScaleX; -} - -double mpWindow::p2y(wxCoord pixelCoordY, bool drawOutside ) -{ - if (drawOutside) { - return m_posY - pixelCoordY/m_scaleY; - } - // Draw inside margins - double marginScaleY = ((double)(m_scrY - m_marginTop - -m_marginBottom))/m_scrY; - return m_marginTop + (m_posY - pixelCoordY/m_scaleY)/marginScaleY; -} - -wxCoord mpWindow::x2p(double x, bool drawOutside) -{ - if (drawOutside) { - return (wxCoord) ((x-m_posX) * m_scaleX); - } - // Draw inside margins - double marginScaleX = ((double)(m_scrX - m_marginLeft - -m_marginRight))/m_scrX; -#ifdef MATHPLOT_DO_LOGGING - wxLogMessage(wxT("x2p ScrX = %d, marginRight = %d, marginLeft = %d, -marginScaleX = %f"), m_scrX, m_marginRight, m_marginLeft, marginScaleX); -#endif // MATHPLOT_DO_LOGGING - return (wxCoord) (int)(((x-m_posX) * m_scaleX)*marginScaleX) - m_marginLeft; -} - -wxCoord mpWindow::y2p(double y, bool drawOutside) -{ - if (drawOutside) { - return (wxCoord) ( (m_posY-y) * m_scaleY); - } - // Draw inside margins - double marginScaleY = ((double)(m_scrY - m_marginTop - -m_marginBottom))/m_scrY; -#ifdef MATHPLOT_DO_LOGGING - wxLogMessage(wxT("y2p ScrY = %d, marginTop = %d, marginBottom = %d, -marginScaleY = %f"), m_scrY, m_marginTop, m_marginBottom, marginScaleY); -#endif // MATHPLOT_DO_LOGGING - return (wxCoord) ((int)((m_posY-y) * m_scaleY)*marginScaleY) - m_marginTop; -} -*/ - //----------------------------------------------------------------------------- // mpFXYVector implementation - by Jose Luis Blanco (AGO-2007) //----------------------------------------------------------------------------- diff --git a/libs/opengl/src/Viewport.cpp b/libs/opengl/src/Viewport.cpp index 63a8172951..fcf171e0ea 100644 --- a/libs/opengl/src/Viewport.cpp +++ b/libs/opengl/src/Viewport.cpp @@ -70,8 +70,8 @@ void Viewport::setViewportPosition( const double x, const double y, const double width, const double height) { MRPT_START - ASSERT_(m_view_width > 0); - ASSERT_(m_view_height > 0); + ASSERT_(width > 0); + ASSERT_(height > 0); m_view_x = x; m_view_y = y; From 67358e90876f6af1b1021ec03d60740c68521157 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Mon, 23 Oct 2023 22:33:21 +0200 Subject: [PATCH 3/6] Address new field variance in ROS msg Range (Closes #1270) --- doc/source/doxygen-docs/changelog.md | 4 ++ libs/hwdrivers/src/CBoardSonars.cpp | 2 +- .../CPhidgetInterfaceKitProximitySensors.cpp | 2 +- .../src/maps/COccupancyGridMap2D_insert.cpp | 4 +- .../src/maps/COccupancyGridMap2D_simulate.cpp | 8 ++-- libs/maps/src/maps/CPointsMap.cpp | 6 +-- libs/obs/include/mrpt/obs/CObservationRange.h | 12 ++++-- libs/obs/src/CObservationRange.cpp | 28 ++++++++----- libs/ros1bridge/src/range.cpp | 7 ++-- libs/ros2bridge/src/range.cpp | 41 +++++++++++++++---- python/src/mrpt/obs/CObservationRange.cpp | 2 +- .../mrpt/pymrpt/mrpt/obs/__init__.pyi | 2 +- 12 files changed, 78 insertions(+), 40 deletions(-) diff --git a/doc/source/doxygen-docs/changelog.md b/doc/source/doxygen-docs/changelog.md index e5e26efda8..950f7a5417 100644 --- a/doc/source/doxygen-docs/changelog.md +++ b/doc/source/doxygen-docs/changelog.md @@ -4,6 +4,10 @@ - Changes in libraries: - \ref mrpt_gui_grp - New function mrpt::gui::GetScaledClientSize(). + - \ref mrpt_obs_grp + - Fix typo in data field: mrpt::obs::CObservationRange: `sensorConeApperture` -> `sensorConeAperture` + - \ref mrpt_ros2bridge_grp + - Address the new field `variance` in `sensor_msgs/Range` (Closes [issue #1270](https://github.com/MRPT/mrpt/issues/1270)). - BUG FIXES: - Fix wrong rendering of all wxWidgets-based OpenGL windows when using Ubuntu's display settings to change UI to a size different than 100% (Fixes [issue #1114](https://github.com/MRPT/mrpt/issues/1114)). diff --git a/libs/hwdrivers/src/CBoardSonars.cpp b/libs/hwdrivers/src/CBoardSonars.cpp index fa3b8e1bbf..9d60a16fd5 100644 --- a/libs/hwdrivers/src/CBoardSonars.cpp +++ b/libs/hwdrivers/src/CBoardSonars.cpp @@ -214,7 +214,7 @@ bool CBoardSonars::getObservation(mrpt::obs::CObservationRange& obs) obs.timestamp = mrpt::system::getCurrentTime(); obs.minSensorDistance = 0.04f; obs.maxSensorDistance = m_maxRange; - obs.sensorConeApperture = DEG2RAD(30.0f); + obs.sensorConeAperture = DEG2RAD(30.0f); obs.sensedData.clear(); mrpt::obs::CObservationRange::TMeasurement obsRange; diff --git a/libs/hwdrivers/src/CPhidgetInterfaceKitProximitySensors.cpp b/libs/hwdrivers/src/CPhidgetInterfaceKitProximitySensors.cpp index 2670e35526..f38a06af2e 100644 --- a/libs/hwdrivers/src/CPhidgetInterfaceKitProximitySensors.cpp +++ b/libs/hwdrivers/src/CPhidgetInterfaceKitProximitySensors.cpp @@ -268,7 +268,7 @@ void CPhidgetInterfaceKitProximitySensors::getObservation( obs.sensorLabel = m_sensorLabel; obs.minSensorDistance = m_minOfMinRanges; obs.maxSensorDistance = m_maxOfMaxRanges; - obs.sensorConeApperture = + obs.sensorConeAperture = DEG2RAD(2.0f); // TODO : Adapt to real sensor cone apperture. obs.sensedData.clear(); diff --git a/libs/maps/src/maps/COccupancyGridMap2D_insert.cpp b/libs/maps/src/maps/COccupancyGridMap2D_insert.cpp index 7eb230414b..b5128d8f30 100644 --- a/libs/maps/src/maps/COccupancyGridMap2D_insert.cpp +++ b/libs/maps/src/maps/COccupancyGridMap2D_insert.cpp @@ -937,7 +937,7 @@ bool COccupancyGridMap2D::internal_insertObservation( // Now go and insert the triangles of each beam: // ----------------------------------------------- - A = d2f(laserPose.phi()) - 0.5f * o.sensorConeApperture; + A = d2f(laserPose.phi()) - 0.5f * o.sensorConeAperture; dAK = 0; // Insert the rays: @@ -947,7 +947,7 @@ bool COccupancyGridMap2D::internal_insertObservation( last_valid_range = maxDistanceInsertion; - const float dA_2 = 0.5f * o.sensorConeApperture; + const float dA_2 = 0.5f * o.sensorConeAperture; for (idx = 0; idx < nRanges; idx += K, A += dAK) { float theR; // The range of this beam diff --git a/libs/maps/src/maps/COccupancyGridMap2D_simulate.cpp b/libs/maps/src/maps/COccupancyGridMap2D_simulate.cpp index 4892711233..c344af0c88 100644 --- a/libs/maps/src/maps/COccupancyGridMap2D_simulate.cpp +++ b/libs/maps/src/maps/COccupancyGridMap2D_simulate.cpp @@ -82,13 +82,13 @@ void COccupancyGridMap2D::sonarSimulator( // For each sonar cone, simulate several rays and keep the shortest // distance: - ASSERT_(inout_observation.sensorConeApperture > 0); + ASSERT_(inout_observation.sensorConeAperture > 0); size_t nRays = - round(1 + inout_observation.sensorConeApperture / 1.0_deg); + round(1 + inout_observation.sensorConeAperture / 1.0_deg); double direction = sensorAbsolutePose.phi() - - 0.5 * inout_observation.sensorConeApperture; - const double Adir = inout_observation.sensorConeApperture / nRays; + 0.5 * inout_observation.sensorConeAperture; + const double Adir = inout_observation.sensorConeAperture / nRays; float min_detected_obs = 0; for (size_t i = 0; i < nRays; i++, direction += Adir) diff --git a/libs/maps/src/maps/CPointsMap.cpp b/libs/maps/src/maps/CPointsMap.cpp index 92b6c7df9f..aeeb1ce762 100644 --- a/libs/maps/src/maps/CPointsMap.cpp +++ b/libs/maps/src/maps/CPointsMap.cpp @@ -1847,7 +1847,7 @@ bool CPointsMap::internal_insertObservation( const auto& o = static_cast(obs); - const double aper_2 = 0.5 * o.sensorConeApperture; + const double aper_2 = 0.5 * o.sensorConeAperture; this->reserve( this->size() + o.sensedData.size() * 30); // faster push_back's. @@ -1863,9 +1863,9 @@ bool CPointsMap::internal_insertObservation( // Insert a few points with a given maximum separation between // them: - const double arc_len = o.sensorConeApperture * rang; + const double arc_len = o.sensorConeAperture * rang; const unsigned int nSteps = round(1 + arc_len / 0.05); - const double Aa = o.sensorConeApperture / double(nSteps); + const double Aa = o.sensorConeAperture / double(nSteps); TPoint3D loc, glob; for (double a1 = -aper_2; a1 < aper_2; a1 += Aa) diff --git a/libs/obs/include/mrpt/obs/CObservationRange.h b/libs/obs/include/mrpt/obs/CObservationRange.h index 133260d2f5..269a7ba332 100644 --- a/libs/obs/include/mrpt/obs/CObservationRange.h +++ b/libs/obs/include/mrpt/obs/CObservationRange.h @@ -37,15 +37,16 @@ class CObservationRange : public CObservation float maxSensorDistance{5}; /** Cone aperture of each ultrasonic beam, in radians. */ - float sensorConeApperture = mrpt::d2f(20.0_deg); + float sensorConeAperture = mrpt::d2f(20.0_deg); struct TMeasurement { - TMeasurement() : sensorPose() {} + TMeasurement() = default; + /** Some kind of sensor ID which identifies it on the bus (if * applicable, 0 otherwise) */ - uint16_t sensorID{0}; + uint16_t sensorID = 0; /** The 6D position of the sensor on the robot. */ @@ -54,7 +55,10 @@ class CObservationRange : public CObservation /** The measured range, in meters (or a value of 0 if there was no * detected echo). */ - float sensedDistance{0}; + float sensedDistance = 0; + + /** If !=0, the nominal sensor noise, as one standard deviation */ + float sensorNoiseStdDeviation = 0; }; using TMeasurementList = std::deque; diff --git a/libs/obs/src/CObservationRange.cpp b/libs/obs/src/CObservationRange.cpp index a36c23db8d..4fe6422f0b 100644 --- a/libs/obs/src/CObservationRange.cpp +++ b/libs/obs/src/CObservationRange.cpp @@ -18,16 +18,17 @@ using namespace mrpt::poses; // This must be added to any CSerializable class implementation file. IMPLEMENTS_SERIALIZABLE(CObservationRange, CObservation, mrpt::obs) -uint8_t CObservationRange::serializeGetVersion() const { return 3; } +uint8_t CObservationRange::serializeGetVersion() const { return 4; } void CObservationRange::serializeTo(mrpt::serialization::CArchive& out) const { // The data - out << minSensorDistance << maxSensorDistance << sensorConeApperture; + out << minSensorDistance << maxSensorDistance << sensorConeAperture; const uint32_t n = sensedData.size(); out << n; for (uint32_t i = 0; i < n; i++) out << sensedData[i].sensorID << CPose3D(sensedData[i].sensorPose) - << sensedData[i].sensedDistance; + << sensedData[i].sensedDistance + << sensedData[i].sensorNoiseStdDeviation; // v4 out << sensorLabel << timestamp; } @@ -40,13 +41,15 @@ void CObservationRange::serializeFrom( case 1: case 2: case 3: + case 4: { uint32_t i, n; // The data - in >> minSensorDistance >> maxSensorDistance >> sensorConeApperture; + in >> minSensorDistance >> maxSensorDistance >> sensorConeAperture; in >> n; + sensedData.clear(); sensedData.resize(n); CPose3D aux; for (i = 0; i < n; i++) @@ -57,6 +60,8 @@ void CObservationRange::serializeFrom( in >> aux >> sensedData[i].sensedDistance; sensedData[i].sensorPose = aux.asTPose(); + + if (version >= 4) in >> sensedData[i].sensorNoiseStdDeviation; } if (version >= 1) in >> sensorLabel; @@ -96,18 +101,19 @@ void CObservationRange::getDescriptionAsText(std::ostream& o) const using namespace std; CObservation::getDescriptionAsText(o); - o << "minSensorDistance = " << minSensorDistance << " m" << endl; - o << "maxSensorDistance = " << maxSensorDistance << " m" << endl; - o << "sensorConeApperture = " << RAD2DEG(sensorConeApperture) << " deg" - << endl; + o << "minSensorDistance = " << minSensorDistance << " m\n"; + o << "maxSensorDistance = " << maxSensorDistance << " m\n"; + o << "sensorConeAperture = " << RAD2DEG(sensorConeAperture) << " deg\n"; // For each entry in this sequence: - o << " SENSOR_ID RANGE (m) SENSOR POSE (on the robot)" << endl; - o << "-------------------------------------------------------" << endl; + o << " SENSOR_ID RANGE (m) STD_DEV (m) SENSOR POSE (on the robot) " + "\n"; + o << "-------------------------------------------------------\n"; for (const auto& q : sensedData) { o << format(" %7u", (unsigned int)q.sensorID); o << format(" %4.03f ", q.sensedDistance); - o << q.sensorPose << endl; + o << format(" %4.03f ", q.sensorNoiseStdDeviation); + o << q.sensorPose << "\n"; } } diff --git a/libs/ros1bridge/src/range.cpp b/libs/ros1bridge/src/range.cpp index 49ae5c3ad7..5fe6d958ba 100644 --- a/libs/ros1bridge/src/range.cpp +++ b/libs/ros1bridge/src/range.cpp @@ -20,10 +20,9 @@ bool mrpt::ros1bridge::fromROS( { obj.minSensorDistance = msg.min_range; obj.maxSensorDistance = msg.max_range; - obj.sensorConeApperture = msg.field_of_view; + obj.sensorConeAperture = msg.field_of_view; - /// again this is amibiguous as can't be certain of number of measurement - /// from corresponding ROS message + obj.sensedData.resize(1); obj.sensedData.at(0).sensedDistance = msg.range; return true; } @@ -43,7 +42,7 @@ bool mrpt::ros1bridge::toROS( { msg[i].max_range = obj.maxSensorDistance; msg[i].min_range = obj.minSensorDistance; - msg[i].field_of_view = obj.sensorConeApperture; + msg[i].field_of_view = obj.sensorConeAperture; } /// following part needs to be double checked, it looks incorrect diff --git a/libs/ros2bridge/src/range.cpp b/libs/ros2bridge/src/range.cpp index d2606320db..d33dd55fa6 100644 --- a/libs/ros2bridge/src/range.cpp +++ b/libs/ros2bridge/src/range.cpp @@ -15,16 +15,34 @@ #include +#include + +template +struct has_variance : std::false_type +{ +}; + +template +struct has_variance> : std::true_type +{ +}; + bool mrpt::ros2bridge::fromROS( const sensor_msgs::msg::Range& msg, mrpt::obs::CObservationRange& obj) { obj.minSensorDistance = msg.min_range; obj.maxSensorDistance = msg.max_range; - obj.sensorConeApperture = msg.field_of_view; + obj.sensorConeAperture = msg.field_of_view; - /// again this is amibiguous as can't be certain of number of measurement - /// from corresponding ROS message + obj.sensedData.resize(1); obj.sensedData.at(0).sensedDistance = msg.range; + + // See: https://github.com/MRPT/mrpt/issues/1270 + if constexpr (has_variance::value) + { + obj.sensedData.at(0).sensorNoiseStdDeviation = std::sqrt(msg.variance); + } + return true; } @@ -32,24 +50,31 @@ bool mrpt::ros2bridge::toROS( const mrpt::obs::CObservationRange& obj, const std_msgs::msg::Header& msg_header, sensor_msgs::msg::Range* msg) { - long num_range = obj.sensedData.size(); + const auto num_range = obj.sensedData.size(); // 1) sensor_msgs::msg::Range:: header - for (long i = 0; i < num_range; i++) + for (size_t i = 0; i < num_range; i++) msg[i].header = msg_header; // 2) sensor_msg::Range parameters - for (long i = 0; i < num_range; i++) + for (size_t i = 0; i < num_range; i++) { msg[i].max_range = obj.maxSensorDistance; msg[i].min_range = obj.minSensorDistance; - msg[i].field_of_view = obj.sensorConeApperture; + msg[i].field_of_view = obj.sensorConeAperture; + + // See: https://github.com/MRPT/mrpt/issues/1270 + if constexpr (has_variance::value) + { + msg[i].variance = + mrpt::square(obj.sensedData[i].sensorNoiseStdDeviation); + } } /// following part needs to be double checked, it looks incorrect /// ROS has single number float for range, MRPT has a list of /// sensedDistances - for (long i = 0; i < num_range; i++) + for (size_t i = 0; i < num_range; i++) msg[i].range = obj.sensedData.at(i).sensedDistance; /// currently the following are not available in MRPT for corresponding diff --git a/python/src/mrpt/obs/CObservationRange.cpp b/python/src/mrpt/obs/CObservationRange.cpp index f9508b6942..9d3399bd33 100644 --- a/python/src/mrpt/obs/CObservationRange.cpp +++ b/python/src/mrpt/obs/CObservationRange.cpp @@ -246,7 +246,7 @@ void bind_mrpt_obs_CObservationRange(std::function< pybind11::module &(std::stri cl.def( pybind11::init( [](mrpt::obs::CObservationRange const &o){ return new mrpt::obs::CObservationRange(o); } ) ); cl.def_readwrite("minSensorDistance", &mrpt::obs::CObservationRange::minSensorDistance); cl.def_readwrite("maxSensorDistance", &mrpt::obs::CObservationRange::maxSensorDistance); - cl.def_readwrite("sensorConeApperture", &mrpt::obs::CObservationRange::sensorConeApperture); + cl.def_readwrite("sensorConeAperture", &mrpt::obs::CObservationRange::sensorConeAperture); cl.def_readwrite("sensedData", &mrpt::obs::CObservationRange::sensedData); cl.def_static("GetRuntimeClassIdStatic", (const struct mrpt::rtti::TRuntimeClassId & (*)()) &mrpt::obs::CObservationRange::GetRuntimeClassIdStatic, "C++: mrpt::obs::CObservationRange::GetRuntimeClassIdStatic() --> const struct mrpt::rtti::TRuntimeClassId &", pybind11::return_value_policy::automatic); cl.def("GetRuntimeClass", (const struct mrpt::rtti::TRuntimeClassId * (mrpt::obs::CObservationRange::*)() const) &mrpt::obs::CObservationRange::GetRuntimeClass, "C++: mrpt::obs::CObservationRange::GetRuntimeClass() const --> const struct mrpt::rtti::TRuntimeClassId *", pybind11::return_value_policy::automatic); diff --git a/python/stubs-out/mrpt/pymrpt/mrpt/obs/__init__.pyi b/python/stubs-out/mrpt/pymrpt/mrpt/obs/__init__.pyi index 39e5450df4..06867d0670 100644 --- a/python/stubs-out/mrpt/pymrpt/mrpt/obs/__init__.pyi +++ b/python/stubs-out/mrpt/pymrpt/mrpt/obs/__init__.pyi @@ -1217,7 +1217,7 @@ class CObservationRange(CObservation): maxSensorDistance: float minSensorDistance: float sensedData: Any - sensorConeApperture: float + sensorConeAperture: float @overload def __init__(self) -> None: ... @overload From 814650bec0fe55e1f54a5889487d1b1386a65ce3 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Tue, 24 Oct 2023 02:22:16 +0200 Subject: [PATCH 4/6] BUGFIX: In voxelmaps with non-identity sensorPose --- doc/source/doxygen-docs/changelog.md | 1 + .../include/mrpt/maps/CVoxelMapOccupancyBase.h | 18 ++++++++++-------- libs/maps/src/maps/CVoxelMap.cpp | 13 ++++++++----- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/doc/source/doxygen-docs/changelog.md b/doc/source/doxygen-docs/changelog.md index 950f7a5417..f0b09c31b3 100644 --- a/doc/source/doxygen-docs/changelog.md +++ b/doc/source/doxygen-docs/changelog.md @@ -10,6 +10,7 @@ - Address the new field `variance` in `sensor_msgs/Range` (Closes [issue #1270](https://github.com/MRPT/mrpt/issues/1270)). - BUG FIXES: - Fix wrong rendering of all wxWidgets-based OpenGL windows when using Ubuntu's display settings to change UI to a size different than 100% (Fixes [issue #1114](https://github.com/MRPT/mrpt/issues/1114)). + - Fix ignored sensorPose of mrpt::obs::CObservationPointCloud while inserting them into voxel maps. # Version 2.11.1: Released Oct 23rd, 2023 - Changes in libraries: diff --git a/libs/maps/include/mrpt/maps/CVoxelMapOccupancyBase.h b/libs/maps/include/mrpt/maps/CVoxelMapOccupancyBase.h index be31c0b747..f10a43d7de 100644 --- a/libs/maps/include/mrpt/maps/CVoxelMapOccupancyBase.h +++ b/libs/maps/include/mrpt/maps/CVoxelMapOccupancyBase.h @@ -150,12 +150,12 @@ class CVoxelMapOccupancyBase : public CVoxelMapBase, void insertPointCloudAsRays( const mrpt::maps::CPointsMap& pts, const mrpt::math::TPoint3D& sensorPt, - const std::optional& robotPose = + const std::optional& sensorPose = std::nullopt); void insertPointCloudAsEndPoints( const mrpt::maps::CPointsMap& pts, const mrpt::math::TPoint3D& sensorPt, - const std::optional& robotPose = + const std::optional& sensorPose = std::nullopt); /** Returns all occupied voxels as a point cloud. The shared_ptr is @@ -480,7 +480,7 @@ bool CVoxelMapOccupancyBase::getPointOccupancy( template void CVoxelMapOccupancyBase::insertPointCloudAsRays( const mrpt::maps::CPointsMap& pts, const mrpt::math::TPoint3D& sensorPt, - const std::optional& robotPose) + const std::optional& sensorPose) { markAsChanged(); @@ -510,8 +510,9 @@ void CVoxelMapOccupancyBase::insertPointCloudAsRays( // for each ray: for (size_t i = 0; i < xs.size(); i += insertionOptions.decimation) { - const auto pt = robotPose - ? robotPose->composePoint(mrpt::math::TPoint3D(xs[i], ys[i], zs[i])) + const auto pt = sensorPose + ? sensorPose->composePoint( + mrpt::math::TPoint3D(xs[i], ys[i], zs[i])) : mrpt::math::TPoint3D(xs[i], ys[i], zs[i]); if (insertionOptions.max_range > 0 && @@ -577,7 +578,7 @@ template void CVoxelMapOccupancyBase:: insertPointCloudAsEndPoints( const mrpt::maps::CPointsMap& pts, const mrpt::math::TPoint3D& sensorPt, - const std::optional& robotPose) + const std::optional& sensorPose) { markAsChanged(); @@ -594,8 +595,9 @@ void CVoxelMapOccupancyBase:: for (size_t i = 0; i < xs.size(); i += insertionOptions.decimation) { - const auto pt = robotPose - ? robotPose->composePoint(mrpt::math::TPoint3D(xs[i], ys[i], zs[i])) + const auto pt = sensorPose + ? sensorPose->composePoint( + mrpt::math::TPoint3D(xs[i], ys[i], zs[i])) : mrpt::math::TPoint3D(xs[i], ys[i], zs[i]); if (insertionOptions.max_range > 0 && diff --git a/libs/maps/src/maps/CVoxelMap.cpp b/libs/maps/src/maps/CVoxelMap.cpp index bd4166c5b1..1a1472f836 100644 --- a/libs/maps/src/maps/CVoxelMap.cpp +++ b/libs/maps/src/maps/CVoxelMap.cpp @@ -116,18 +116,21 @@ bool CVoxelMap::internal_insertObservation_Pts( if (!obs.pointcloud || obs.pointcloud->empty()) return false; mrpt::math::TPoint3D sensorPt; - mrpt::poses::CPose3D localSensorPose; + mrpt::poses::CPose3D localSensorPose, globalSensorPose; obs.getSensorPose(localSensorPose); if (robotPose) // - sensorPt = (*robotPose + localSensorPose).translation(); + globalSensorPose = *robotPose + localSensorPose; else - sensorPt = localSensorPose.translation(); + globalSensorPose = localSensorPose; + + sensorPt = globalSensorPose.translation(); // Insert rays: if (insertionOptions.ray_trace_free_space) - insertPointCloudAsRays(*obs.pointcloud, sensorPt, robotPose); + insertPointCloudAsRays(*obs.pointcloud, sensorPt, globalSensorPose); else - insertPointCloudAsEndPoints(*obs.pointcloud, sensorPt, robotPose); + insertPointCloudAsEndPoints( + *obs.pointcloud, sensorPt, globalSensorPose); return true; } From 4b6e10895848a1c66e12d26e63dad4e3ebb52bc8 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Wed, 25 Oct 2023 12:55:03 +0200 Subject: [PATCH 5/6] Fix correct use of if constexpr() Closes #1270 --- libs/ros2bridge/src/range.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/libs/ros2bridge/src/range.cpp b/libs/ros2bridge/src/range.cpp index d33dd55fa6..62655ca104 100644 --- a/libs/ros2bridge/src/range.cpp +++ b/libs/ros2bridge/src/range.cpp @@ -27,6 +27,26 @@ struct has_variance> : std::true_type { }; +// for "if constexpr" to work (avoid build errors if field does not exist) +// it must be inside a template: +template +void fromROS_variance(const MSG_T& msg, mrpt::obs::CObservationRange& obj) +{ + if constexpr (has_variance::value) + { + obj.sensedData.at(0).sensorNoiseStdDeviation = std::sqrt(msg.variance); + } +} +template +void toROS_variance( + MSG_T& msg, const mrpt::obs::CObservationRange::TMeasurement& m) +{ + if constexpr (has_variance::value) + { + msg.variance = mrpt::square(m.sensorNoiseStdDeviation); + } +} + bool mrpt::ros2bridge::fromROS( const sensor_msgs::msg::Range& msg, mrpt::obs::CObservationRange& obj) { @@ -38,10 +58,7 @@ bool mrpt::ros2bridge::fromROS( obj.sensedData.at(0).sensedDistance = msg.range; // See: https://github.com/MRPT/mrpt/issues/1270 - if constexpr (has_variance::value) - { - obj.sensedData.at(0).sensorNoiseStdDeviation = std::sqrt(msg.variance); - } + fromROS_variance(msg, obj); return true; } @@ -64,11 +81,7 @@ bool mrpt::ros2bridge::toROS( msg[i].field_of_view = obj.sensorConeAperture; // See: https://github.com/MRPT/mrpt/issues/1270 - if constexpr (has_variance::value) - { - msg[i].variance = - mrpt::square(obj.sensedData[i].sensorNoiseStdDeviation); - } + toROS_variance(msg[i], obj.sensedData[i]); } /// following part needs to be double checked, it looks incorrect From 5889806101378bb4eed9d40aae3f3b4de39024ac Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Wed, 25 Oct 2023 17:06:29 +0200 Subject: [PATCH 6/6] Release date --- doc/source/doxygen-docs/changelog.md | 2 +- libs/maps/src/maps/CVoxelMap.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/source/doxygen-docs/changelog.md b/doc/source/doxygen-docs/changelog.md index f0b09c31b3..1a1d946d13 100644 --- a/doc/source/doxygen-docs/changelog.md +++ b/doc/source/doxygen-docs/changelog.md @@ -1,6 +1,6 @@ \page changelog Change Log -# Version 2.11.2: UNRELEASED +# Version 2.11.2: Released Oct 25th, 2023 - Changes in libraries: - \ref mrpt_gui_grp - New function mrpt::gui::GetScaledClientSize(). diff --git a/libs/maps/src/maps/CVoxelMap.cpp b/libs/maps/src/maps/CVoxelMap.cpp index 1a1472f836..dadea25917 100644 --- a/libs/maps/src/maps/CVoxelMap.cpp +++ b/libs/maps/src/maps/CVoxelMap.cpp @@ -146,8 +146,6 @@ bool CVoxelMap::internal_insertObservation( return internal_insertObservation_Pts(*obsPts, robotPose); } - // TODO: Handle more special cases and avoid duplicating pointcloud? - // Auxiliary 3D point cloud: mrpt::maps::CSimplePointsMap pts; pts.insertObservation(obs, robotPose);