文章目录
运行环境:
ubuntu18.04.6 melodic
opencv 3.4.16
python 2.7.17 (ros自带)
usb-cam
速腾robosense 16
1.1 ROS环境配置
官方Github: https://github.com/acfr/cam_lidar_calibration
rs_to_velodyne :https://github.com/HViktorTsoi/rs_to_velodyne
1)工作空间创建和编译
# 创建工作空间
mkdir -p calib_new_ws/src
cd calib_new_ws/src
# 克隆仓库
git clone -c http.sslverify=false https://gitlab.acfr.usyd.edu.au/its/cam_lidar_calibration.git
# 下载ros和python依赖
sudo apt update && sudo apt-get install -y ros-noetic-pcl-conversions ros-noetic-pcl-ros ros-noetic-tf2-sensor-msgs
pip install pandas scipy
# 编译
cd calib_new_ws
catkin_make
2)官方数据集测试环境
①开始标定
source ./devel/setup.bash
roslaunch cam_lidar_calibration run_optimiser.launch import_samples:=true
标定好的文件保存在 cam_lidar_calibration/data/vlp/路径下
②评估标定结果
roslaunch cam_lidar_calibration assess_results.launch csv:="$(rospack find cam_lidar_calibration)/data/vlp/calibration_quickstart.csv" visualise:=true
2.1 在线标定
1)数据类型
激光雷达点云类型为XYZIR
雷达话题数据类型 sensor_msgs::PointCloud2
相机话题数据类型 sensor_msgs::Image、sensor_msgs::CameraInfo
rostopic list
rostopic type /velodyne_points
rostopic type /usb_cam/image_raw
rostopic type /usb_cam/camera_info
# 启动相机
# 启动雷达
# 速腾转rs
rosrun rs_to_velodyne rs_to_velodyne XYZIRT XYZIR
标定好的文件保存在cam_lidar_calibration/data路径下
2)标定板制作
标定板打印路径
我们标定板大小:图3—A1(841 x 594mm), 小方格边长 95mm ,内部顶点 7x5
标定注意事项:标定板摆放与地面成45°角
3)配置文件
设置params.yaml中的话题和棋盘格大小(参考标定板制作内容)
# 速腾RS16 + usb_cam
camera_topic: "/usb_cam/image_raw"
camera_info: "/usb_cam/camera_info"
# rs 话题
# lidar_topic: "/rslidar_points"
# rs_to_velodyne 话题
lidar_topic: "/velodyne_points"
4)开始标定
偏移量设置(减少平均误差) distance_offset_mm=-30
①启动标定包
roslaunch cam_lidar_calibration run_optimiser.launch import_samples:=false
②调整 rqt_reconfigure 中的 x、y 、 z 分离出棋盘点云, 分离好一张点Capture, 有问题的点discard。分离好20张左右点Optimise。
标定注意事项:对于 VLP-16,至少保证7条线打在标定板上
②获取标定结果
# 官方
roslaunch cam_lidar_calibration assess_results.launch csv:="$(rospack find cam_lidar_calibration)/data/vlp/calibration_quickstart.csv" visualise:=true
# 自己目录下的
roslaunch cam_lidar_calibration assess_results.launch csv:="$(rospack find cam_lidar_calibration)/data/2023-06-27_11-46-29/calibration_2023-06-27_11-56-14.csv" visualise:=true
5)完整实现步骤
详细操作见博客:
Robosense激光雷达Linux配置
usb_cam 相机ROS配置
usb_cam相机标定实践 ROS
1.启动相机
cd /home/duduzai/SPbot/usb_cam_ws
source ./devel/setup.bash
roslaunch usb_cam usb_cam.launch
2.启动雷达(注释雷达launch中的rviz)
cd /home/duduzai/SPbot/robosense_ws
source ./devel/setup.bash
roslaunch rslidar_sdk start.launch
3.rs to velodyne
cd source ./devel/setup.bash
source ./devel/setup.bash
rosrun rs_to_velodyne rs_to_velodyne XYZIRT XYZIR
4、标定
cd /home/duduzai/SPbot/calib_new_ws
source ./devel/setup.bash
roslaunch cam_lidar_calibration run_optimiser.launch import_samples:=false
roslaunch cam_lidar_calibration assess_results.launch csv:="$(rospack find cam_lidar_calibration)/data/vlp/calibration_2023-04-20_17-23-44.csv" visualise:=true
3.1 python版本选择
3.2 rviz参数修改
Panels:
- Class: rviz/Displays
Help Height: 0
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /Image1
- /Image2
- /MarkerArray1
Splitter Ratio: 0.5
Tree Height: 366
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: Image
- Class: cam_lidar_calibration/CamLidarCalibration
Name: CamLidarCalibration
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
# Plane Cell Count: 10
Plane Cell Count: 50
Reference Frame: <Fixed Frame>
Value: true
- Class: rviz/Image
Enabled: true
Image Topic: /gmsl/A0/image_color
Max Value: 1
Median window: 5
Min Value: 0
Name: Image
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
- Class: rviz/Image
Enabled: true
# Image Topic: /camera_features
Image Topic: /usb_cam/image_raw
Max Value: 1
Median window: 5
Min Value: 0
Name: Image
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/PointCloud2
Color: 255; 255; 255
Color Transformer: Intensity
Decay Time: 0
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
# Max Intensity: 217
Max Intensity: 155
Min Color: 0; 0; 0
Min Intensity: 1
Name: Experimental Region
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 3
# Size (m): 0.009999999776482582
Size (m): 0.01
Style: Flat Squares
Topic: /feature_extraction/experimental_region
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/PointCloud2
Color: 255; 255; 255
Color Transformer: Intensity
Decay Time: 0
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Max Intensity: 60
Min Color: 0; 0; 0
Min Intensity: 1
Name: Chessboard
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 3
Size (m): 0.009999999776482582
Style: Flat Squares
Topic: /feature_extraction/chessboard
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
- Class: rviz/MarkerArray
Enabled: true
Marker Topic: /feature_extraction/collected_samples
Name: MarkerArray
Namespaces:
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 7.726625442504883
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
X: 2.3772096633911133
Y: -1.2373826503753662
Z: 1.9428495168685913
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.6603978276252747
Target Frame: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 2.71859073638916
Saved: ~
Window Geometry:
CamLidarCalibration:
collapsed: false
Displays:
collapsed: false
Height: 1075
Hide Left Dock: false
Hide Right Dock: true
Image:
collapsed: false
QMainWindow State: 000000ff00000000fd00000004000000000000016a00000391fc020000000cfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073000000003d000001ab000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d006100670065010000003d000001660000001600fffffffb0000000a0049006d00610067006501000001a90000016d0000001600fffffffb0000000a0049006d0061006700650100000172000001400000000000000000fb0000002600430061006d004c006900640061007200430061006c006900620072006100740069006f006e010000031c000000b2000000a300ffffff000000010000010f00000315fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d00000315000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000078000000042fc0100000002fb0000000800540069006d0065010000000000000780000002eb00fffffffb0000000800540069006d00650100000000000004500000000000000000000006100000039100000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: true
Width: 1920
X: 1920
Y: 201 Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
# Fixed Frame: velodyne_front_link
# Fixed Frame: rslidar
Fixed Frame: velodyne
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 7.726625442504883
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
X: 2.3772096633911133
Y: -1.2373826503753662
Z: 1.9428495168685913
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.6603978276252747
Target Frame: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 2.71859073638916
Saved: ~
Window Geometry:
CamLidarCalibration:
collapsed: false
Displays:
collapsed: false
Height: 1075
Hide Left Dock: false
Hide Right Dock: true
Image:
collapsed: false
QMainWindow State: 000000ff00000000fd00000004000000000000016a00000391fc020000000cfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073000000003d000001ab000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d006100670065010000003d000001660000001600fffffffb0000000a0049006d00610067006501000001a90000016d0000001600fffffffb0000000a0049006d0061006700650100000172000001400000000000000000fb0000002600430061006d004c006900640061007200430061006c006900620072006100740069006f006e010000031c000000b2000000a300ffffff000000010000010f00000315fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d00000315000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000078000000042fc0100000002fb0000000800540069006d0065010000000000000780000002eb00fffffffb0000000800540069006d00650100000000000004500000000000000000000006100000039100000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: true
Width: 1920
X: 1920
Y: 201