Skip to content

Commit

Permalink
Fixed build with pcl<1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
matlabbe committed May 13, 2024
1 parent 9505a21 commit 72d7418
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
9 changes: 7 additions & 2 deletions corelib/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ SET(SRC_FILES
camera/CameraMyntEye.cpp
camera/CameraDepthAI.cpp

lidar/LidarVLP16.cpp

EpipolarGeometry.cpp
VisualWord.cpp
VWDictionary.cpp
Expand Down Expand Up @@ -138,6 +136,13 @@ SET(SRC_FILES
opencv/five-point.cpp
)

IF(PCL_VERSION VERSION_GREATER_EQUAL "1.8")
SET(SRC_FILES
${SRC_FILES}
lidar/LidarVLP16.cpp
)
ENDIF(PCL_VERSION VERSION_GREATER_EQUAL "1.8")

IF(OpenCV_VERSION_MAJOR EQUAL 2)
SET(SRC_FILES
${SRC_FILES}
Expand Down
2 changes: 1 addition & 1 deletion docker/jfr2018/latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ RUN source /root/catkin_ws/devel/setup.bash && \
RUN source /root/catkin_ws/devel/setup.bash && \
cd rtabmap_loam && \
cd build && \
~/cmake -DWITH_LOAM=ON -DWITH_FLOAM=ON -DWITH_OPENGV=OFF .. && \
~/cmake -DWITH_LOAM=ON -DWITH_FLOAM=ON -DWITH_OPENGV=OFF -DWITH_CERES=ON .. && \
make -j3 && \
rm -rf *
RUN source /root/catkin_ws/devel/setup.bash && \
Expand Down
4 changes: 3 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ IF(TARGET rtabmap_gui)
ADD_SUBDIRECTORY( RGBDMapping )
ADD_SUBDIRECTORY( WifiMapping )
ADD_SUBDIRECTORY( NoEventsExample )
ADD_SUBDIRECTORY( LidarMapping )
IF(PCL_VERSION VERSION_GREATER_EQUAL "1.8")
ADD_SUBDIRECTORY( LidarMapping )
ENDIF()
ELSE()
MESSAGE(STATUS "RTAB-Map GUI lib is not built, the RGBDMapping and WifiMapping examples will not be built...")
ENDIF()
Expand Down
10 changes: 10 additions & 0 deletions guilib/src/PreferencesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <pcl/pcl_config.h>
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
// Should be first on windows to avoid "WinSock.h has already been included" error
#include "rtabmap/core/lidar/LidarVLP16.h"
#endif

#include "rtabmap/gui/PreferencesDialog.h"
#include "rtabmap/gui/DatabaseViewer.h"
Expand Down Expand Up @@ -6950,6 +6953,7 @@ Lidar * PreferencesDialog::createLidar()
Src driver = getLidarSourceDriver();
if(driver == kSrcLidarVLP16)
{
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
Transform localTransform = Transform::fromString(_ui->lineEdit_lidar_local_transform->text().replace("PI_2", QString::number(3.141592/2.0)).toStdString());
if(localTransform.isNull())
{
Expand Down Expand Up @@ -6994,6 +6998,12 @@ Lidar * PreferencesDialog::createLidar()
delete lidar;
lidar = 0;
}
#else
UWARN("Lidar cannot be used with rtabmap built with PCL < 1.8... ");
QMessageBox::warning(this,
tr("RTAB-Map"),
tr("Lidar initialization failed..."));
#endif
}
return lidar;
}
Expand Down
4 changes: 3 additions & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ ENDIF(OPENCV_NONFREE_FOUND)

IF(TARGET rtabmap_gui)
ADD_SUBDIRECTORY( CameraRGBD )
ADD_SUBDIRECTORY( LidarViewer )
IF(PCL_VERSION VERSION_GREATER_EQUAL "1.8")
ADD_SUBDIRECTORY( LidarViewer )
ENDIF()
ADD_SUBDIRECTORY( DatabaseViewer )
ADD_SUBDIRECTORY( EpipolarGeometry )
ADD_SUBDIRECTORY( OdometryViewer )
Expand Down

0 comments on commit 72d7418

Please sign in to comment.