我用的是ubuntu14.04LTS,ROS 版本是indigo,kinect v2,我是用雙系統裝的ubuntu,關於怎么使用安裝kinect2的安裝以及使用的都在github上有着詳細的說明
Kinect2 開源驅動:libfreenect2
kinect2--> ros的bridge:iai_kinect2
sudo apt-get install build-essential cmake pkg-config libturbojpeg libjpeg-turbo8-dev mesa-common-dev freeglut3-dev libxrandr-dev libxi-dev
Bus 002 Device 002: ID 045e:02d9 Microsoft Corp. 就說明連上了。
接下來可以測試了。
新打開一個終端,運行
roslaunch kinect2_bridge kinect2_bridge.launch
獲取Kinect數據
再新打開一個終端,運行
rosrun kinect2_viewer kinect2_viewer
就可以正常顯示圖像了
一般在使用前 ,我們都會矯正,就是所謂的計算相機的內外參數,一般使用的方法都是張正友標定法的理論,理論知識就不在贅述,其實當時看都是能看懂的一旦讓自己完全從頭推理就懵逼了
首先呢我們的矯正步驟就是,我們得有標定模板,這如果你之前下載了iai_kinect2在kinect2_calibration文件下是有標定模板的 你可以隨意打印一個模板等着后期的標定使用
那么我就按照github的教程教你如果去矯正kinect2 以下 就是github給出的具體的步驟,對於其中的參數我們一般按照要求給就OK了,對於kienct 2的標定並不需要說把紅外發射器給遮住 然后使用紅外LED去矯正的,這是針對kinect1的,之前我矯正過kinect1 確實是需要把紅外發射裝置給遮住,然后才能矯正深度信息,
Detailed steps:
- If you haven't already, start the kinect2_bridge with a low number of frames per second (to make it easy on your CPU):
rosrun kinect2_bridge kinect2_bridge _fps_limit:=2 (這一步就是要啟動ROS的kienct 2的驅動貨都kienct2的原始數據)
- create a directory for your calibration data files, for example:
mkdir ~/kinect_cal_data; cd ~/kinect_cal_data(這是為了創建一個文件,存儲我們用於矯正的照片)
- Record images for the color camera:
rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record color (這命令就是開始矯正深度相機的RGB相機,對於后面的參數我們可以知道
chess5x7x0.03(是棋盤的大小 可以用尺子量一下的) record(記錄保存下下) color
) - Calibrate the intrinsics:
rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate color
- Record images for the ir camera:
rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record ir
- Calibrate the intrinsics of the ir camera:
rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate ir
- Record images on both cameras synchronized:
rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record sync
- Calibrate the extrinsics:
rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate sync
- Calibrate the depth measurements:
rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate depth
- Find out the serial number of your kinect2 by looking at the first lines printed out by the kinect2_bridge. The line looks like this:
device serial: 012526541941
- Create the calibration results directory in kinect2_bridge/data/$serial:
roscd kinect2_bridge/data; mkdir 012526541941
- Copy the following files from your calibration directory (~/kinect_cal_data) into the directory you just created:
calib_color.yaml calib_depth.yaml calib_ir.yaml calib_pose.yaml
- Restart the kinect2_bridge and be amazed at the better data.
還要好多就不在寫了
通常遇到最多的就是這種問題,但是這個問題並不影響我們的矯正
[ERROR] Tried to advertise a service that is already advertised in this node [/kinect2_calib_1458721837266890808/compressed/set_parameters]
[ERROR] Tried to advertise a service that is already advertised in this node [/kinect2_calib_1458721837266890808/compressed/set_parameters]
真正影響我們的是我們輸入的參數 比如ROS的開發包給例子是使用棋盤格6*8的棋盤,正方形的邊長為0.03米 但是我們的棋盤可能並並不是那么小的,這時候要使用我們的
棋盤的話就要注意給的參數了。比如用的是長有9個,款有7個正方形的標定棋盤,這時候我們的參數是6*8*0.05,參數一定要給准確,不然會出現錯誤的 啊、
而且就是在同一個文件下使用命令,