INDEMIND相机运行ORB2-slam。

本文采用基于使用自己的INDEMIND相机来运行ORBSLAM2单目,双目和深度模式博客的方法来运行。

主要为以下几步:

  1. 基于官网提供的sdk:https://imsee-sdk-docs.readthedocs.io/zh/latest/来创建基于ros的topic。
#这里用sudo -s可以不切换用户环境
sudo -s 
source <sdk_ros_ws>/devel/setup.sh
roslaunch imsee_ros_wrapper start.launch
#或 display.launch打开rviz显示topic
roslaunch imsee_ros_wrapper display.launch
#新开终端,打印查看topic信息,主要查看左右摄像头发布的topic名称
rostopic list
  1. 下载编译orb2
cd catkin_ws/src
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
cd ORB_SLAM2
chmod +x build.sh
./build.sh

chmod +x build_ros.sh
./build_ros.sh

编译遇到问题,参见https://blog.csdn.net/weishaodong/article/details/106640171
其中:

[rosbuild] rospack found package “ORB_SLAM3” at “”, but the current directory is “/home/xxx/ORB_SLAM3/Examples/ROS/ORB_SLAM3”. You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.
的问题,可以用以下命令解决:
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:[ORB_SLAM3_home_dir]/Examples/ROS/ORB_SLAM3

  1. 修改相机标定及orb配置文件;
    可以基于ORB_SLAM2/Examples/ROS/ORB_SLAM2/Asus.yaml对应更改相机的标定值。
    INDEMIND的两个相机是由同一个节点imsee_ros_wrapper发布的。因此使用camera_calibration工具可能会有问题。
    参考:
    ROS下单目和双目相机的标定
    在ROS中实现双目相机校正
    双目相机标定和orbslam2双目参数详解
    本人尝试
    1.基于SDK-Linux/lib/1804/headset.yaml改的。
    2.使用camera_calibration标定。
    启动标定:
rosrun camera_calibration cameracalibrator.py --size 8x6 square 0.019 --no-service-check  right:=/camera/right/image_raw left:=/camera/left/image_raw

标定板:
在这里插入图片描述
标定的结果填入Asus.yaml。 k 1 , k 2 , p 1 , p 2 , k 3 k1, k2, p1, p2, k3 k1,k2,p1,p2,k3为相机畸变调整参数。 f x , f y f_x, f_y fx,fy为焦距; c x , c y c_x, c_y cx,cy为图像中心。 b f = b a s e l i n e ∗ f x bf=baseline * f_x bf=baselinefx
d i s t o r t i o n = [ k 1 , k 2 , p 1 , p 2 , k 3 ] distortion = [k1, k2, p1, p2, k3] distortion=[k1,k2,p1,p2,k3]
c a m e r a _ m a t r i x = f x 0 c x 0 f y c y 0 0 1 camera\_matrix =\begin{array}{ccc} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1\\\\ \end{array} camera_matrix=fx000fy0cxcy1
p r o j e c t i o n = f x ′ 0.0 c x ′ − b f 0.0 f y ′ c y ′ 0.0 0.0 0.0 1.0 0.0 projection =\begin{array}{ccc} fx' & 0.0 & cx' & -bf\\\\ 0.0 & fy' & cy' & 0.0\\\\ 0.0 & 0.0 & 1.0 & 0.0\\\\\end{array} projection=fx0.00.00.0fy0.0cxcy1.0bf0.00.0
附上本人所用的配置文件Asus.yaml的标定部分内容:

Camera.fx: 253.58
Camera.fy: 253.72
Camera.cx: 315.47
Camera.cy: 203.78

Camera.k1: 0.138
Camera.k2: -0.111
Camera.p1: -0.005
Camera.p2: -0.005

Camera.width: 640
Camera.height: 400
# Camera frames per second
Camera.fps: 50.0
# IR projector baseline times fx (aprox.)
Camera.bf: 34.6
# Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale)
Camera.RGB: 1
# Close/Far threshold. Baseline times.
ThDepth: 40.0
# Deptmap values factor
DepthMapFactor: 1.0
  1. 修改或remapORB2订阅的image topic。
    使用自己的INDEMIND相机来运行ORBSLAM2博客中是将ros_stereo.cc中的sub节点更改为imsee_ros_wrapper发布的topic名称,但是在启动orb后,一直卡在waiting for image。

    本人修改imsee_ros_wrapper下的IMSEE-SDK/ros/src/imsee_ros_wrapper/launch/start.launch文件。如下:将imsee_ros_wrapper发布的topic名映射为orb接收图像topic使用的topic名。

<?xml version="1.0"?> 
<launch> 
  <arg name="imsee" default="imsee" /> 
  <group ns="$(arg imsee)">  
       <node name="imsee_wrapper_node" pkg="imsee_ros_wrapper" type="imsee_wrapper_node" output="screen" respawn="true" respawn_delay="10"> 
          <remap from="/imsee/image/left" to="/camera/left/image_raw" />  
          <remap from="/imsee/image/right" to="/camera/right/image_raw" /> 
       <rosparam file="$(find imsee_ros_wrapper)/config/settings.yaml" command="load" /> 
    </node>
  </group>
</launch>
  1. 启动ORB2:
    将orb2编译好的libORB_SLAM2.so放到~/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/lib下,并
    在~/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/CMakeLists.txt添加以下内容,29行endif后添加:

link_directories(${PROJECT_SOURCE_DIR}/…/…/…/lib)

编译ORB,执行~/catkin_ws/src/ORB_SLAM2/build_ros.sh

编译完成后,执行以下命令,启动ORB:
启动方式1:

cd ~/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2
source ~/catkin_ws/devel/setup.sh
rosrun  ORB_SLAM2  Stereo ../../../Vocabulary/ORBvoc.txt Asus.yaml false

启动方式2:
在~/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/launch添加start.launch文件,内容如下:

<?xml version="1.0"?>
<launch>
 <node name="Stereo" pkg="ORB_SLAM2" type="Stereo" 
	args=" $(find ORB_SLAM2)../../../Vocabulary/ORBvoc.txt $(find ORB_SLAM2)Asus_imsee.yaml false" 
	output="screen" respawn="true" respawn_delay="10">
 </node>
</launch> 

完成launch文件后,执行以下命令:

cd ~/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2
source ~/catkin_ws/devel/setup.sh
roslaunch ORB_SLAM2 start.launch

遇到问题:

  1. libMNN.so: cannot open shared object file: No such file or directory

[ERROR] [1593354623.672179613]: Failed to load nodelet [/imsee/imsee_wrapper_node] of type [imsee/ROSWrapperNodelet] even after refreshing the cache: Failed to load library /home/xxx/Download/opensource/INDEMIND/IMSEE-SDK/ros/devel/lib//libimsee_wrapper.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = libMNN.so: cannot open shared object file: No such file or directory)

解决:
依照sdk安装libMNN。

  1. 关于ros melodic 默认安装opencv的3.2版本,因此在启动imsee_ros_wrapper时,报以下错错误:libopencv_calib3d3.so.3.3: cannot open shared object file: No such file or directory。
    解决:
    将IMSEE-SDK/lib/others/x64-opencv3.4.3/libindemind.so的包,替换掉IMSEE-SDK/lib/x86-64/libindemind.so。注意根据你的机器cpu配置更改。
    重新编译opencv3.4.3版本,参考:
git clone https://github.com/opencv/opencv.git
cd opencv/
git checkout tags/3.4.3

mkdir build
cd build/

cmake \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
\
-DWITH_CUDA=OFF \
\
-DBUILD_DOCS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
..

make -j4
sudo make install
  1. 关于orb启动后,段错误的问题:
    解决:
    参考:段错误的解决方案—之-march=native
    将g2o及orbslam2根目库下的cmakeLists.txt去掉里面的 -march=native,重新编译生成libORB_SLAM2.so,并拷贝到Stereo能ld的位置,可参考上述的步骤2。
  2. 编译找不到error "unsleep"的,在源文件中添加以下内容,引入unistd.h头文件
#include <unistd.h>
  1. ./build_ros.sh时,报如下错误:
    [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/angelo/ORB_SLAM2/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.
    解决方法01:
    export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM2/Examples/ROS
    解决方法2:
    sudo ln -s ~/ORB_SLAM2/Examples/ROS/ORB_SLAM2 /opt/ros/<ros版本名>/share/ORB_SLAM2
    以上方法选其1,然后再./build_ros.sh。
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值