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

目录

    • 1. 手眼标定类型
    • 2. 标定算法
    • 3. 系统环境
    • 4. 标定流程
      • 4.1 配置ROS环境
      • 4.2 安装依赖
        • 4.2.1 UR驱动选择
          • 4.2.1.1 UR5机器人系统小于等于3.9版本
          • 4.2.1.2 UR5机器人系统大于等于3.10版本
        • 4.2.2 aruco_ros安装
        • 4.2.3 vision_visp / visp_hand2eye_calibration安装
        • 4.2.4 easy_handeye安装
        • 4.2.5 摄像头驱动安装
          • 4.2.5.1 奥比中光摄像头
          • 4.2.5.2 IntelRealsense摄像头
      • 4.3 打印ArUco marker
      • 4.4 编写配置文件
        • 4.4.1 复制配置文件模板到launch目录
        • 4.4.2 修改配置文件
      • 4.5 开始标定
        • 4.5.1 启动easy_handeye
        • 4.5.2 启动成功会打开三个界面
        • 4.5.3 标定流程
    • 其他
      • 1. 使用查看rgb图像的frame_id
      • 2. 是否需要将摄像头内参数据文件存放到指定目录
      • 3. easy-handeye IntelRealsense & UR3.10系统配置文件备份


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.9 ur_modern_driver
v e r s i o n ≥ 3.10 version \ge 3.10 version3.10 ur_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打印

UR5+ROS Kinetic+easy_handeye手眼标定教程(eye-to-hand)_第1张图片

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 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>

    
    <node name="aruco_tracker" pkg="aruco_ros" type="single">
    	
    	
        <remap from="/camera_info" to="/camera/rgb/camera_info" />
        
        <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)"/>
        
        <param name="reference_frame"    value="camera_rgb_optical_frame"/>
        <param name="camera_frame"       value="camera_rgb_optical_frame"/>
        
        <param name="marker_frame"       value="camera_marker" />
    node>

    
    
    <include file="$(find ur_modern_driver)/launch/ur5_bringup.launch">
        <arg name="limited" value="true" />
        
        <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>

    
    <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_rgb_optical_frame" />
        
        <arg name="tracking_marker_frame" value="camera_marker" />
        
        <arg name="robot_base_frame" value="base_link" />
        
        <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>

UR5+ROS Kinetic+easy_handeye手眼标定教程(eye-to-hand)_第2张图片
图TF1
UR5+ROS Kinetic+easy_handeye手眼标定教程(eye-to-hand)_第3张图片
图TF2

4.5 开始标定

4.5.1 启动easy_handeye

roslaunch easy_handeye eye_to_hand_calibration.launch

4.5.2 启动成功会打开三个界面

  • 1.rviz能够看到机械臂位姿的仿真器页面
    UR5+ROS Kinetic+easy_handeye手眼标定教程(eye-to-hand)_第4张图片

  • 2.能够take sample采集图像的rqt界面
    UR5+ROS Kinetic+easy_handeye手眼标定教程(eye-to-hand)_第5张图片

  • 3.能够自动改变机械臂位姿的rqt界面
    UR5+ROS Kinetic+easy_handeye手眼标定教程(eye-to-hand)_第6张图片

如果第二个界面没有顶部菜单栏打不开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
UR5+ROS Kinetic+easy_handeye手眼标定教程(eye-to-hand)_第7张图片

其他

1. 使用查看rgb图像的frame_id

在terminal输入rqt命令打开rqt界面,接入摄像头并启动,找到摄像头rgb节点raw图像的topic,打上勾,展开后查看header下面的frame_id填写到easy_handeye的配置文件的reference_frame和camera_frame的value上
UR5+ROS Kinetic+easy_handeye手眼标定教程(eye-to-hand)_第8张图片

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 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>

    
    <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_rgb_optical_frame"/>
        <param name="camera_frame"       value="camera_rgb_optical_frame"/>
        
        <param name="marker_frame"       value="camera_marker" />
    node>

    
    
    <include file="$(find ur_robot_driver)/launch/ur5_bringup.launch">
        <arg name="limited" value="true" />
        
        <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>

    
    <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_rgb_optical_frame" />
        
        <arg name="tracking_marker_frame" value="camera_marker" />
        
        <arg name="robot_base_frame" value="base_link" />
        
        <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>

你可能感兴趣的:(ROS,深度相机,深度摄像头,ROS,easy_handeye,eye-to-hand,手眼标定,UR5)