赞
踩
前言介绍:
ros中 realsense的坐标系,根据官网介绍:
https://github.com/IntelRealSense/realsense-ros
在ros中相机的坐标系和相机光学成像坐标系是不一样的,在标定时要先考虑清楚自己要的哪个。
标定前需要安装realsense-ros
需要安装两个文件:
librealsense(官方sdk)
librealsense-ros(基于sdk打包成ros的包)
(官方sdk)
# 下载安装包 git clone https://github.com/IntelRealSense/librealsense.git cd librealsense # 更新依赖库 sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade # 安装依赖库 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 # 运行Intel Realsense许可脚本 ./scripts/setup_udev_rules.sh # 下载并编译内核模块 ./scripts/patch-realsense-ubuntu-lts.sh # 编译SDK2.0 cd librealsense mkdir build cd build cmake ../ -DBUILD_EXAMPLES=true make sudo make install # 测试 cd examples/capture ./rs-capture # 打开realsense-viewer realsense-viewer
安装Realsense ROS
# 建立workspace mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src/ catkin_init_workspace cd .. catkin_make echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc # 在catkin_ws/src/下载源程序 cd src git clone https://github.com/IntelRealSense/realsense-ros.git git clone https://github.com/pal-robotics/ddynamic_reconfigure.git # catkin_make编译 cd ~/catkin_ws && catkin_make # 测试 roslaunch realsense2_camera demo_pointcloud.launch # 其他测试 ## 查看发布的topic rostopic list ## 查看相机内参 # 方法一 rostopic echo /camera/color/camera_info rostopic echo /camera/aligned_depth_to_color/camera_info 注:aligned_depth_to_color是指已经将深度信息通过相机到RGBD的外参映射到彩色图像上 # 方法二 rs-sensor-control
原文链接:https://blog.csdn.net/qq_36722887/article/details/126643886
1、easy_handeye安装
# 创建catkin_workspace mkdir calibration_catkin_workspace cd calibration_catkin_workspace mkdir src cd src # 下载机械臂驱动 git clone https://github.com/UniversalRobots/Universal_Robots_ROS_Driver.git Universal_Robots_ROS_Driver git clone -b calibration_devel https://github.com/fmauch/universal_robot.git fmauch_universal_robot # aruco git clone -b noetic-devel https://github.com/pal-robotics/aruco_ros.git # vision_visp git clone -b noetic-devel https://github.com/lagadic/vision_visp.git # easy_hand_eye git clone https://github.com/IFL-CAMP/easy_handeye # 下载依赖 cd .. sudo apt update rosdep update rosdep install --from-paths src --ignore-src -y # empy pip install empy # pyqt pip install PyQt5 # 编译 catkin_make # 切换环境 source ./devel/setup.bash
2. launch 文件配置
标定过程需启动 ur5 机械臂的相关节点,realsense 节点,aruco 节点,easy_handeye 节点,可以写一个 launch 文件同时启动上述节点,也可以分别启动。easy_handeye 包中给出了用一个 launch 文件实现的示例,在如下的目录中:xxx/catkin_ws/src/easy_handeye/easy_handeye/launch/eye_to_hand_calibration1.launch
由于我用的是眼在手外的标定,并且是ur5,因此选择eye_to_hand_calibration1.launch
官网的launch文件在这里,也可以基于这个修改
下面是我修改的launch文件,期间参考里许多网上的教程,但是都不合适,最后终于找到里适合自己的launch
<launch> <arg name="namespace_prefix" default="ur5_realsense_handeyecalibration" /> <arg name="robot_ip" doc="The IP address of the UR5 robot" /> <arg name="marker_size" doc="Size of the ArUco marker used, in meters" default="0.1" /> <arg name="marker_id" doc="The ID of the ArUco marker used" default="123"/> <!-- start the realsen435 --> <include file="$(find realsense2_camera)/launch/rs_camera.launch" > <!-- <arg name="depth_registration" value="true" /> --> </include> <!-- 2. start ArUco --> <node name="aruco_tracker" pkg="aruco_ros" type="single"> <remap from="/camera_info" to="/camera/color/camera_info" /> <remap from="/image" to="/camera/color/image_raw" /> <param name="image_is_rectified" value="true"/> <param name="marker_size" value="$(arg marker_size)"/> <param name="marker_id" value="$(arg marker_id)"/> <param name="reference_frame" value="camera_color_optical_frame"/> <param name="camera_frame" value="camera_color_optical_frame"/> ##这里需要强调,虽然这个参数的具体功能我没弄清楚,但是许多教程都把这里修改里,例如修改为camera_color_frame,默认为camera_color_optical_frame,经过实际测试不需要修改,至于原因可以参考前言关于坐标系的描述。 <param name="marker_frame" value="camera_marker" /> </node> <!-- start the robot --> <include file="$(find ur_robot_driver)/launch/ur5_bringup.launch"> <arg name="robot_ip" value="192.168.1.117" /> </include> <include file="$(find ur5_moveit_config)/launch/ur5_moveit_planning_execution.launch"> </include> <!-- 4. start easy_handeye --> <include file="$(find easy_handeye)/launch/calibrate.launch" > <arg name="namespace_prefix" value="$(arg namespace_prefix)" /> <arg name="eye_on_hand" value="false" /> <arg name="tracking_base_frame" value="camera_color_frame" /> <arg name="tracking_marker_frame" value="camera_marker" /> <arg name="robot_base_frame" value="base" /> #在这里, <arg name="tracking_base_frame" value="camera_color_optical_frame" /> #<arg name="tracking_marker_frame" value="board" /> # <arg name="robot_base_frame" value="base_link" /> #<arg name="robot_effector_frame" value="tool0" /> 可以看到源文件设置为这个,根据自己的实际需要进行修改,目前我标定的是base与camera_color_frame之间的。经过实际测试,base坐标系符合物理机器人实际的base,至于base_link我也不清楚为什么这么设置, 有明白小伙伴可以给解释一下。至于camera_color_frame也是ros坐标系下彩色相机的坐标系, 我个人感觉应该在实际应用的时候应该考虑的是相机光学坐标系camera_color_optical_frame与base之间的坐标转换矩阵,但是还没有进行到这一步,所以还有待考虑。 <arg name="robot_effector_frame" value="wrist_3_link" /> <arg name="freehand_robot_movement" value="false" /> <arg name="robot_velocity_scaling" value="0.5" /> <arg name="robot_acceleration_scaling" value="0.2" /> </include> </launch>
注意:
眼在手外:value 为 false
tracking_base_frame 为相机坐标系 camera_color_frame
robot_base_frame 为机器人基座坐标系,示例里写的是 base_link,我在 rviz 中查看 base 才是真实的基座坐标系。
3.1. 启动 launch 文件
roslaunch easy_handeye ur5_realsense_handeyecalibration1.launch
roslaunch easy_handeye eye_to_hand_calibration1.launch#应该被我改成这个名字了
2.在rviz中添加image,topic选择result方便观察标定板位置
3.手动调节机械臂,使 aruco 二维码移动至相机视野中心处附近,作为 home config。
在界面 3 中,点击 check starting pose,若检查成功,界面会出现: 0/17,ready to start
4.界面 3 中依次点击 Next Pose,Plan,Execute,机械臂会移动至新的位置,若二维码在相机视野范围内,且能检测成功,则进行下一步
5.界面 2 中点击 Take Sample,若 Samples 对话框中出现有效信息,说明第一个点标定成功
6.重复执行步骤 2 和步骤 3,直至 17 个点全部标定完毕
7.界面 2 中点击 Compute,则 Result 对话框中会出现结果
8.界面 2 中 Save,会将结果保存为一个 YAML 文件,路径为 ~/.ros/easy_handeye
https://blog.csdn.net/weixin_43735353/article/details/106128655
2.3 发布tf验证
easy_handeye 功能包提供了 publish.launch 文件,可以将标定好的 TF 发布出
注:要修改 “namespace_prefix” 参数,与眼在手外标定 launch 文件中的 “namespace_prefix” 一致,这样才能找到标定好的 YAML 文件,并且同样修改eye_on_hand为True
原文链接:https://blog.csdn.net/a17381562089/article/details/119546155
我没有使用这个方法。而是在/realsense_ws/src/realsense-ros/realsense2_camera/launch、demo_pointcloud.launch
的基础上添加了:
<node pkg="tf" type="static_transform_publisher" name="ur5_broadcaster" args="-0.8583407000885981 -0.7772945386894723 0.5265763229921994 -0.165891645862763 0.2564254303246922 0.4581886677250204 0.8347389443916647 base camera_link 100" />
完整的launch文件:
<launch> <!-- start the robot --> <include file="$(find ur_robot_driver)/launch/ur5_bringup.launch"> <arg name="robot_ip" value="192.168.1.117" /> </include> <include file="$(find ur5_moveit_config)/launch/ur5_moveit_planning_execution.launch"> </include> <include file="$(find ur5_moveit_config)/launch/moveit_rviz.launch"> </include> <arg name="serial_no" default=""/> <arg name="json_file_path" default=""/> <arg name="camera" default="camera"/> <group ns="$(arg camera)"> <include file="$(find realsense2_camera)/launch/includes/nodelet.launch.xml"> <arg name="serial_no" value="$(arg serial_no)"/> <arg name="json_file_path" value="$(arg json_file_path)"/> <arg name="depth_width" value="640"/> <arg name="depth_height" value="480"/> <arg name="depth_fps" value="30"/> <arg name="color_width" value="640"/> <arg name="color_height" value="480"/> <arg name="color_fps" value="30"/> <arg name="enable_depth" value="true"/> <arg name="enable_color" value="true"/> <arg name="enable_infra1" value="false"/> <arg name="enable_infra2" value="false"/> <arg name="enable_fisheye" value="false"/> <arg name="enable_gyro" value="false"/> <arg name="enable_accel" value="false"/> <arg name="enable_pointcloud" value="true"/> <arg name="enable_sync" value="true"/> <arg name="tf_prefix" value="$(arg camera)"/> </include> <node pkg="tf" type="static_transform_publisher" name="ur5_broadcaster" args="-0.8583407000885981 -0.7772945386894723 0.5265763229921994 -0.165891645862763 0.2564254303246922 0.4581886677250204 0.8347389443916647 base camera_link 100" /> </group> </launch>
camera_link我没有标定,前文提到的我标定的camera_color_frame,但是我想测试点云的话用这个不行,所以改为了camera_link,实际上camera_link应该和depth_frame重合,在这里仅做测试。
将矩阵输入到 tf static_transform_publisher中发布。xyz,xyzw
实际效果:
可以看到,只有optical_frame指向成像面才是正确的。
可以看到camera_color_frame的坐标系,x轴(红色轴)指向成像方向。
如果在这里的时候把camera_color_optical_frame改为了camera_color_frame,那么标定出来的坐标系就会出现camera_color_frame的z轴指向成像平面。
<!-- 2. start ArUco -->
<param name="reference_frame" value="camera_color_optical_frame"/>
<param name="camera_frame" value="camera_color_optical_frame"/>
2.启动标定程序
1.realsense相机启动
roslaunch realsense2_camera rs_camera.launch
1
2.启动机器人
roslaunch ur_robot_driver ur5_bringup.launch limited:=true robot_ip:=192.168.1.117
1
再打开一个终端
roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch limited:=true
1
3.启动标定程序
roslaunch easy_handeye hand_eye.launch
roslaunch easy_handeye ur5e_realsense_calibration.launch
1
4.再打开一个rviz终端,输入rqt
点击菜单栏的 Plugins -> Visulization -> Image View,选择 /aruco_tracker/result 话题。如果没有出现 aruco码,注意检查上文 中相机节点是否改变。
————————————————
版权声明:本文为CSDN博主「浪子陪都」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/lqsdddd/article/details/126544007
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。