相机ros驱动安装
ubuntu20.08下获取realsense内参(使用ros功能包)_realsense相机内参-CSDN博客
开发板官方教程:librealsense/doc/installation_jetson.md at master · IntelRealSense/librealsense (github.com)
安装SDK:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
sudo apt-get install librealsense2-utils
sudo apt-get install librealsense2-dev
realsense-viewer
安装ROS驱动:
sudo apt-get install ros-noetic-realsense2-camera #根据ROS版本
roslaunch realsense2_camera rs_camera.launch
有错误找不到设备:
[ WARN] [1716382129.885615524]: Device 1/1 failed with exception: failed to set power state [ERROR] [1716382129.886739950]: The requested device with is NOT found. Will Try again.realsense failed to open usb interface: 0, error: RS2_USB_STATUS_NO_DEVICE 错误解决方法_realsense2: eth0: does not match an available inte-CSDN博客
检查目录/etc/udev/rules.d/
下是否有99-realsense-libusb.rules
如果有,需要修改内容。
如果没有,则需要创建规则文件99-realsense-libusb.rules,
自己创建文件然后复制过去:
cp /path/to/source/file /path/to/destination/folder
到此ROS安装完成,相机能正常launch.
相机内参标定
d435i相机内参标定(项目上无法直接使用,记录一下)_d435i怎么查看相机内参-CSDN博客
roslaunch realsense2_camera rs_camera.launch
rosrun camera_calibration cameracalibrator.py --size 8x5 --square 0.027 image:=/camera/color/image_raw camera:=/camera --no-service-check
第一步打开摄像头
第二步检查摄像头话题是否正确发布
第三步打开标定launch文件,进行标定,如果能正常打开标定界面但是没有开始标定,检查是不是参数错误,那个n*n指的是方块角点数不是棋盘格数。
标定
1.录制bag包
rosbag record /topic1 /topic2 -o xxx.bag
rosbag play xxx.bag
2.转为图像
参数分别为:影像的topic、文件名(%04i
是指4位数的数字)、文件的编码 32FC1
和bgr8
rosrun image_view image_saver image:=/topic _filename_format:="%04i.png" _encoding:=bgr8
3.点云转为pcd
使用 pcl_ros bag_to_pcd
参数分别为:rosbag的位置、激光雷达topic、保存到哪个文件夹
rosrun pcl_ros bag_to_pcd ~/Documents/daolu.bag /airsim_node/drone_1/lidar/LidarCustom /home/room401/Documents/pcd/
标定好相机内参:
[ 640x480 p[330.872 251.332] f[605.966 605.809] Inverse Brown Conrady [0 0 0 0 0] ]
标定好相机进行openclib相机雷达联合标定:
openclib安装方法:
1.根据博客配好环境ubuntu18.04安装opencalib手动标定并使用自己的数据-CSDN博客
2.SensorsCalibration/lidar2camera at master · PJLab-ADG/SensorsCalibration (github.com)复制代码到工作空间,单包编译
使用步骤:
1.进入mix文件夹source
2.cd到manul_clib 运行标定代码
如果报错libpango_windowing.so: cannot open shared object file: No such file or directory,sudo ldconfig.;
sudo ldconfig
./bin/run_lidar2camera data/0.png data/0.pcd data/center_camera-intrinsic.json data/top_center_lidar-to-center_camera-extrinsic.json
运行上述代码进行标定,记得调整雷达点大小颜色,不断调整角度找到对应的。
标定好外参如下 :
Final Transfromation Matrix:
0.999068 -0.0347268 -0.0211534 0.0552364
-0.0289161 -0.0132298 -0.999494 -0.0782484
0.0219442 0.999813 -0.0138708 0.420575
0 0 0 1
融合
标定好后,融合代码安装成功后
1.修改cfg文件 把话题,相机参数修改好
2.修改参数文件
3.在RVIZ中看可视化图片时,记得选image(选camera会不出图片)