强化学习UR机械臂仿真环境搭建(一) - 为UR3机械臂添加robotiq ft300力传感器


建议参考这篇ur机械臂 + robotiq gripper + robotiq ft sensor + gazebo + 连接真实机械臂 + 网页控制这是后来做的代码更加规范、内容更加丰富的一个,并且bug更少。


如果想取得较好的训练结果并且能在现实机械臂上得到应用,仿真环境的参数设置最好与现实中越接近越好。为了能提供最好的仿真参数,仿真环境的搭建将会尽量的逼近现实。
因为在仿真模型的描述文件中,有inertial、mass、geometry、size等物理和形状信息,物理信息对于仿真同样是十分重要,所以所有的描述文件都会使用每个器件官方提供的描述文件,来尽量反应现实情况。

笔者环境:ROS melodic

一、下载UR3和robotiq的官方ros package

安装ur的ros驱动和ros package,可点击查看详细信息,下面只把安装过程列出:

# 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
$ catkin_make

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

下载robotiq的ros package

cd ~/catkin_ws/src
git clone https://github.com/ros-industrial/robotiq.git
rosdep install robotiq_modbus_tcp
sudo apt-get install ros-melodic-soem  # 官方是ros-kinetic-soem,要换成对应的ros版本

二、修改xacro文件,将robotiq ft300添加到ur3的末端

cd  ~/catkin_ws/src/robotiq/robotiq_ft_sensor/urdf
gedit robotiq_ft300.urdf.xacro

在文件中,能看到下面的信息

   <!-- Macro function to instanciate URDF model of the FT300 force-torque sensor with mounting plate

        Example use: 
        
            // Import this macro function
            <xacro:include filename="$(find robotiq_ft_sensor)/urdf/robotiq_ft300.urdf.xacro" />
            
            // Instanciate sensor instance and connect it to robot flange
            <xacro:robotiq_ft300 parent="robot_flange_link" prefix="">
                <origin xyz="0 0 0" rpy="0 0 0"/> 
            </xacro:robotiq_ft300>
      
    -->
这描述了怎样将sensor添加到机械臂的末端

打开ur3的描述文件

cd ~/catkin_ws/src/fmauch_universal_robot/ur_description/urdf
gedit  ur3.urdf.xacro  

在文件的开始位置处,我们添加

<xacro:include filename="$(find robotiq_ft_sensor)/urdf/robotiq_ft300.urdf.xacro" />

在这里插入图片描述在文件的末尾处,我们添加

    <xacro:robotiq_ft300 parent="${prefix}tool0" prefix="">
      <origin xyz="0 0 0 " rpy="0 0 0"/>
    </xacro:robotiq_ft300>

在这里插入图片描述
添加完成后,启动moveit_setup_assiatant查看效果。

roscore
# open a new terminal
rosrun moveit_setup_assiatant moveit_setup_assistant

load file为~/catkin_ws/src/fmauch_universal_robot/ur_description/urdf/ur3_robot.urdf.xacro文件,至于为什么是这个文件以及这一些操作的根源是什么,请仔细阅读源码,便能发现源码是怎样组织的。

在这里插入图片描述
PS.推荐使用terminator和vscode搭配来进行ros开发。
terminator允许同时多开窗口,对于整体协调工作非常方便。
在这里插入图片描述
同时推荐使用vscode进行开发,因为roboware在Ubuntu 18上字体显示异常,所以vscode是目前生态较好,功能较为丰富也方便的ide。
在这里插入图片描述

  • 7
    点赞
  • 58
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值