如何在Gazebo中将模型固定在彼此上?

huangapple go评论60阅读模式
英文:

How to fixate to models to each other in Gazebo?

问题

我有一个项目,我想在其中包括两个模型,一个 mir(https://github.com/DFKI-NI/mir_robot)和一个 ur10(https://github.com/ros-industrial/universal_robot)。

我的目标是将 ur10 固定在 mir 顶部。

到目前为止,我已经完成了以下工作:

现在,在我的工作空间中,我有 mir 和 ur10 的描述,以及用于 Gazebo 的启动和世界文件。

我很容易将 ur10 机械臂定位在 mir 顶部,但当然它没有被固定。在研究中,我发现建议的方法是在它们之间添加一个固定关节。

因此,在我的世界文件中,我添加了

<sdf version='1.7'>
   <world name='default'>
      <!-- 太阳、地面平面等 -->
      <model name='mir'>
         <!-- mir 机器人的所有规格来自演示 -->
         <joint name='connecting_joint' type='fixed'>
            <parent>base_footprint</parent>
            <child>ur10::base</child>
            <pose>0 0 0 0 0 0</pose>
         </joint>
      </model>
      <model name='ur10'>
         <!-- ur10 机器人的所有规格 -->
      </model>
   </world>
</sdf>

当我现在打开 Gazebo 时,这个关节会出现在 mir 机器人的关节列表中。但固定不起作用,ur10 仍然会掉下来。

然后我转向了 Gazebo 中的模型编辑器。但由于我不能同时编辑我的两个模型,我无法在它们之间添加关节。当我添加一个盒子并在它和 mir 之间添加固定关节时,它可以无缝工作。

我还了解了模型嵌套,但这似乎只适用于 Gazebo Classic。此外,如果固定关节是正确的做法,我想以这种方式做。

如果有人能告诉我,我做错了什么或需要额外做什么才能使这个工作,我将不胜感激。

英文:

I have a project, in which I want to include two models a mir (https://github.com/DFKI-NI/mir_robot) and a ur10 (https://github.com/ros-industrial/universal_robot).

My goal is, to fixate the ur10 on top of the mir.

What I have done so far:

Now, in my workspace I have the descriptions of the mir and the ur10, as well as the launch and world files for Gazebo.

I was easily able to position the ur10-arm on top of the mir, but of course it is not fixated. While researching this, I found that the suggested method is to add a fixed joint between them.

So, in my world file I added

&lt;sdf version=&#39;1.7&#39;&gt;
   &lt;world name=&#39;default&#39;&gt;
      &lt;-- sun, ground plane etc. --&gt;
      &lt;model name=&#39;mir&#39;&gt;
         &lt;-- all the specification for the mir robot I obtained from the demo --&gt;
         &lt;joint name=&#39;connecting_joint&#39; type=&#39;fixed&#39;&gt;
            &lt;parent&gt;base_footprint&lt;/parent&gt;
            &lt;child&gt;ur10::base&lt;/child&gt;
            &lt;pose&gt; 0 0 0 0 0 0&lt;/pose&gt;
         &lt;/joint&gt;
      &lt;/model&gt;
      &lt;model name=&#39;ur10&#39;&gt;
      &lt;-- all the specification for the ur10 robot --&gt;
      &lt;/model&gt;
   &lt;/world&gt;
&lt;/sdf&gt;

When I now open Gazebo, this joint appears in the list of joints for the mir robot. But the fixation does not work, the ur10 still falls of.

I then turned to the model editor in Gazebo. But since I cannot edit both of my models at the same time, I cannot add a joint between them. When I added a box and added the fixed joint between it and the mir, it worked flawlessly.

I have also read about model nesting, but this seems to only apply to Gazebo Classic. In addition, if fixed joint is the correct way to do this, I would like to do it this way.

If anyone can tell, what I have done wrong or what needs to be done additionally to make this work, I would be grateful.

答案1

得分: 1

以下是翻译好的部分:

"It looks like your URDF/SDF composition is correct. However, the joint that you added to the world file needs to be included in the robot URDF description itself.

The world file is not the right place to define the joint, because it doesn't know about the models you define with URDF. The world file in Gazebo is used to specify how objects, models, physics parameters, light source etc. should be initially loaded in the simulation. On the other hand, URDF (XML) format is used to represent a robot model in ROS.

That being said, you need to add that joint into the URDF file such that you specify connection between mir and ur10.

Here is a simple example how to do it in the URDF.xml:

&lt;robot name=&quot;mir_ur10&quot;&gt;
  &lt;include filename=&quot;$(find mir_description)/urdf/mir.urdf.xacro&quot;/&gt;
  &lt;include filename=&quot;$(find ur_description)/urdf/ur10.urdf.xacro&quot;/&gt;

  &lt;link name=&quot;base_footprint&quot;/&gt;
  &lt;link name=&quot;world&quot;/&gt;

  &lt;joint name=&#39;connecting_joint&#39; type=&#39;fixed&#39;&gt;
    &lt;origin xyz=&quot;0.5 0 0.36&quot; rpy=&quot;0 0 0&quot;/&gt; &lt;!--根据您的需要调整origin--&gt;
    &lt;parent link=&quot;base_footprint&quot;/&gt; &lt;!--父连杆--&gt;
    &lt;child link=&quot;ur10::base&quot;/&gt; &lt;!--子连杆--&gt;
  &lt;/joint&gt;
&lt;/robot&gt;

This example assumes that the mir robot's URDF is named mir.urdf.xacro and located in a package named mir_description, and that the ur10 robot's URDF is named ur10.urdf.xacro and located in a package named ur_description. Make sure to replace these values with actual names and locations as per your setup.

Then, you'll need to load this combined URDF into ROS parameter server and spawn it in Gazebo.

Here is an example on how to do it:

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;launch&gt;
   &lt;param name=&quot;robot_description&quot; 
          command=&quot;$(find xacro)/xacro --inorder $(find your_package)/urdf/mir_ur10.urdf.xacro&quot;
   /&gt;

   &lt;node name=&quot;spawn_urdf&quot; pkg=&quot;gazebo_ros&quot; type=&quot;spawn_model&quot; 
      args=&quot;-param robot_description -urdf -model mir_ur10&quot;
   /&gt;
&lt;/launch&gt;

This launch file first reads the mir_ur10.urdf.xacro and loads it into the ROS parameter server under a parameter named "robot_description". Then it uses gazebo_ros's spawn_model node to spawn your robot model into Gazebo."

英文:

It looks like your URDF/SDF composition is correct. However, the joint that you added to the world file needs to be included in the robot URDF description itself.

The world file is not the right place to define the joint, because it doesn't know about the models you define with URDF. The world file in Gazebo is used to specify how objects, models, physics parameters, light source etc. should be initially loaded in the simulation. On the other hand, URDF (XML) format is used to represent a robot model in ROS.

That being said, you need to add that joint into the URDF file such that you specify connection between mir and ur10.

Here is a simple example how to do it in the URDF.xml:

&lt;robot name=&quot;mir_ur10&quot;&gt;
  &lt;include filename=&quot;$(find mir_description)/urdf/mir.urdf.xacro&quot;/&gt;
  &lt;include filename=&quot;$(find ur_description)/urdf/ur10.urdf.xacro&quot;/&gt;

  &lt;link name=&quot;base_footprint&quot;/&gt;
  &lt;link name=&quot;world&quot;/&gt;

  &lt;joint name=&#39;connecting_joint&#39; type=&#39;fixed&#39;&gt;
    &lt;origin xyz=&quot;0.5 0 0.36&quot; rpy=&quot;0 0 0&quot;/&gt; &lt;!--Adjust the origin as per your need--&gt;
    &lt;parent link=&quot;base_footprint&quot;/&gt; &lt;!--Parent link--&gt;
    &lt;child link=&quot;ur10::base&quot;/&gt; &lt;!--Child link--&gt;
  &lt;/joint&gt;
&lt;/robot&gt;

This example assumes that the mir robot's URDF is named mir.urdf.xacro and located in a package named mir_description, and that the ur10 robot's URDF is named ur10.urdf.xacro and located in a package named ur_description. Make sure to replace these values with actual names and locations as per your setup.

Then, you´ll need to load this combined URDF into ROS parameter server and spawn it in Gazebo.

Here is an example on how to do it:

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;launch&gt;
   &lt;param name=&quot;robot_description&quot; 
          command=&quot;$(find xacro)/xacro --inorder $(find your_package)/urdf/mir_ur10.urdf.xacro&quot;
   /&gt;

   &lt;node name=&quot;spawn_urdf&quot; pkg=&quot;gazebo_ros&quot; type=&quot;spawn_model&quot; 
      args=&quot;-param robot_description -urdf -model mir_ur10&quot;
   /&gt;
&lt;/launch&gt;

This launch file first reads the mir_ur10.urdf.xacro and loads it into the ROS parameter server under a parameter named "robot_description". Then it uses gazebo_ros's spawn_model node to spawn your robot model into Gazebo.

huangapple
  • 本文由 发表于 2023年7月3日 22:55:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76605903.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定