Is it possible to have both fixed and dynamic objects in Urdf Model? [closed]
Hi,
I want to create a simple urdf object consisting of a:
- Box_A, which is fixed in the world. No matter what external forces apply on it, it should stay in the same place. (fixed)
- Box_B, which is connect to Box_A with a revolute joint. (dynamic)
In " http://answers.ros.org/question/29437/possible-to-declare-static-object-in-urdf-file/ " a way to this was figured out using a world link:
<robot name="Test" xmlns:controller="..." xmlns:interface="..." xmlns:sensor="...">
<link name="world" />
<link name="Box_A">
... definition of the box
</link>
<link name="Box_B">
... definition of the box
</link>
<joint name="world_joint" type="fixed">
<!-- Here I have to define the global position of Box_A -->
<origin rpy="0 0 0" xyz="0 0 1"/>
<parent link="world"/>
<child link="Box_A"/>
</joint>
<joint name="boxa_to_boxb_joint" type="revolute">
<axis xyz="1 0 0"/>
<origin rpy="0 0 0" xyz="-0.15 0.1 0.00"/>
<limit effort="0.01" lower="-3.14159265359" upper="1.57079632679" velocity="0.001"/>
<parent link="Box_A"/>
<child link="Box_B"/>
<dynamics damping="1.0" friction="1.0"/>
<safety_controller k_velocity="0.1"/>
</joint>
</robot>
This code works fine, resulting in a swinging Box connected to a fixed Box. However, this solution blocks the possibility to spawn the object at a certain position at runtime.
Can you think of other solutions which still use the spawn_urdf_model service's parameters (position, orientation)? For example, something like to use a static modifier on Box_A?
<gazebo reference="Box_A">
<static>true</static>
</gazebo>
But that does unfortunately not work for me.
Thank you in advance, Johannes
Is it possible to write this as xacro then pass parameters in when launching?
Thanks for this idea. I have now written it as a xacro file. I include the needed height variables using environment variables. It is not very clean but it works.
Run in bash before: "export TEST_POS_X=4" In urdf.xacro included: "$(optenv TEST_POS_X 0)". Zero is default
not sure exactly what you mean, I was thinking more of the gazebo_worlds/table file more than anything else. Have you taken a look at that launch file? You should be able to do a similar thing and still launch your models from the command line...
The table launch files runs the spawn_model node. Unfortunately, if I use: "<link name="world" />" as my urdf's root node this makes the spawn_model node ignore all the position parameters i give it. The model will always be aligned to 0,0,0 then.
This would be more relevant on [Gazebo Answers](http://answers.gazebosim.org/questions/). URDF does not have the notion of static/moving objects as the virtual joint linking the object to the environment is (usually) not expressed. With SDF it would be different.