日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

UR+RealSense手眼标定(eye-to-hand)

發(fā)布時(shí)間:2023/12/31 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 UR+RealSense手眼标定(eye-to-hand) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

01 手眼標(biāo)定的原理

基坐標(biāo)系(base_tree)和相機(jī)(camera_tree)兩個(gè)坐標(biāo)系屬于不同的tree,通過將標(biāo)簽貼到手上,相機(jī)識(shí)別出標(biāo)簽的position和orention,并通過easy_handeye標(biāo)定包得到tool0(機(jī)械手),進(jìn)一步得到相對(duì)于base的位置關(guān)系。即子坐標(biāo)系(camera_rgb_optical_frame)到父坐標(biāo)系(base_link)之間的關(guān)系。

在之后如果攝像頭識(shí)別到物體的位置(在camera坐標(biāo)系下),即可通過transform(這種轉(zhuǎn)換關(guān)系),轉(zhuǎn)化為base(也就是機(jī)器人知道的自己的位置坐標(biāo)系)坐標(biāo)系下的位置,這樣機(jī)器人就通過轉(zhuǎn)化關(guān)系得到相機(jī)識(shí)別到的位置實(shí)際在空間中的位置。


對(duì)于手眼標(biāo)定,場(chǎng)景主要有以下兩種,

  • eye-to-hand,眼在手外。
    這種場(chǎng)景下我們已知機(jī)械臂終端end_link與base_link、相機(jī)camera_link與識(shí)別物體object_link之間的關(guān)系;
    需要求解camera_link與base_link之間的變換。

  • eye-in-hand,眼在手上。
    這種場(chǎng)景base_link和機(jī)械臂各關(guān)節(jié)joint_link、end_link已經(jīng)通過URDF發(fā)布了;
    只需要求解camera_link與end_link之間的變換。

02 準(zhǔn)備工作

所用系統(tǒng)及硬件版本:

  • Ubuntu18.04(ROS Melodic)
  • UR3機(jī)械臂(CB3.12)
  • RealSense D435i

  • 安裝ur功能包(Universal_Robots_ROS_Driver驅(qū)動(dòng))
  • 安裝realsense-ros

2.1 安裝aruco_ros

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

2.2 安裝vision_visp / visp_hand2eye_calibration

cd ~/ur_ws/src sudo apt-get install ros-melodic-visp git clone -b melodic-devel https://github.com/lagadic/vision_visp.git cd .. catkin_make --pkg visp_hand2eye_calibration catkin_make

2.3 安裝easy_handeye

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

03 眼在手外

3.1 修改標(biāo)定 launch 文件

標(biāo)定過程需啟動(dòng)ur3機(jī)械臂的相關(guān)節(jié)點(diǎn),realsense節(jié)點(diǎn),aruco節(jié)點(diǎn),easy_handeye節(jié)點(diǎn),可以寫一個(gè) launch 文件同時(shí)啟動(dòng)上述節(jié)點(diǎn),也可以分別啟動(dòng)。

easy_handeye 包中給出了用一個(gè) launch 文件實(shí)現(xiàn)的示例,在如下的目錄中:/home/guyue/ur_ws/src/easy_handeye/docs/example_launch/ur5_kinect_calibration.launch,這里只有ur5+kinect的,ur3+realsense的修改即可。

在ur5_kinect_calibration.launch基礎(chǔ)上進(jìn)行修改:

  • 復(fù)制launch文件
    將launch文件拷貝到easy_handeye功能包的launch目錄中,并修改文件名字

    cd ~/ur_ws/src/easy_handeye/docs/example_launch cp ur5_kinect_calibration.launch ~/ur_ws/src/easy_handeye/easy_handeye/launch/ur3_eye_to_hand_calibration.launch
  • 修改launch文件
    修改launch文件如下:
    注意:realsense和ur機(jī)械臂最好分開啟動(dòng),否則會(huì)有報(bào)錯(cuò)

    <launch><arg name="namespace_prefix" default="ur3_realsense_handeyecalibration" /><arg name="robot_ip" doc="The IP address of the UR3 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="323" /><!-- 1. start the Realsense435 --><!--<include file="$(find realsense2_camera)/launch/rs_camera.launch" />--><!-- 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_frame"/><param name="camera_frame" value="camera_color_frame"/><param name="marker_frame" value="camera_marker" /></node><!-- 3. start the robot --><!--<include file="$(find ur_robot_driver)/launch/ur3_bringup.launch"><arg name="limited" value="true" /><arg name="robot_ip" value="192.168.56.10" /></include><include file="$(find ur3_moveit_config)/launch/ur3_moveit_planning_execution.launch"><arg name="limited" value="true" /></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="robot_effector_frame" value="tool0_controller" /><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文件
    這里主要是🌒啟動(dòng)realsense相機(jī),🌒啟動(dòng)ArUco,🌒啟動(dòng)UR3機(jī)械臂,🌒啟動(dòng)easy_handeye 四部分:

    • 1/ Realsense435節(jié)點(diǎn)
      把rs_camera.launch文件<include>導(dǎo)入
    • 2/ ArUco節(jié)點(diǎn)
      • 修改:/camera_info / /image / reference_frame 和 camera_frame
      • 從https://chev.me/arucogen/中下載aruco二維碼并打印出來
      • 注意:
        ? Dictionary 一定要選 Original ArUco
        ? Marker ID 和 Marker size 自選,在launch 文件中做相應(yīng)的修改
        ? 打印時(shí)注意選擇原始大小,否則要測(cè)量一下打印出來的真實(shí)大小
    • 3/ UR3節(jié)點(diǎn)
      • 這里用了 ur_robot_driver 包,而沒有用原始的 ur_bringup 包
      • 修改機(jī)器人的真實(shí) ip
    • 4/ easy_handeye節(jié)點(diǎn)
      • <arg name="eye_on_hand" value="false"/> :眼在手外時(shí),value 為 false
      • tracking_base_frame :為相機(jī)坐標(biāo)系 camera_color_frame
      • robot_base_frame :為機(jī)器人基座坐標(biāo)系,示例里寫的是 base_link,我在 rviz 中查看 base 才是真實(shí)的基座坐標(biāo)系
      • robot_effector_frame:為工具坐標(biāo)系,因?yàn)槲野惭b了 robotiq相機(jī)/力傳感器和夾爪,所以TCP 改變了

3.2 啟動(dòng) launch 文件,開始標(biāo)定

3.2.1 啟動(dòng)realsense

roslaunch realsense2_camera rs_camera.launch

3.2.2 啟動(dòng)ur機(jī)械臂

  • ① 啟動(dòng)機(jī)械臂

    roslaunch ur_robot_driver ur3_bringup.launch limited:=true robot_ip:=192.168.56.10
  • ② 啟動(dòng)示教器

  • ③ 啟動(dòng)moveit

    roslaunch ur3_moveit_config ur3_moveit_planning_execution.launch limited:=true

3.2.3 啟動(dòng)手眼標(biāo)定的其他程序

roslaunch easy_handeye ur3_eye_to_hand_calibration.launch

3.3 標(biāo)定

launch文件啟動(dòng)后,會(huì)出現(xiàn)3個(gè)窗口。



標(biāo)定過程:

  • 首先打開一個(gè)終端,輸入rqt,點(diǎn)擊菜單欄的 Plugins -> Visulization -> Image View,選擇 /aruco_tracker/result 話題。當(dāng)識(shí)別出aruco碼時(shí),則可以進(jìn)行下一步。
  • 在第三個(gè)屏幕中點(diǎn)擊check starting pose,若檢查成功,界面會(huì)出現(xiàn): 0/17,ready to start
  • 在第三個(gè)窗口點(diǎn)擊next pose -> plan -> execute,當(dāng)點(diǎn)完 plan ,出現(xiàn)綠色框,則說明規(guī)劃成功,然后可以點(diǎn)擊 execute讓機(jī)械臂執(zhí)行動(dòng)作
  • 然后在第二個(gè)窗口,點(diǎn)擊take sample采樣
  • 然后再次回到第三個(gè)窗口使機(jī)械臂執(zhí)行規(guī)劃動(dòng)作。
    當(dāng)17個(gè)動(dòng)作執(zhí)行完成,回到第二個(gè)界面,點(diǎn)擊compute,然后出現(xiàn)結(jié)果的姿態(tài)矩陣,然后可以點(diǎn)擊save保存

04 報(bào)錯(cuò)

以下的報(bào)錯(cuò)主要需要注意3點(diǎn):

  • 單獨(dú)啟動(dòng)ur機(jī)械臂和realsense相機(jī),不要放到launch文件里一起啟動(dòng)

  • 三個(gè)標(biāo)定窗口都啟動(dòng)后,注意再打開一個(gè)rqt窗口,確定識(shí)別出aruco碼

  • 如果有關(guān)于opencv的報(bào)錯(cuò),需要升級(jí)opencv的版本

    pip2 install opencv-python==4.2.0.32

下面是詳細(xì)的報(bào)錯(cuò)信息及解決方法

4.1 unused args [limited] for include

如果不注釋掉lauch文件中ur機(jī)械臂啟動(dòng)的部分,會(huì)遇到下述問題,所以最好的辦法是ur機(jī)械臂單獨(dú)啟動(dòng)

  • 報(bào)錯(cuò)1:guyue@guyue:~/ur_ws$ roslaunch easy_handeye ur3_eye_to_hand_calibration.launch ... logging to /home/guyue/.ros/log/7697ce46-6c91-11ec-9d22-38fc98e4336a/roslaunch-guyue-23663.log Checking log directory for disk usage. This may take a while. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.RLException: unused args [limited] for include of [/home/guyue/ur_ws/src/Universal_Robots_ROS_Driver/ur_robot_driver/launch/ur3_bringup.launch] The traceback for the exception was written to the log file 解決: 將ur機(jī)械臂啟動(dòng)中的limited注釋
  • 報(bào)錯(cuò)2:guyue@guyue:~/ur_ws$ roslaunch easy_handeye ur3_eye_to_hand_calibration.launch ... logging to /home/guyue/.ros/log/ecddcd44-6c91-11ec-9d22-38fc98e4336a/roslaunch-guyue-23704.log Checking log directory for disk usage. This may take a while. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.RLException: unused args [limited] for include of [/home/guyue/ur_ws/src/fmauch_universal_robot/ur3_moveit_config/launch/ur3_moveit_planning_execution.launch] The traceback for the exception was written to the log file 解決: 將ur機(jī)械臂啟動(dòng)中moveit啟動(dòng)的部分的limited注釋

4.2 關(guān)于opencv版本的問題

  • 報(bào)錯(cuò)3:

    [ WARN] [1641220271.220611210]: normalizeImageIllumination is unimplemented! [ INFO] [1641220271.250652945]: rviz version 1.13.17 [ INFO] [1641220271.250695191]: compiled against Qt version 5.9.5 [ INFO] [1641220271.250704120]: compiled against OGRE version 1.9.0 (Ghadamon) [ INFO] [1641220271.253321240]: Forcing OpenGl version 0. [ INFO] [1641220271.336844200]: Stereo is NOT SUPPORTED [ INFO] [1641220271.336903845]: OpenGL device: Mesa DRI Intel(R) UHD Graphics (CML GT2) [ INFO] [1641220271.336918119]: OpenGl version: 3.0 (GLSL 1.3). Traceback (most recent call last):File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/scripts/calibrate.py", line 5, in <module>from easy_handeye.handeye_server import HandeyeServerFile "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_server.py", line 13, in <module>from easy_handeye.handeye_calibration_backend_opencv import HandeyeCalibrationBackendOpenCVFile "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_calibration_backend_opencv.py", line 4, in <module>import transforms3d as tfs ImportError: No module named transforms3d [ur3_realsense_handeyecalibration_eye_on_base/easy_handeye_calibration_server-4] process has died [pid 27827, exit code 1, cmd /home/guyue/ur_ws/src/easy_handeye/easy_handeye/scripts/calibrate.py __name:=easy_handeye_calibration_server __log:=/home/guyue/.ros/log/5cfd9712-6ca1-11ec-9d22-38fc98e4336a/ur3_realsense_handeyecalibration_eye_on_base-easy_handeye_calibration_server-4.log]. log file: /home/guyue/.ros/log/5cfd9712-6ca1-11ec-9d22-38fc98e4336a/ur3_realsense_handeyecalibration_eye_on_base-easy_handeye_calibration_server-4*.log arguments: Namespace(quiet=False) unknowns: [] [INFO] [1641220272.193446]: Configuring for calibration with namespace: /ur3_realsense_handeyecalibration_eye_on_base/ [INFO] [1641220272.194252]: Loading parameters for calibration /ur3_realsense_handeyecalibration_eye_on_base/ from the parameters server [INFO] [1641220272.523661]: Loading parameters for calibration ur3_realsense_handeyecalibration_eye_on_base/ from the parameters server [ INFO] [1641220272.533509978]: Loading robot model 'ur3_robot'... [ WARN] [1641220272.579945030]: Kinematics solver doesn't support #attempts anymore, but only a timeout. Please remove the parameter '/robot_description_kinematics/manipulator/kinematics_solver_attempts' from your configuration. [ INFO] [1641220273.754739224]: Ready to take commands for planning group manipulator. [ INFO] [1641220274.520914331]: Loading robot model 'ur3_robot'... [ WARN] [1641220274.558909017]: Kinematics solver doesn't support #attempts anymore, but only a timeout. Please remove the parameter '/robot_description_kinematics/manipulator/kinematics_solver_attempts' from your configuration. [ INFO] [1641220274.701571379]: Starting planning scene monitor

    解決: 安裝transforms3d

    guyue@guyue:~$ pip install transforms3dCommand 'pip' not found, but can be installed with:sudo apt install python-pipguyue@guyue:~$ sudo apt install python-pipguyue@guyue:~$ pip install transforms3d
  • 報(bào)錯(cuò)4: 依然報(bào)錯(cuò)

    [ WARN] [1641220801.405651818]: normalizeImageIllumination is unimplemented! [ INFO] [1641220801.437421516]: Stereo is NOT SUPPORTED [ INFO] [1641220801.437463026]: OpenGL device: Mesa DRI Intel(R) UHD Graphics (CML GT2) [ INFO] [1641220801.437478491]: OpenGl version: 3.0 (GLSL 1.3). Traceback (most recent call last):File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/scripts/calibrate.py", line 5, in <module>from easy_handeye.handeye_server import HandeyeServerFile "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_server.py", line 13, in <module>from easy_handeye.handeye_calibration_backend_opencv import HandeyeCalibrationBackendOpenCVFile "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_calibration_backend_opencv.py", line 10, in <module>class HandeyeCalibrationBackendOpenCV(object):File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_calibration_backend_opencv.py", line 15, in HandeyeCalibrationBackendOpenCV'Tsai-Lenz': cv2.CALIB_HAND_EYE_TSAI, AttributeError: 'module' object has no attribute 'CALIB_HAND_EYE_TSAI' [ur3_realsense_handeyecalibration_eye_on_base/easy_handeye_calibration_server-4] process has died [pid 29462, exit code 1, cmd /home/guyue/ur_ws/src/easy_handeye/easy_handeye/scripts/calibrate.py __name:=easy_handeye_calibration_server __log:=/home/guyue/.ros/log/e9da5296-6ca2-11ec-9d22-38fc98e4336a/ur3_realsense_handeyecalibration_eye_on_base-easy_handeye_calibration_server-4.log]. log file: /home/guyue/.ros/log/e9da5296-6ca2-11ec-9d22-38fc98e4336a/ur3_realsense_handeyecalibration_eye_on_base-easy_handeye_calibration_server-4*.log arguments: Namespace(quiet=False) unknowns: [] [INFO] [1641220802.356186]: Configuring for calibration with namespace: /ur3_realsense_handeyecalibration_eye_on_base/ [INFO] [1641220802.356995]: Loading parameters for calibration /ur3_realsense_handeyecalibration_eye_on_base/ from the parameters server [INFO] [1641220802.691195]: Loading parameters for calibration ur3_realsense_handeyecalibration_eye_on_base/ from the parameters server [ INFO] [1641220802.701319432]: Loading robot model 'ur3_robot'... [ WARN] [1641220802.748617616]: Kinematics solver doesn't support #attempts anymore, but only a timeout. Please remove the parameter '/robot_description_kinematics/manipulator/kinematics_solver_attempts' from your configuration. [ INFO] [1641220803.836626902]: Ready to take commands for planning group manipulator. [ INFO] [1641220804.638232086]: Loading robot model 'ur3_robot'... [ WARN] [1641220804.672640533]: Kinematics solver doesn't support #attempts anymore, but only a timeout. Please remove the parameter '/robot_description_kinematics/manipulator/kinematics_solver_attempts' from your configuration. [easy_handeye_calibration_server_robot-3] killing on exit PluginHandler.save_settings() plugin "rqt_easy_handeye/Hand-eye Calibration automatic movement#0" raised an exception: Traceback (most recent call last):File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler.py", line 191, in save_settingsself._save_settings(plugin_settings, instance_settings)File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler_direct.py", line 114, in _save_settingsself.emit_save_settings_completed()File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler.py", line 207, in emit_save_settings_completedcallback(self._instance_id)File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_manager.py", line 459, in _close_application_save_callbackself._close_application_shutdown_plugins()File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_manager.py", line 467, in _close_application_shutdown_pluginsinfo['instance_id'], self._close_application_shutdown_callback)File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_manager.py", line 353, in _shutdown_pluginhandler.close_signal.disconnect(self.unload_plugin) TypeError: disconnect() failed between 'close_signal' and 'unload_plugin'PluginHandler.save_settings() plugin "rqt_easy_handeye/Hand-eye Calibration#0" raised an exception: Traceback (most recent call last):File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler.py", line 191, in save_settingsself._save_settings(plugin_settings, instance_settings)File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler_direct.py", line 114, in _save_settingsself.emit_save_settings_completed()File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler.py", line 207, in emit_save_settings_completedcallback(self._instance_id)File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_manager.py", line 459, in _close_application_save_callbackself._close_application_shutdown_plugins()File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_manager.py", line 467, in _close_application_shutdown_pluginsinfo['instance_id'], self._close_application_shutdown_callback)File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_manager.py", line 353, in _shutdown_pluginhandler.close_signal.disconnect(self.unload_plugin) TypeError: disconnect() failed between 'close_signal' and 'unload_plugin'Traceback (most recent call last):File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_manager.py", line 454, in close_applicationglobal_settings, perspective_settings, self._close_application_save_callback)File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_manager.py", line 429, in _save_settingsself._save_plugin_settings(info['instance_id'], callback)File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_manager.py", line 341, in _save_plugin_settingshandler.save_settings(plugin_settings, instance_settings, callback)File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler.py", line 195, in save_settingsself.emit_save_settings_completed()File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler.py", line 202, in emit_save_settings_completedself._call_method_on_all_dock_widgets('save_settings', self.__instance_settings)File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler.py", line 213, in _call_method_on_all_dock_widgetssettings = instance_settings.get_settings(name) AttributeError: 'NoneType' object has no attribute 'get_settings' [ur3_realsense_handeyecalibration_eye_on_base/calibration_mover-6] escalating to SIGTERM shutting down processing monitor... ... shutting down processing monitor complete

    解決:
    AttributeError: 'module' object has no attribute'CALIB_HAND_EYE_TSAI'
    出現(xiàn)這個(gè)問題的原因在于python的opencv版本過低,低版本的opencv中沒有手眼標(biāo)定的函數(shù),因此需要更新opencv版本即可。

    pip2 install opencv-python==4.2.0.32

    參考:
    - https://github.com/IFL-CAMP/easy_handeye/issues/78
    - https://blog.csdn.net/m0_53621852/article/details/121021402

4.3 關(guān)于camera_marker的報(bào)錯(cuò)

[ERROR] [1641266714.990937]: Error processing request: "camera_marker" passed to lookupTransform argument source_frame does not exist. ['Traceback (most recent call last):\n', ' File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 632, in _handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n', ' File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_server.py", line 88, in take_sample\n self.sampler.take_sample()\n', ' File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_sampler.py", line 88, in take_sample\n transforms = self._get_transforms()\n', ' File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_sampler.py", line 78, in _get_transforms\n Duration(10))\n', ' File "/opt/ros/melodic/lib/python2.7/dist-packages/tf2_ros/buffer.py", line 87, in lookup_transform\n return self.lookup_transform_core(target_frame, source_frame, time)\n', 'LookupException: "camera_marker" passed to lookupTransform argument source_frame does not exist. \n'] Traceback (most recent call last):File "/home/guyue/ur_ws/src/easy_handeye/rqt_easy_handeye/src/rqt_easy_handeye/rqt_easy_handeye.py", line 132, in handle_take_samplesample_list = self.client.take_sample()File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_client.py", line 76, in take_samplereturn self.take_sample_proxy().samplesFile "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 442, in __call__return self.call(*args, **kwds)File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 522, in callresponses = transport.receive_once()File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 735, in receive_oncep.read_messages(b, msg_queue, sock) File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 360, in read_messagesself._read_ok_byte(b, sock)File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 343, in _read_ok_byteraise ServiceException("service [%s] responded with an error: %s"%(self.resolved_name, str)) rospy.service.ServiceException: service [/ur3_realsense_handeyecalibration_eye_on_base/take_sample] responded with an error: error processing request: "camera_marker" passed to lookupTransform argument source_frame does not exist. [ur3_realsense_handeyecalibration_eye_on_base/namespace_guyue_11030_7952019406960363886_rqt-5] process has died [pid 11069, exit code -6, cmd /home/guyue/ur_ws/src/easy_handeye/rqt_easy_handeye/scripts/rqt_easy_handeye __name:=namespace_guyue_11030_7952019406960363886_rqt __log:=/home/guyue/.ros/log/4f4a0756-6d0d-11ec-b452-38fc98e4336a/ur3_realsense_handeyecalibration_eye_on_base-namespace_guyue_11030_7952019406960363886_rqt-5.log]. log file: /home/guyue/.ros/log/4f4a0756-6d0d-11ec-b452-38fc98e4336a/ur3_realsense_handeyecalibration_eye_on_base-namespace_guyue_11030_7952019406960363886_rqt-5*.log
  • 解決:
    打開rqt,對(duì)準(zhǔn)二維碼,然后讓rviz中出現(xiàn)了這個(gè)坐標(biāo)
    注意realsense需要單獨(dú)啟動(dòng)

4.4 在仿真環(huán)境運(yùn)行的報(bào)錯(cuò)

[INFO] [1641298197.817943, 69.092000]: Taking a sample... [ERROR] [1641298207.884633, 79.146000]: Error processing request: Lookup would require extrapolation into the past. Requested time 69.094000000 but the earliest data is at time 1641298197.859954119, when looking up transform from frame [camera_marker] to frame [camera_color_frame] ['Traceback (most recent call last):\n', ' File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 632, in _handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n', ' File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_server.py", line 88, in take_sample\n self.sampler.take_sample()\n', ' File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_sampler.py", line 88, in take_sample\n transforms = self._get_transforms()\n', ' File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_sampler.py", line 78, in _get_transforms\n Duration(10))\n', ' File "/opt/ros/melodic/lib/python2.7/dist-packages/tf2_ros/buffer.py", line 87, in lookup_transform\n return self.lookup_transform_core(target_frame, source_frame, time)\n', 'ExtrapolationException: Lookup would require extrapolation into the past. Requested time 69.094000000 but the earliest data is at time 1641298197.859954119, when looking up transform from frame [camera_marker] to frame [camera_color_frame]\n'] Traceback (most recent call last):File "/home/guyue/ur_ws/src/easy_handeye/rqt_easy_handeye/src/rqt_easy_handeye/rqt_easy_handeye.py", line 132, in handle_take_samplesample_list = self.client.take_sample()File "/home/guyue/ur_ws/src/easy_handeye/easy_handeye/src/easy_handeye/handeye_client.py", line 76, in take_samplereturn self.take_sample_proxy().samplesFile "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 442, in __call__return self.call(*args, **kwds)File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 522, in callresponses = transport.receive_once()File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 735, in receive_oncep.read_messages(b, msg_queue, sock) File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 360, in read_messagesself._read_ok_byte(b, sock)File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 343, in _read_ok_byteraise ServiceException("service [%s] responded with an error: %s"%(self.resolved_name, str)) rospy.service.ServiceException: service [/ur3_realsense_handeyecalibration_eye_on_base/take_sample] responded with an error: error processing request: Lookup would require extrapolation into the past. Requested time 69.094000000 but the earliest data is at time 1641298197.859954119, when looking up transform from frame [camera_marker] to frame [camera_color_frame] [ur3_realsense_handeyecalibration_eye_on_base/namespace_guyue_2228_1559384220386469985_rqt-5] process has died [pid 2270, exit code -6, cmd /home/guyue/ur_ws/src/easy_handeye/rqt_easy_handeye/scripts/rqt_easy_handeye __name:=namespace_guyue_2228_1559384220386469985_rqt __log:=/home/guyue/.ros/log/119cbc42-6d57-11ec-b452-38fc98e4336a/ur3_realsense_handeyecalibration_eye_on_base-namespace_guyue_2228_1559384220386469985_rqt-5.log]. log file: /home/guyue/.ros/log/119cbc42-6d57-11ec-b452-38fc98e4336a/ur3_realsense_handeyecalibration_eye_on_base-namespace_guyue_2228_1559384220386469985_rqt-5*.log ^C[rviz_guyue_2228_7026475105225641117-7] killing on exit [ur3_realsense_handeyecalibration_eye_on_base/calibration_mover-6] killing on exit [easy_handeye_calibration_server_robot-3] killing on exit [ur3_realsense_handeyecalibration_eye_on_base/easy_handeye_calibration_server-4] killing on exit [aruco_tracker-1] killing on exit [dummy_handeye-2] killing on exit shutting down processing monitor... ... shutting down processing monitor complete done
  • 解決:
    因?yàn)榍懊娴膱?bào)錯(cuò)太多,所以就準(zhǔn)備先在gazebo中運(yùn)行沒有錯(cuò)誤后再連接真實(shí)的機(jī)械臂,然后前面的錯(cuò)誤報(bào)完以后出現(xiàn)這個(gè)錯(cuò)誤,這個(gè)錯(cuò)誤不必在意,連接真實(shí)機(jī)械臂后就不報(bào)這個(gè)錯(cuò)誤了。

    使用gazebo調(diào)試的方法:
    把連接真實(shí)ur機(jī)械臂ip地址那句換為啟動(dòng)ur機(jī)械臂gazebo的語句;并且啟動(dòng)ur機(jī)械臂moveit的語句后面標(biāo)記sim為true

05 總結(jié)

  • 安裝功能包

  • 修改lauch文件(放入啟動(dòng)aruco和easy_handeye部分),并放到easy_handeye功能包下面

  • 啟動(dòng)realsense

    roslaunch realsense2_camera rs_camera.launch
  • 啟動(dòng)ur機(jī)械臂

    # 1. 啟動(dòng)機(jī)械臂 roslaunch ur_robot_driver ur3_bringup.launch limited:=true robot_ip:=192.168.56.10 # 2. 啟動(dòng)示教器 # 3. 啟動(dòng)moveit roslaunch ur3_moveit_config ur3_moveit_planning_execution.launch limited:=true
  • 啟動(dòng)手眼標(biāo)定程序

    roslaunch easy_handeye ur3_eye_to_hand_calibration.launch
  • 啟動(dòng)rqt查看是否能識(shí)別到aruco碼(點(diǎn)擊菜單欄的 Plugins -> Visulization -> Image View,選擇 /aruco_tracker/result 話題)

  • 在窗口3檢測(cè)當(dāng)前位置是否可行check starting pose,依次點(diǎn)擊next pose -> plan -> execute(注意plan完是綠色才可以execute)

  • 每次執(zhí)行完機(jī)械臂動(dòng)作,在窗口2點(diǎn)擊take sample,共17次,然后點(diǎn)擊compute計(jì)算,結(jié)果顯示在右下方

  • 注: 如果手眼標(biāo)定launch文件啟動(dòng)有問題,可能是opencv版本不對(duì):

    pip2 install opencv-python==4.2.0.32
  • 總結(jié)

    以上是生活随笔為你收集整理的UR+RealSense手眼标定(eye-to-hand)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。