原文地址: ur3+robotiq ft sensor+robotiq 2f 140配置gazebo仿真环境
ur3+robotiq ft sensor+robotiq 2f 140配置gazebo仿真环境
搭建环境:
ubuntu: 20.04
ros: Nonetic
sensor: robotiq_ft300
gripper: robotiq_2f_140_gripper
UR: UR3
通过上一篇博客配置好ur3、力传感器和robotiq夹爪的rviz仿真环境后,现在来配置一下对应的gazebo的仿真环境
当我们启用机械臂的gazebo仿真环境时,我们使用的是下面的命令
# 启动gazebo仿真环境
roslaunch ur_gazebo ur3_bringup.launch
# 如果gazebo报错,可能是之前的没有完全关闭,需要执行killall gzserver
那么我们就从ur_gazebo中的ur3_bringup.launch
文件入手,查找在哪放力传感器和夹爪的urdf配置文件
首先,从universal_robot/ur_gazebo/launch/ur3_bringup.launch
中调用ur3的描述文件(urdf)是从下图中红框中调用,所以继续进入该文件查看
同理,load_ur3.launch.xml
文件指向下面红框的文件,继续趴
同理,load_ur.launch.xml
文件指向下面红框的文件,继续趴
同理,ur.xacro
文件指向下面第一个红框的文件,并在第二个红框中调用的它的宏函数,继续往ur_macro.xacro
文件找
可以看到universal_robot/ur_gazebo/urdf/ur_macro.xacro
文件调用了universal_robot/ur_description/urdf/inc/ur_macro.xacro
中的宏函数来包含ur3的描述文件(urdf),ur_gazebo/urdf/ur_macro.xacro
里面加上了gazebo的一些配置,我们就在加载完ur3描述文件后面加上我们的力传感器和夹爪描述文件就可以了
加入的代码和上一篇博客加入的代码一样,如下图所示
该文件完整代码如下:
<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro">
<!-- Definition of the main macro -->
<xacro:macro name="ur_robot_gazebo" params="
prefix
joint_limits_parameters_file
kinematics_parameters_file
physical_parameters_file
visual_parameters_file
transmission_hw_interface:=hardware_interface/EffortJointInterface
safety_limits:=false safety_pos_margin:=0.15 safety_k_position:=20"
>
<xacro:include filename="$(find ur_description)/urdf/inc/ur_macro.xacro"/>
<!-- Instantiate model for the REAL robot. -->
<xacro:ur_robot
prefix="${prefix}"
joint_limits_parameters_file="${joint_limits_parameters_file}"
kinematics_parameters_file="${kinematics_parameters_file}"
physical_parameters_file="${physical_parameters_file}"
visual_parameters_file="${visual_parameters_file}"
transmission_hw_interface="${transmission_hw_interface}"
safety_limits="${safety_limits}"
safety_pos_margin="${safety_pos_margin}"
safety_k_position="${safety_k_position}"
/>
<!-- Configure self collision properties per link -->
<gazebo reference="${prefix}shoulder_link">
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="${prefix}upper_arm_link">
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="${prefix}forearm_link">
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="${prefix}wrist_1_link">
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="${prefix}wrist_3_link">
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="${prefix}wrist_2_link">
<selfCollide>true</selfCollide>
</gazebo>
<gazebo reference="${prefix}ee_link">
<selfCollide>true</selfCollide>
</gazebo>
<!--
Inject Gazebo ROS Control plugin, which allows us to use ros_control
controllers to control the virtual robot hw.
-->
<gazebo>
<plugin name="ros_control" filename="libgazebo_ros_control.so">
<!--robotNamespace>/</robotNamespace-->
<!--robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType-->
</plugin>
</gazebo>
</xacro:macro>
<xacro:include filename="$(find robotiq_ft_sensor)/urdf/robotiq_ft300.urdf.xacro"/>
<xacro:include filename="$(find robotiq_2f_140_gripper_visualization)/urdf/robotiq_arg2f_140.xacro" />
<!--robotiq_ft_sensor-->
<xacro:robotiq_ft300 prefix="" parent="tool0">
<origin xyz="0 0 0" rpy="0 0 0"/>
</xacro:robotiq_ft300>
<!--robotiq_arg2f_140.xacro已经调用了robotiq_arg2f_140宏定义,这里只需要把gripper和sensor用joint连接起来即可-->
<joint name="ft_gripper_joint" type="fixed">
<parent link="robotiq_ft_frame_id"/>
<child link="robotiq_arg2f_base_link"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
</joint>
</robot>
查看效果:
运行代码,打开gazebo仿真
cd ~/catkin_ws
source devel/setup.bash
roslaunch ur_gazebo ur3_bringup.launch
注意:可以看到夹爪和力传感器是安装上去了,但是夹爪看起来要散架了,还会一直抖动,解决办法看我这篇博客
标签:仿真,文件,ft,robotiq,140,ur,ur3,gazebo From: https://www.cnblogs.com/freedom-w/p/18664803