关于INDEMIND相机:官网sdk的提供粗糙,介绍不完整,官方技术人员几乎不提供技术支持。
个人认为,码龄不足,想跑自己的或官方以外算法,,,。
本文采用基于使用自己的INDEMIND相机来运行ORBSLAM2单目,双目和深度模式博客的方法来运行。
主要为以下几步:
#这里用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
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
3. 修改相机标定及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=baseline∗fx
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=fx′0.00.00.0fy′0.0cx′cy′1.0−bf0.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
修改或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>
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
遇到问题:
[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。
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
#include