当前位置:   article > 正文

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

ur的仿真空间强化学习


建议参考这篇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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

下载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版本
  • 1
  • 2
  • 3
  • 4

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

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

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

   <!-- 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>
      
    -->
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
这描述了怎样将sensor添加到机械臂的末端
  • 1

打开ur3的描述文件

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

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

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

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

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

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

roscore
# open a new terminal
rosrun moveit_setup_assiatant moveit_setup_assistant
  • 1
  • 2
  • 3

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。
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/喵喵爱编程/article/detail/764896
推荐阅读
相关标签
  

闽ICP备14008679号