-
Notifications
You must be signed in to change notification settings - Fork 0
/
reaslsense.txt
executable file
·142 lines (123 loc) · 4.81 KB
/
reaslsense.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# realsence安装及标定
## 01 源码安装
```
git clone https://github.com/IntelRealSense/librealsense
cd librealsense
sudo apt-get install libudev-dev pkg-config libgtk-3-dev
sudo apt-get install libusb-1.0-0-dev pkg-config
sudo apt-get install libglfw3-dev
sudo apt-get install libssl-dev
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger
################
如果错误:sudo service udev restart
若果在容器:注释了/etc/init.d/udev中的下面内容
#if [ ! -w /sys ]; then
# log_warning_msg "udev does not support containers, not started"
# exit 0
#fi
###################
mkdir build
cd build
cmake ../ -DBUILD_EXAMPLES=true
make
sudo make install
```
注意L515接入USB3.0端口
进入librealsense/build/examples/capture,测试效果:
`./rs-capture`
或直接使用realsense-viewer工具查看效果:
`realsense-viewer`
## 02 安装RealSense-Ros
```
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`
git clone https://github.com/pal-robotics/ddynamic_reconfigure.git
cd ..
catkin_init_workspace
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
```
note:
rs_camera.launch中添加
```
<rosparam>
/camera/motion_module/global_time_enabled: true
/camera/l500_depth_sensor/global_time_enabled: true
/camera/rgb_camera/global_time_enabled: true
</rosparam>
```
取消开启rviz的warning
使用rviz可视化,注意L515接入USB3.0端口
新打开一个终端2,通过ros节点启动
`roslaunch realsense2_camera rs_camera.launch`
新打开一个终端3,运行rviz,实现点云可视化`rviz`
可根据应用需求修改launch文件;
`rostopic list` 指令查看当前所有的主题,启动前启动后对比,得出输出topic;
```
/camera/color/camera_info
/camera/color/image_raw
/camera/color/image_raw/compressed
/camera/color/image_raw/compressed/parameter_descriptions
/camera/color/image_raw/compressed/parameter_updates
/camera/color/image_raw/compressedDepth
/camera/color/image_raw/compressedDepth/parameter_descriptions
/camera/color/image_raw/compressedDepth/parameter_updates
/camera/color/image_raw/theora
/camera/color/image_raw/theora/parameter_descriptions
/camera/color/image_raw/theora/parameter_updates
/camera/color/metadata
/camera/depth/camera_info
/camera/depth/image_rect_raw
/camera/depth/image_rect_raw/compressed
/camera/depth/image_rect_raw/compressed/parameter_descriptions
/camera/depth/image_rect_raw/compressed/parameter_updates
/camera/depth/image_rect_raw/compressedDepth
/camera/depth/image_rect_raw/compressedDepth/parameter_descriptions
/camera/depth/image_rect_raw/compressedDepth/parameter_updates
/camera/depth/image_rect_raw/theora
/camera/depth/image_rect_raw/theora/parameter_descriptions
/camera/depth/image_rect_raw/theora/parameter_updates
/camera/depth/metadata
/camera/extrinsics/depth_to_color
/camera/l500_depth_sensor/parameter_descriptions
/camera/l500_depth_sensor/parameter_updates
/camera/motion_module/parameter_descriptions
/camera/motion_module/parameter_updates
/camera/realsense2_camera_manager/bond
/camera/rgb_camera/parameter_descriptions
/camera/rgb_camera/parameter_updates
/clicked_point
/diagnostics
/initialpose
/move_base_simple/goal
/rosout
/rosout_agg
/tf
/tf_static
```
rosbag record 指令录制指定topic的bag包,实现点云数据保存。
## 03 标定
常见的标定板有:aprilgrid、checkerboard、circlegrid
开启相机
```
roslaunch realsense2_camera rs_camera.launch
//使用12*9棋盘格
rosrun camera_calibration cameracalibrator.py --size 11x8 --square 0.03 image:=/camera/color/image_raw camera:=/camera/color --no-service-check
```
标定结果中camera matrix为相机内参矩阵;distortion为畸变系数矩阵;rectification为矫正矩阵,一般为单位矩阵;projection为外部世界坐标系到像平面的投影矩阵。
使用kalibar进行标定
```
sudo apt-get install python3-setuptools python3-rosinstall ipython3 libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-noetic-vision-opencv ros-noetic-image-transport-plugins ros-noetic-cmake-modules python-software-properties software-properties-common libpoco-dev python-matplotlib python3-scipy python3-git python3-pip libtbb-dev libblas-dev liblapack-dev python3-catkin-tools libv4l-dev
sudo pip install python-igraph
```
sudo apt-get install -y python3-dev python-pip python-scipy \
python-matplotlib ipython python-wxgtk4.0 python-tk python-igraph
rosrun kalibr kalibr_calibrate_cameras --bag /home/hao007/camera_calib.bag --topics /camera/color/image_raw --models pinhole-radtan --target /home/hao007/aprilgrid.yaml