UR5+ROS Kinetic+easy_handeye手眼标定教程(eye-to-hand)


1. 手眼标定类型

  • eye-to-hand 眼在手外
  • eye-in-hand 眼在手上

2. 标定算法

Tsai-Lenz:文献地址
opencv有该算法的具体实现。

3. 系统环境

  • Ubuntu 16.04
  • ROS Kinetic
  • Python 2.7
  • 深度摄像头奥比中光Astra Mini & IntelRealsense D435i(标定根据实际环境变换)

4. 标定流程

4.1 配置ROS环境

点击进入官方Kinetic版本配置教程

4.2 安装依赖

4.2.1 UR驱动选择

两者编译工具有区别,3.9及以下使用catkin_make,3.10及以上的使用catkin_make_isolated

UR机器人系统版本驱动选择
v e r s i o n ≤ 3.9 version \leq 3.9 version3.9ur_modern_driver
v e r s i o n ≥ 3.10 version \ge 3.10 version3.10ur_robot_driver
4.2.1.1 UR5机器人系统小于等于3.9版本

源码编译 ur5 & ur_modern_driver

cd ~/catkin_ws/src
git clone -b kinetic-devel https://github.com/ros-industrial/universal_robot.git
cd universal_robot
git clone -b kinetic-devel https://github.com/ros-industrial/ur_modern_driver.git

cd ~/catkin_ws
catkin_make
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc 
4.2.1.2 UR5机器人系统大于等于3.10版本
  • 一般安装
# source global ros
source /opt/ros/<your_ros_version>/setup.bash

# create a catkin workspace
mkdir -p catkin_ws/src && cd catkin_ws

# clone the driver
git clone https://github.com/UniversalRobots/Universal_Robots_ROS_Driver.git src/Universal_Robots_ROS_Driver

# clone fork of the description. This is currently necessary, until the changes are merged upstream.
git clone -b calibration_devel https://github.com/fmauch/universal_robot.git src/fmauch_universal_robot

# install dependencies
sudo apt update -qq
rosdep update
rosdep install --from-paths src --ignore-src -y

# build the workspace. We need an isolated build because of the non-catkin library package.
catkin_make

# activate the workspace (ie: source it)
source devel/setup.bash

提示CMake错误,请使用全源码编译

  • 全源码编译(All-source build)
source /opt/ros/<your_ros_version>/setup.bash
mkdir -p catkin_ws/src && cd catkin_ws
git clone -b boost https://github.com/UniversalRobots/Universal_Robots_Client_Library.git src/Universal_Robots_Client_Library
git clone https://github.com/UniversalRobots/Universal_Robots_ROS_Driver.git src/Universal_Robots_ROS_Driver
git clone -b calibration_devel https://github.com/fmauch/universal_robot.git src/fmauch_universal_robot
sudo apt update -qq
rosdep update
rosdep install --from-paths src --ignore-src -y
catkin_make_isolated
source devel_isolated/setup.bash

更多安装信息请到官方仓库查看Universal_Robots_ROS_Driver(ur_robot_driver

4.2.2 aruco_ros安装
cd ~/catkin_ws/src
git clone -b kinetic-devel https://github.com/pal-robotics/aruco_ros.git
cd ..
catkin_make
4.2.3 vision_visp / visp_hand2eye_calibration安装

该依赖请联网安装,否则编译时会提示404的情况

cd ~/catkin_ws/src
git clone -b kinetic-devel https://github.com/lagadic/vision_visp.git
cd ..
catkin_make --pkg visp_hand2eye_calibration
4.2.4 easy_handeye安装
cd ~/catkin_ws/src
git clone https://github.com/IFL-CAMP/easy_handeye
cd ..
catkin_make
4.2.5 摄像头驱动安装
4.2.5.1 奥比中光摄像头

官方仓库:https://github.com/orbbec/ros_astra_camera

# 1.安装依赖
sudo apt install ros-$ROS_DISTRO-rgbd-launch ros-$ROS_DISTRO-libuvc ros-$ROS_DISTRO-libuvc-camera ros-$ROS_DISTRO-libuvc-ros
# 2.clone仓库
cd ~/catkin_ws/src
git clone https://github.com/orbbec/ros_astra_camera
# 3.Create astra udev rule
roscd astra_camera
./scripts/create_udev_rules
# 4.编译
cd ~/catkin_ws
catkin_make --pkg astra_camera

启动指令

roslaunch astra_camera astra.launch
4.2.5.2 IntelRealsense摄像头

ROS+ubuntu 16.04配置IntelRealsense深度摄像头节点

4.3 打印ArUco marker

在线生成地址:https://chev.me/arucogen/

  • 选Original ArUco
  • marker id&size 根据自己实际情况选择
  • 点击open打印

在线生成aruco marker

4.4 编写配置文件

4.4.1 复制配置文件模板到launch目录
cd ~/catkin_ws/src/easy_handeye/docs/example_launch
cp ur5_kinect_calibration.launch ~/catkin_ws/src/easy_handeye/easy_handeye/launch/eye_to_hand_calibration.launch
4.4.2 修改配置文件
  • 打开启动文件
# 没GUI的用vim代替gedit
sudo gedit ~/catkin_ws/src/easy_handeye/easy_handeye/launch/eye_to_hand_calibration.launch
  • 修改内容
<launch>
    <arg name="namespace_prefix" default="ur5_kinect_handeyecalibration" />
    <arg name="robot_ip" doc="The IP address of the UR5 robot" />
    
	<!-- 修改这两个arg的default为第4.3节自己填写的id和尺寸 -->
    <arg name="marker_size" doc="Size of the ArUco marker used, in meters" default="0.05"/>
    <arg name="marker_id" doc="The ID of the ArUco marker used" default="570"/>

	<!-- 修改为自己相机依赖的启动文件 -->
    <include file="$(find astra_camera)/launch/astra.launch" >
    </include>

    <!-- start ArUco -->
    <node name="aruco_tracker" pkg="aruco_ros" type="single">
    	<!-- remap代表映射关系 -->
    	<!-- /camera_info映射到自己摄像头rgb节点的camera_info的topic -->
        <remap from="/camera_info" to="/camera/rgb/camera_info" />
        <!-- /image映射到自己摄像头rgb节点的image_raw(raw类型的图像输出topic)-->
        <remap from="/image" to="/camera/rgb/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)"/>
        <!-- reference_frame和camera_frame如何选择请其他教程1 -->
        <param name="reference_frame"    value="camera_rgb_optical_frame"/>
        <param name="camera_frame"       value="camera_rgb_optical_frame"/>
        <!-- 这里不用更改,填camera_marker就可以 -->
        <param name="marker_frame"       value="camera_marker" />
    </node>

    <!-- start the robot -->
    <!-- 3.9及以下写ur_modern_driver,3.10及以上写ur_robot_driver -->
    <include file="$(find ur_modern_driver)/launch/ur5_bringup.launch">
        <arg name="limited" value="true" />
        <!-- 填写机器人局域网ip地址 -->
        <arg name="robot_ip" value="193.169.10.50" />
    </include>
    <include file="$(find ur5_moveit_config)/launch/ur5_moveit_planning_execution.launch">
        <arg name="limited" value="true" />
    </include>

    <!-- 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" />

		<!-- value与上面camera_frame一致 -->
        <arg name="tracking_base_frame" value="camera_rgb_optical_frame" />
        <!-- 这里不用更改,填camera_marker就可以 -->
        <arg name="tracking_marker_frame" value="camera_marker" />
        <!-- robot_base_frame代表机械臂的基座对应的frame -->
        <arg name="robot_base_frame" value="base_link" />
        <!-- robot_effector_frame代表与ArUco码位置相对固定的关节所对应的frame -->
        <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>

TF1
图TF1
TF2
图TF2

4.5 开始标定

4.5.1 启动easy_handeye
roslaunch easy_handeye eye_to_hand_calibration.launch
4.5.2 启动成功会打开三个界面
  • 1.rviz能够看到机械臂位姿的仿真器页面
    界面1

  • 2.能够take sample采集图像的rqt界面
    界面2

  • 3.能够自动改变机械臂位姿的rqt界面
    界面3

如果第二个界面没有顶部菜单栏打不开plugins,请看此教程 - ROS系统easy_handeye手眼标定rqt_easy_handeye没有菜单栏无法打开aruco码位姿检测图像(plugins)的解决方法

4.5.3 标定流程

在image_view先检测/aruco_tracker/result topic返回的图像是否有返回ArUco marker的位姿

操作流程如下图所示:

开始
1.界面3点击Check starting pose
2.是否最后一个位姿?
3. 点击界面3Next Pose
7.界面2点击Compute,等待计算结果
8.界面2点击Save将齐次变换矩阵保存到本地
结束
4.界面3点击Plan
5.界面3点击Execute
6.界面2点击Take Sample

注意事项:

  • 界面3每次点击完都需要等待机械臂反馈
  • 如果image_view没有检测到ArUco marker请调整机械臂位姿

最终标定结果如下图所示,图片大于两张Tsai-Lenz算法就能求解。
结果为平移向量+四元数模式: x , y , z + q x , q y , q z , q w x, y, z + q_x, q_y, q_z, q_w x,y,z+qx,qy,qz,qw
结果

其他

1. 使用查看rgb图像的frame_id

在terminal输入rqt命令打开rqt界面,接入摄像头并启动,找到摄像头rgb节点raw图像的topic,打上勾,展开后查看header下面的frame_id填写到easy_handeye的配置文件的reference_frame和camera_frame的value上
rqt

2. 是否需要将摄像头内参数据文件存放到指定目录

不需要, 软件通过摄像头的camera_info节点获取摄像头内参。

3. easy-handeye IntelRealsense & UR3.10系统配置文件备份

<launch>
    <arg name="namespace_prefix" default="ur5_kinect_handeyecalibration" />
    <arg name="robot_ip" doc="The IP address of the UR5 robot" />
    
	<!-- 修改这两个arg的default为第4.3节自己填写的id和尺寸 -->
    <arg name="marker_size" doc="Size of the ArUco marker used, in meters" default="0.05"/>
    <arg name="marker_id" doc="The ID of the ArUco marker used" default="570"/>

	<!-- 修改为自己相机依赖的启动文件 -->
    <include file="$(find realsense2_camera)/launch/rs_camera.launch" >
    </include>

    <!-- start ArUco -->
    <node name="aruco_tracker" pkg="aruco_ros" type="single">
    	<!-- remap代表映射关系 -->
    	<!-- /camera_info映射到自己摄像头rgb节点的camera_info的topic -->
        <remap from="/camera_info" to="/camera/color/camera_info" />
        <!-- /image映射到自己摄像头rgb节点的image_raw(raw类型的图像输出topic)-->
        <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)"/>
        <!-- reference_frame和camera_frame如何选择请其他教程1 -->
        <param name="reference_frame"    value="camera_rgb_optical_frame"/>
        <param name="camera_frame"       value="camera_rgb_optical_frame"/>
        <!-- 这里不用更改,填camera_marker就可以 -->
        <param name="marker_frame"       value="camera_marker" />
    </node>

    <!-- start the robot -->
    <!-- 3.9及以下写ur_modern_driver,3.10及以上写ur_robot_driver -->
    <include file="$(find ur_robot_driver)/launch/ur5_bringup.launch">
        <arg name="limited" value="true" />
        <!-- 填写机器人局域网ip地址 -->
        <arg name="robot_ip" value="193.169.10.50" />
    </include>
    <include file="$(find ur5_moveit_config)/launch/ur5_moveit_planning_execution.launch">
        <arg name="limited" value="true" />
    </include>

    <!-- 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" />

		<!-- value与上面camera_frame一致 -->
        <arg name="tracking_base_frame" value="camera_rgb_optical_frame" />
        <!-- 这里不用更改,填camera_marker就可以 -->
        <arg name="tracking_marker_frame" value="camera_marker" />
        <!-- robot_base_frame代表机械臂的基座对应的frame -->
        <arg name="robot_base_frame" value="base_link" />
        <!-- robot_effector_frame代表与ArUco码位置相对固定的关节所对应的frame -->
        <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>
  • 6
    点赞
  • 83
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 24
    评论
Yolov5 ROS是指在ROS(机器人操作系统)上使用的Yolov5目标检测算法。为了使用Yolov5 ROS,您需要按照以下步骤进行安装和设置。 首先,您需要下载Yolov5 v6.2,而不推荐下载v5.0版本,因为这可能会导致多种库版本不匹配的报错。您可以从Yolov5的官方网站上获取最新版本。 接下来,您需要安装Yolov5所需的库。您可以通过终端进入Yolov5文件夹中的requirements.txt文件夹,并输入命令"pip install -r requirements.txt"来安装所需的库。 在安装过程中,请注意需要两次输入"yes"。第一次是在安装之前确认,第二次是在安装完成后进行配置环境时确认。如果不输入"yes",则默认使用默认配置环境。 最后,您需要在ROS中创建一个新的虚拟环境,使用以下命令"conda create -n yolov5 python=3.8"来创建一个名为yolov5的虚拟环境,并指定Python版本为3.8。 完成以上步骤后,您就可以在ROS上使用Yolov5进行目标检测了。请注意,在使用Yolov5 ROS之前,您还需要学习如何将Yolov5与ROS进行集成和配置相应的ROS节点。 希望以上信息对您有所帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [通过ROS调用yolo5](https://blog.csdn.net/qq_45695466/article/details/131424565)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 24
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Alex-Leung

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值