為UR3機械臂添加robotiq ft300力傳感器
- ,```這是後來做的代碼更加規範、内容更加豐富的一個,并且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
下載下傳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
在檔案中,能看到下面的資訊
<!-- 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
在檔案的開始位置處,我們添加
<xacro:include filename="$(find robotiq_ft_sensor)/urdf/robotiq_ft300.urdf.xacro" />
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiI0gTMx81dsQWZ4lmZf1GLlpXazVmcvwFciV2dsQXYtJ3bm9CX9s2RkBnVHFmb1clWvB3MaVnRtp1XlBXe0xCMy81dvRWYoNHLwEzX5xCMx8FesU2cfdGLwMzX0xiRGZkRGZ0Xy9GbvNGLpZTY1EmMZVDUSFTU4VFRR9Fd4VGdsYTMfVmepNHLrJXYtJXZ0F2dvwVZnFWbp1zczV2YvJHctM3cv1Ce-cmbw5CNwgTN5YzY2YWZmdDOjdjMzYzX1EDM0kDM5EzLclDMyIDMy8CXn9Gbi9CXzV2Zh1WavwVbvNmLvR3YxUjLyM3Lc9CX6MHc0RHaiojIsJye.png)
在檔案的末尾處,我們添加
<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
load file為
~/catkin_ws/src/fmauch_universal_robot/ur_description/urdf/ur3_robot.urdf.xacro
檔案,至于為什麼是這個檔案以及這一些操作的根源是什麼,請仔細閱讀源碼,便能發現源碼是怎樣組織的。
PS.推薦使用terminator和vscode搭配來進行ros開發。
terminator允許同時多開視窗,對于整體協調工作非常友善。