turtlebot3-burger_150.png
turtlebot3-waffle-pi_150.png
turtlebot3-arm_150.png
walking-y2_150.png
turbot3-multi_150.png
turbot3-dl-ros1_150.png
turbot3-ai.png
turbot3-dl-ros2_150.png
turbot3-slam_150.png
turbot3-arm_150.png
turtlebot4-lite_150.png
turtlebot4-pro_150.png
turbot4-dl_150.png
turbot4-ai_150.png
aidriving-racebot_150.png
aidriving-autodrive_150.png
turtlebot-arm_150.png
openmanipulator-x_150.png
Home » ROS2与Interbotix系列机械臂教程 » ROS2与Interbotix系列机械臂教程-pick_and_place例程

ROS2与Interbotix系列机械臂教程-pick_and_place例程

纠错,疑问,交流: 请进入讨论区请点击进入页面,扫码加入微信群或Q群进行交流

获取最新文章: 扫一扫加入“创客智造”公众号

文章说明

  • 本教程主要介绍如何在ros2环境下运行pick_and_place例程
  • 测试环境:Ubuntu 22.04 + ROS2 Humble + wx250s机械臂 + RealSense D435i相机

操作步骤

  • 假设正在现实中使用WidowX-250s机械臂,启动相机和机械臂,运行该命令
$ ros2 launch interbotix_xsarm_perception xsarm_perception.launch.py robot_model:=wx250s
  • 启动脚本
$ cd /home/ubuntu/interbotix_ws/src/interbotix_ros_manipulators/interbotix_ros_xsarms/interbotix_xsarm_perception/demos/
$ python3 pick_place.py
  • 由于脚本中默认的机械臂模型是wx200,当使用其他机械臂时,需要在脚本上进行对应的修改

  • 运行脚本时,在RViz中应该会待抓取的几个物件上会出现看到 TF 标记

  • 这是相机所识别到带抓取物件的位置,同时会通过get_cluster_positions函数反馈这些位置信息 - 物件上的 TF 标记是临时的,一阵间后就会消失

  • 然后,机械臂就会开始抓取物件

请输入图片描述

注意:由于前面的手眼标定流程得出的位姿变换不是百分百准确,位置可能有些许偏差,此时可以在脚本获取到的物件位置值上再添加偏差值修正这个问题

if success:
        # pick up all the objects and drop them in a virtual basket in front of the robot
        for cluster in clusters:
            x, y, z = cluster['position'] # 相机识别到物件的位置
            print(x, y, z) # 打印位置
            bot.arm.set_ee_pose_components(x=x-0.02, y=y-0.02, z=z+0.1, pitch=0.5)
            bot.arm.set_ee_pose_components(x=x-0.02, y=y-0.02, z=z+0.01, pitch=0.5) # 物件的位置往x轴下方和y轴右边偏移2cm
            bot.gripper.set_pressure(0.5)  # 设置夹具力度
            bot.gripper.grasp()
            time.sleep(1)            
            bot.arm.set_ee_pose_components(x=x, y=y, z=z+0.2, pitch=0.5)
            bot.arm.set_ee_pose_components(x=0.3, z=0.2) 
            bot.gripper.set_pressure(1.0)  
            bot.gripper.release()
            time.sleep(2) 
    else:
        print('Could not get cluster positions.')

演示视频

<iframe height=498 width=100% src="//player.bilibili.com/player.html?isOutside=true&aid=113282111310369&bvid=BV1Hv2GYhEYd&cid=26226590879&p=1&as_wide=1&high_quality=1&danmaku=0" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>

纠错,疑问,交流: 请进入讨论区请点击进入页面,扫码加入微信群或Q群进行交流

获取最新文章: 扫一扫加入“创客智造”公众号


标签: none