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

为UR3机械臂添加robotiq ft300力传感器

  • ```建议参考这篇```,[ur机械臂 + robotiq gripper + robotiq ft sensor + gazebo + 连接真实机械臂 + 网页控制](https://blog.csdn.net/bornfree5511/article/details/107529420),```这是后来做的代码更加规范、内容更加丰富的一个,并且bug更少。```
  • 一、下载UR3和robotiq的官方ros package
  • 二、修改xacro文件,将robotiq ft300添加到ur3的末端


建议参考这篇,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

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

   
这描述了怎样将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>

强化学习UR机械臂仿真环境搭建(一) - 为UR3机械臂添加robotiq ft300力传感器_第1张图片
添加完成后,启动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文件,至于为什么是这个文件以及这一些操作的根源是什么,请仔细阅读源码,便能发现源码是怎样组织的。

强化学习UR机械臂仿真环境搭建(一) - 为UR3机械臂添加robotiq ft300力传感器_第2张图片
PS.推荐使用terminator和vscode搭配来进行ros开发。
terminator允许同时多开窗口,对于整体协调工作非常方便。

同时推荐使用vscode进行开发,因为roboware在Ubuntu 18上字体显示异常,所以vscode是目前生态较好,功能较为丰富也方便的ide。
强化学习UR机械臂仿真环境搭建(一) - 为UR3机械臂添加robotiq ft300力传感器_第3张图片

你可能感兴趣的:(#,ROS,#,强化学习,#,强化学习UR机械臂仿真环境搭建)