ubuntu20.04 成功编译并运行 OpenREALM
文章目录
目前使用 ubuntu20.04 成功编译并运行 OpenREALM 项目。
1、项目 OpenREALM 编译
项目地址 https://github.com/laxnpander/OpenREALM
项目依赖很多,且最后编译输出为静态库。
下载项目库,并更新子模块
git clone https://github.com/laxnpander/OpenREALM.git
cd OpenREALM
# For 3D reconstruction with Plane Sweep Lib (PSL)
git submodule init
git submodule update
安装依赖,可以一键执行
cd OpenREALM/tools
chmod u+x install_deps.sh
./install_deps.sh
如果安装失败后,再次执行 install_deps.sh
脚本会失败(提示目录不为空),那么需要删除未完成的项目目录,或者打开sh脚本将对应依赖项目的命令行复制到终端手动执行。
在安装最后一个vslam依赖项目时,需要依赖 pangolin 库,实测需要降级到v0.6版本才能正常编译通过:
git clone -b v0.6 https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
./scripts/install_prerequisites.sh recommended
cmake -B build
cmake --build build
cd build
make install
结束后,到 OpenREALM 目录,编译并安装
cd OpenREALM
mkdir build && cd build
cmake ..
make all
sudo make install
如果在编译过程中提示pangolin的错误,尝试清理重新编译安装Pangolin后,再次编译OpenREALM 项目。
2、项目 OpenREALM_ROS1_Bridge 编译
官方默认使用 ubuntu 16.04和 18.04。 我这里直接使用 ubuntu 20.04 ,且用 ros1最后一个版本 noetic。
强烈推荐 ros 安装使用 鱼香ros 的脚本,直接运行以下命令行即可一键安装
wget http://fishros.com/install -O fishros && . fishros
运行后根据提示操作。
安装可能需要的库
sudo apt install -y -q ros-$ROS_DISTRO-geographic-msgs
sudo apt install -y -q ros-$ROS_DISTRO-geodesy
sudo apt install -y -q ros-$ROS_DISTRO-cv-bridge
sudo apt install -y -q ros-$ROS_DISTRO-rviz
sudo apt install -y -q ros-$ROS_DISTRO-pcl-ros
sudo apt install libopencv-dev
sudo apt install libvtk7-dev
sudo apt install vtkParseOGLExt
sudo apt install libboost-dev
2.1、编译时可能出现错误
2.1.1、缺少头 realm_core的 文件
编译提示 realm_core/utm32.h
、realm_core/cv_grid_map.h
、realm_core/enums.h
不存在
在 /realm_ros/CMakeLists.txt 文件的 target_link_libraries 下添加库依赖 realm_stages
target_link_libraries(${PROJECT_NAME} PUBLIC
${catkin_LIBRARIES}
${cmake_modules_LIBRARIES}
${OpenCV_LIBRARIES}
realm_stages
)
2.1.2、缺少 boost 相关的库
查找相关库,并加入库依赖
find_package(Boost COMPONENTS thread filesystem date_time system REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC
${catkin_LIBRARIES}
${cmake_modules_LIBRARIES}
${OpenCV_LIBRARIES}
realm_stages
${Boost_FILESYSTEM_LIBRARIES}
${Boost_SYSTEM_LIBRARIES}
)
2.1.3、提示缺少 FLANN
CMake Error at OpenREALM_ROS1_Bridge/realm_ros/CMakeLists.txt:165 (add_executable):
Target "realm_exiv2_grabber" links to target "FLANN::FLANN" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at OpenREALM_ROS1_Bridge/realm_ros/CMakeLists.txt:161 (add_executable):
Target "realm_ros_grabber" links to target "FLANN::FLANN" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at OpenREALM_ROS1_Bridge/realm_ros/CMakeLists.txt:118 (add_library):
Target "realm_ros" links to target "FLANN::FLANN" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at OpenREALM_ROS1_Bridge/realm_ros/CMakeLists.txt:169 (add_executable):
Target "realm_stage_node" links to target "FLANN::FLANN" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
增加 add_library(FLANN::FLANN INTERFACE IMPORTED)
2.1.4、缺少 CGAL 库
/usr/bin/ld: cannot find -lCGAL
collect2: error: ld returned 1 exit status
make[2]: *** [OpenREALM_ROS1_Bridge/realm_ros/CMakeFiles/realm_ros.dir/build.make:447: /home/ubunru/catkin_ws/devel/lib/librealm_ros.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:2072: OpenREALM_ROS1_Bridge/realm_ros/CMakeFiles/realm_ros.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
增加 find_package(CGAL REQUIRED)
2.1.5、缺少符号链接 pthread
/usr/bin/ld: /usr/local/lib/libopen_realm_core-1.0.0.a(worker_thread_base.cpp.o): undefined reference to symbol 'pthread_getspecific@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libpthread.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [OpenREALM_ROS1_Bridge/realm_ros/CMakeFiles/realm_stage_node.dir/build.make:391: /home/ubunru/catkin_ws/devel/lib/realm_ros/realm_stage_node] Error 1
make[1]: *** [CMakeFiles/Makefile2:2791: OpenREALM_ROS1_Bridge/realm_ros/CMakeFiles/realm_stage_node.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 98%] Linking CXX executable /home/ubunru/catkin_ws/devel/lib/realm_ros/realm_exiv2_grabber
/usr/bin/ld: /usr/local/lib/libopen_realm_core-1.0.0.a(worker_thread_base.cpp.o): undefined reference to symbol 'pthread_getspecific@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libpthread.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [OpenREALM_ROS1_Bridge/realm_ros/CMakeFiles/realm_exiv2_grabber.dir/build.make:391: /home/ubunru/catkin_ws/devel/lib/realm_ros/realm_exiv2_grabber] Error 1
make[1]: *** [CMakeFiles/Makefile2:1920: OpenREALM_ROS1_Bridge/realm_ros/CMakeFiles/realm_exiv2_grabber.dir/all] Error 2
[100%] Linking CXX executable /home/ubunru/catkin_ws/devel/lib/realm_ros/realm_ros_grabber
[100%] Built target realm_ros_grabber
make: *** [Makefile:141: all] Error 2
在 target_link_libraries 中添加库依赖 libpthread.so
2.2、运行时错误
2.2.1、缺少链接库 g2o和 fbow
提示缺少 libg2o_csparse_extension.so、libfbow.so.0.0、libg2o_core.so、libg2o_stuff.so ,
实际查看已经是存在于 /usr/local/lib 目录中,并且ldd常看其他依赖库也用到了该目录。
窗口执行 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
,再次运行正常。
永久解决需添加到 /etc/profile 或 ~/.bashrc,之后重启或直接source。
2.2.2、插件 rviz_plugins/AerialMapDisplay 加载失败
[ERROR] [1733305650.273316877]: PluginlibFactory: The plugin for class
'rviz_plugins/AerialMapDisplay' failed to load. Error: According to the loaded plugin
descriptions the class rviz_plugins/AerialMapDisplay with base class type
rviz::Display does not exist. Declared types are realm_rviz_plugin/GroundImage
rviz/AccelStamped rviz/Axes rviz/Camera rviz/DepthCloud rviz/Effort rviz/FluidPressure
rviz/Grid rviz/GridCells rviz/Illuminance rviz/Image rviz/InteractiveMarkers
rviz/LaserScan rviz/Map rviz/Marker rviz/MarkerArray rviz/Odometry rviz/Path
rviz/PointCloud rviz/PointCloud2 rviz/PointStamped rviz/Polygon rviz/Pose
rviz/PoseArray rviz/PoseWithCovariance rviz/Range rviz/RelativeHumidity
rviz/RobotModel rviz/TF rviz/Temperature rviz/TwistStamped rviz/WrenchStamped
rviz_plugin_tutorials/Imu
安装对应插件即可, sudo apt install ros-$ROS_DISTRO-rviz-satellite
3、测试
数据库下载,谷歌云盘,文件大小为2.7G,自己科学上网。。。
下载地址 https://drive.google.com/open?id=1-2h0tasI4wzxZKLBbOz3XbJ7f5xlxlMe
下载后解压,如我的路径为 /home/ubuntu/Downloads/edm_big_overlap_50p
,
修改启动文件 src/OpenREALM_ROS1_Bridge/realm_ros/launch/alexa_gnss.launch
,设置输入图片目录的绝对路径
<node pkg="realm_ros" type="realm_exiv2_grabber" name="realm_exiv2_grabber" output="screen">
<param name="config/id" type="string" value="$(arg camera_id)"/>
<param name="config/input" type="string" value="/home/ubuntu/Downloads/edm_big_overlap_50p"/>
<param name="config/rate" type="double" value="10.0"/>
<param name="config/profile" type="string" value="alexa_gnss"/>
<!--param name="config/opt/poses" type="string" value=""/-->
<!--param name="config/opt/surface_pts" type="string" value=""/-->
<!--param name="config/opt/set_all_keyframes" type="bool" value="True"/-->
<!--param name="config/opt/working_directory" type="string" value="/home/alex/Documents/OpenREALM"/-->
</node>
在终端执行脚本
roslaunch realm_ros alexa_gnss.launch
结果截图如下:
由于默认地图使用google,国内无法加载,rviz界面有error,背景无显示。
需要自己替换可用的瓦片地图资源,修改位置为 src/OpenREALM_ROS1_Bridge/realm_ros/rviz 下的两个文件内容,Display部分、Name 为 AerialMapDisplay 对应的 Object URI 路径。
Object URI: http://mt0.google.com/vt/lyrs=y&hl=en&x={x}&y={y}&z={z}&s=Ga
原文地址:https://blog.csdn.net/wanggao_1990/article/details/144258978
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!