英文:
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 顶部。
到目前为止,我已经完成了以下工作:
- 打开了来自 https://github.com/DFKI-NI/mir_robot 的演示在 Gazebo 中。
- 在此演示中插入了 ur10 机器人。
- 保存了生成的世界文件。
现在,在我的工作空间中,我有 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:
- Opened the demo from https://github.com/DFKI-NI/mir_robot in Gazebo.
- Inserted the ur10 robot in this demo.
- Saved the resulting world file.
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
<sdf version='1.7'>
<world name='default'>
<-- sun, ground plane etc. -->
<model name='mir'>
<-- all the specification for the mir robot I obtained from the demo -->
<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'>
<-- all the specification for the ur10 robot -->
</model>
</world>
</sdf>
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:
<robot name="mir_ur10">
<include filename="$(find mir_description)/urdf/mir.urdf.xacro"/>
<include filename="$(find ur_description)/urdf/ur10.urdf.xacro"/>
<link name="base_footprint"/>
<link name="world"/>
<joint name='connecting_joint' type='fixed'>
<origin xyz="0.5 0 0.36" rpy="0 0 0"/> <!--根据您的需要调整origin-->
<parent link="base_footprint"/> <!--父连杆-->
<child link="ur10::base"/> <!--子连杆-->
</joint>
</robot>
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:
<?xml version="1.0"?>
<launch>
<param name="robot_description"
command="$(find xacro)/xacro --inorder $(find your_package)/urdf/mir_ur10.urdf.xacro"
/>
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model"
args="-param robot_description -urdf -model mir_ur10"
/>
</launch>
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:
<robot name="mir_ur10">
<include filename="$(find mir_description)/urdf/mir.urdf.xacro"/>
<include filename="$(find ur_description)/urdf/ur10.urdf.xacro"/>
<link name="base_footprint"/>
<link name="world"/>
<joint name='connecting_joint' type='fixed'>
<origin xyz="0.5 0 0.36" rpy="0 0 0"/> <!--Adjust the origin as per your need-->
<parent link="base_footprint"/> <!--Parent link-->
<child link="ur10::base"/> <!--Child link-->
</joint>
</robot>
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:
<?xml version="1.0"?>
<launch>
<param name="robot_description"
command="$(find xacro)/xacro --inorder $(find your_package)/urdf/mir_ur10.urdf.xacro"
/>
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model"
args="-param robot_description -urdf -model mir_ur10"
/>
</launch>
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论