UR5、Kinect2手眼标定总结

花了几点的时间,在师兄的帮助下完成了手眼标定的工作。现在就我个人出现的问题做一下总结。

首先引用师兄博文https://blog.csdn.net/sinat_23853639/article/details/80276848

硬件配置没什么好说的,我个人感觉没什么要求。软件平台是Ubuntu16.04、ROS kinetic、UR5版本3.2。

1、easy_handeye安装

在安装之前首先要按照以下步骤安装依赖包(注意版本号):

(1)

sudo apt-get install ros-kinetic-visp

(2)这个和第一个一样!

cd ~/catkin_ws/src
git clone -b kinetic-devel https://github.com/lagadic/vision_visp.git
cd ..
catkin_make --pkg visp_hand2eye_calibration

(3)

cd ~/catkin_ws/src
git clone -b kinetic-devel https://github.com/pal-robotics/aruco_ros
cd ..
catkin_make

安装easy_handeye

cd ~/catkin_ws/src
git clone https://github.com/IFL-CAMP/easy_handeye
cd ..
catkin_make

安装完成后为了能够同时启动UR,Kinect和标定程序,需要重新写一个launch文件。

easy_handeye作者给出了一个示例的launch,地址:

https://github.com/IFL-CAMP/easy_handeye/blob/master/docs/example_launch/ur5_kinect_calibration.launch

下面是我的修改launch文件,根据自己的配置参考两份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_frame" default="aruco_marker_frame"/>-->
    <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="100" />
    <!-- start the Kinect -->
    <include file="$(find kinect2_bridge)/launch/kinect2_bridge.launch" />
    <!--    <arg name="depth_registration" value="true" />
    </include>-->
 
    <!-- start ArUco -->
    <node name="aruco_tracker" pkg="aruco_ros" type="single">
        <remap from="/camera_info" to="/kinect2/hd/camera_info" />
        <remap from="/image" to="/kinect2/hd/image_color_rect" />
        <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="kinect2_rgb_optical_frame"/>
        <param name="camera_frame"       value="kinect2_rgb_optical_frame"/>
        <param name="marker_frame"       value="camera_marker" />
    </node>
 
    <!-- start the robot -->
    <include file="$(find ur_modern_driver)/launch/ur5_bringup.launch">
        <arg name="limited" value="true" />
        <arg name="robot_ip" value="192.168.1.111" />
    </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" />
 
        <arg name="tracking_base_frame" value="kinect2_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>

将修改好的launch文件放到easy_handeye——launch文件夹下,启动launch文件。

在这里如果出现一个错误,总结一下就是No module named moveit_commander。

因为我的ROS都是选择完整安装,具体出现这个错误的原因我也不懂。既然缺少这个文件就安装吧!

这里给出问题的参考:https://bitbucket.org/osrf/ariac/issues/108/importerror-no-module-named

重新运行出现以下结果(注意三个都不能少)就表示安装成功。

第二张图可能会没有右边的image viewer,这个原因在下面讲。

标定板在aruco下载。

2、手眼标定过程

为了方便记录,将上一步的三幅图标记为图一、图二、图三。

打开图一,将机器人的速度、加速度设置为0.1。

打开图二菜单栏选择Plugins—visualization—image view,继续选择/aruco_tracker/result

初始位置设置在视图的中间,保证机器人末端可以上下左右偏移。

设置完后打开图三,如果显示0/17就正常,如果不是就按check starting pose。

(1)点击next pose,再点击plan,出现绿色就当前位姿可以达到,最后点击execute。出现红色表示当前点不可用,继续点击next pose,重复操作;

(2)返回图二界面点击take sample。重复(1)(2)操作,知道17个点全部采集完;

(3)返回图二界面,点击compute,得到一组7个解的变换矩阵(四元数表示)。

问题总结:

(1)标定过程未完成图三界面就退出:机器人不能回到初始位置,重新设定初始位置;逆解算法(猜测);

(2)标定过程某些位置不可达到:原因同(1)。

我最后的标定只有15个点可以成功,但也足够用了。

保存后将他们发布出去。

roslaunch easy_handeye publish.launch

这一步可能会出现错误,先不要管。查看home隐藏文件夹.ros/easy_handeye下标定结果文件yaml。

将变换矩阵按照以下格式写成static_transform_publisher.launch文件(跳过这步在下一步中实现):

<launch>  
<node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="1 0 0 0 0 0 1 link1_parent link1 100" />  
</launch>

其中args的值分别对应x y z qx qy qz qw frame_id child_frame_id  period_in_ms。

3、启动文件的编写和moveit配置

为了减少启动的窗口,将机器人、Kinect、moveIT和上一步的坐标变换写到一个launch文件中。

<launch>
	
		<!-- start the robot -->
  <include file="$(find ur_modern_driver)/launch/ur5_bringup.launch">
      <arg name="limited" value="true" />
      <arg name="robot_ip" value="192.168.1.111" />
  </include>
  <include file="$(find ur5_moveit_config)/launch/ur5_moveit_planning_execution.launch">
      <arg name="limited" value="true" />
  </include>
 
  <include file="$(find ur5_moveit_config)/launch/moveit_rviz.launch">
      <arg name="config" value="true" />
  </include>
 
 
	<include file="$(find kinect2_bridge)/launch/kinect2_bridge.launch" />
 
 
	<!--<include file="$(find easy_handeye)/launch/publish.launch" />-->
 
	<node pkg="tf" type="static_transform_publisher" name="ur5_broadcaster" args="0.9453500767540619 0.35379846588132835 0.7404851341733942 -0.5564552699258106 -0.6546977028807769 0.3791733487039343 0.3434472623956579 base_link kinect2_rgb_optical_frame 100" />
 
</launch>

其中未加入点云处理。

因为使用了点云图像,所以要对moveit的octomap进行配置:

http://docs.ros.org/kinetic/api/moveit_tutorials/html/doc/perception_configuration/perception_configuration_tutorial.html?highlight=octomap

我把launch文件放在了ur_modern_driver的launch下。

点云图像配置文件sensors_kinect.yaml:

sensors:
  - sensor_plugin: occupancy_map_monitor/PointCloudOctomapUpdater
    point_cloud_topic: /head_mount_kinect/depth_registered/points
    max_range: 5.0
    point_subsample: 1
    padding_offset: 0.1
    padding_scale: 1.0
    max_update_rate: 1.0
    filtered_cloud_topic: filtered_cloud

注意:point_cloud_topic需要进行修改,我是用的是Kinect相机,topic在iai_kinect2/README.md里面。因为在手眼标定的时候使用的rgb表示坐标(具体参考标定启动文件reference_frame的value),所以topic使用hd或者qhd的point(qhd显示精度地,但是速度快)。

编写好的yaml文件放到ur5_moveit_config/config下。

sensor_manager.launch文件配置:

打开ur5_moveit_config/launch/sensor_manager.launch.xml文件,在文本最后添加以下内容:

  <rosparam command="load" file="$(find ur5_moveit_config)/config/sensors_kinect.yaml" />
  <param name="octomap_frame" type="string" value="odom_combined" />
  <param name="octomap_resolution" type="double" value="0.05" />
  <param name="max_range" type="double" value="5.0" />

注意:机器人的名称。

到此为止配置完成了。

启动launch文件。

完美运行,接下来就开始你的表演吧!!

猜你喜欢

转载自blog.csdn.net/zhang970187013/article/details/81098175