ORB_SLAM 2のRGBDテスト

7882 ワード

ORB_SLAM 2のインストールとコンパイルはここでは言わないで、私の前のブログはすでに記録しました.
ここではExamplesのRGBDテストを直接持参します.
1、環境変数の追加
$gedit ~/.bashrc
ファイルの最後に追加:
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home
/**/ORB_SLAM2/Examples/ROS
自分のパス(lu jing)を追加することに注意して、意外にも打ち出せないで、ううう
2、ディレクトリORB_SLAM2/Examples/ROS/ORB_SLAM2/src
/ros_rgbd.cc中:kinectがリリースしたtopicが変わったので、プログラムのデフォルトではありません.
変更が必要です.
$gedit ros_rgbd.cc
関数int main(int argc,char**argv)に
情報内容の変更
message_filters::Subscriber::Image> rgb_sub(nh, "/kinect2/qhd/image_color_rect", 1);
message_filters::Subscriber::Image> depth_sub(nh, "/kinect2/qhd/image_depth_rect", 1);

取り替えてもいいです
/kinect2/hd/image_colorと/kinect 2/hd
/image_color_rect、親測定が利用可能です.
新しいターミナル
$ roscore
新しいターミナル
$ roslaunch kinect2_bridge kinect2_bridge.Launch新端末
$ rostopic list
/kinect2/bond /kinect2/hd/camera_info /kinect2/hd/image_color /kinect2/hd/image_color/compressed /kinect2/hd/image_color_rect /kinect2/hd/image_color_rect/compressed /kinect2/hd/image_depth_rect /kinect2/hd/image_depth_rect/compressed /kinect2/hd/image_mono /kinect2/hd/image_mono/compressed /kinect2/hd/image_mono_rect /kinect2/hd/image_mono_rect/compressed /kinect2/hd/points /kinect2/qhd/camera_info /kinect2/qhd/image_color /kinect2/qhd/image_color/compressed /kinect2/qhd/image_color_rect /kinect2/qhd/image_color_rect/compressed /kinect2/qhd/image_depth_rect /kinect2/qhd/image_depth_rect/compressed /kinect2/qhd/image_mono /kinect2/qhd/image_mono/compressed /kinect2/qhd/image_mono_rect /kinect2/qhd/image_mono_rect/compressed /kinect2/qhd/points /kinect2/sd/camera_info /kinect2/sd/image_color_rect /kinect2/sd/image_color_rect/compressed /kinect2/sd/image_depth /kinect2/sd/image_depth/compressed /kinect2/sd/image_depth_rect /kinect2/sd/image_depth_rect/compressed /kinect2/sd/image_ir /kinect2/sd/image_ir/compressed /kinect2/sd/image_ir_rect /kinect2/sd/image_ir_rect/compressed /kinect2/sd/points /rosout /rosout_agg
3、ORBの再コンパイルSLAM2
chmod +x build_ros.sh
./build_ros.sh 4、kinect v 2キャリブレーションパラメータTUM 1を変更する.yaml
%YAML:1.0

#--------------------------------------------------------------------------------------------
# Camera Parameters. Adjust them!
#--------------------------------------------------------------------------------------------

# Camera calibration and distortion parameters (OpenCV)
Camera.fx: 1.0467288481412274e+03
Camera.fy: 1.0481754542172425e+03
Camera.cx: 9.7306718807504012e+02
Camera.cy: 5.4801789979871785e+02

Camera.k1: 3.2019593488579724e-02
Camera.k2: -1.3038285760250972e-02
Camera.p1: 1.1981018792870713e-03
Camera.p2: -1.4350146086688656e-03
Camera.k3: -3.2574074881408052e-02

Camera.width: 1920
Camera.height: 1080

# Camera frames per second
Camera.fps: 30.0

# IR projector baseline times fx (aprox.)
Camera.bf: 40.0

# 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   yuanlai de shi 5000
DepthMapFactor: 1000.0

#--------------------------------------------------------------------------------------------
# ORB Parameters
#--------------------------------------------------------------------------------------------

# ORB Extractor: Number of features per image
ORBextractor.nFeatures: 1000

# ORB Extractor: Scale factor between levels in the scale pyramid     
ORBextractor.scaleFactor: 1.2

# ORB Extractor: Number of levels in the scale pyramid    
ORBextractor.nLevels: 8

# ORB Extractor: Fast threshold
# Image is divided in a grid. At each cell FAST are extracted imposing a minimum response.
# Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST
# You can lower these values if your images have low contrast            
ORBextractor.iniThFAST: 20
ORBextractor.minThFAST: 7

#--------------------------------------------------------------------------------------------
# Viewer Parameters
#--------------------------------------------------------------------------------------------
Viewer.KeyFrameSize: 0.05
Viewer.KeyFrameLineWidth: 1
Viewer.GraphLineWidth: 0.9
Viewer.PointSize:2
Viewer.CameraSize: 0.08
Viewer.CameraLineWidth: 3
Viewer.ViewpointX: 0
Viewer.ViewpointY: -0.7
Viewer.ViewpointZ: -1.8
Viewer.ViewpointF: 500

6、ORB_SLAM 2/Examples/ROS$ディレクトリ実行
rosrun ORB_SLAM2 RGBD/home/×××/ORB_SLAM2
/Vocabulary/ORBvoc.txt/home/×××/ORB_SLAM2/Examples
/RGB-D/TUM1.yaml
ここまで来ると、出力結果が見えてきます.