环境
ROS Noetic
Ubuntu 20.04
UR10e
Onrobot RG2 Gripper
之前在ROS:UR10e配置Onrobot RG2夹爪(rviz环境)已经配置好了rviz环境下的RG2夹爪,模拟真是物理环境还需要在gazebo中配置夹爪
配置过程
初步配置
在gazebo中打开rg2是通过以下命令roslaunch onrobot_rg_gazebo bringup_rg2_gazebo.launch
,打开ur10e是通过roslaunch onrobot_rg_gazebo ur10e_bringup.launch
,从ur10e_bringup.launch
一步步来看如何改
ur10e_bringup.launch
中
load_ur10.launch.xml
中
load_ur10.launch.xml
中
ur.xacro
中,用到了ur_macro.xacro
的宏定义ur_robot_gazebo
所以最后指向ur_macro.xacro
,在这个文件中调用了ur_description/urdf/inc/ur_macro.xacro
中的宏函数来包含ur(ur10e)的描述文件,ur_gazebo/urdf/ur_macro.xacro
里面加上了gazebo的一些配置,在加载完ur(ur10e)描述文件后面加上夹爪描述文件就可以了
整个的文件指向关系是:
完整的ur_gazebo/urdf/ur_macro.xacro
文件内容:
<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro">
<!--
Main xacro macro definition of the "Gazebo robot" model.
This wraps the model of the real robot and adds all elements and parameters
required by Gazebo.
It also adds the gazebo_ros_control plugin.
NOTE: this is NOT a URDF. It cannot directly be loaded by consumers
expecting a flattened '.urdf' file. See the top-level '.xacro' for that
(but note: that .xacro must still be processed by the xacro command).
For use in '.launch' files: use one of the 'load_urX.launch' convenience
launch files.
NOTE: this Gazebo model makes use of the same set of parameter files as the
main xacro macro (in ur_description). It is therefor possible to use the
kinematic calibration exported from a REAL UR robot. Please refer to the
ur_macro.xacro in ur_description for more information about this.
Main author of the migration to yaml configs: Ludovic Delval.
Contributors to previous versions (in no particular order):
- Felix Messmer
- Kelsey Hawkins
- Shaun Edwards
- Alexander Bubeck
- Nadia Hammoudeh Garcia
- G. vd. Hoorn
- Dave Niewinski
- Andy Zelenak
- Miguel Prada
- Mathias Luedtke
- Hans-Joachim Krauch
- Felix Exner
-->
<!-- 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"
>
<!--
Import the xacro macro for the REAL robot (which we'll augment with Gazebo
specific elements in the wrapper macro below).
NOTE: this imports the '_macro.xacro' from ur_description, as that contains
the definitions for the real robot.
-->
<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>
<!-- copy ur10e_rg2_d415.xacro here -->
<!-- Gripper RG2 -->
<xacro:include filename="$(find onrobot_rg_description)/urdf/onrobot_rg2_model_macro.xacro"/>
<xacro:onrobot_rg2 prefix=""/>
<!-- Attach the RG2 gripper to the UR10e tool0 link -->
<joint name="rg2_joint" type="fixed">
<parent link="tool0"/>
<child link = "onrobot_rg2_base_link"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
</joint>
</robot>
运行结果
cd ~/ur_ws
source devel/setup.bash
roslaunch ur_gazebo ur10e_bringup.launch
运行结果是已经在ur10e上装上rg2夹爪,但是会有抖动现象,具体解决方法可以看我的下一篇博客