Skip to content

Conversation

soraxas
Copy link

@soraxas soraxas commented Aug 29, 2024

The collision tag in urdf should be used to calculate the physics, instead of visual
http://wiki.ros.org/urdf/Tutorials/Adding%20Physical%20and%20Collision%20Properties%20to%20a%20URDF%20Model

(I'm not sure if this is the best way to include both

  • a visible (but non-colliding) mesh, and
  • a non-visible (but colliding) mesh.

@rydb
Copy link
Owner

rydb commented Aug 30, 2024

The collision tag in urdf should be used to calculate the physics, instead of visual http://wiki.ros.org/urdf/Tutorials/Adding%20Physical%20and%20Collision%20Properties%20to%20a%20URDF%20Model

(I'm not sure if this is the best way to include both

* a **visible** (but **non-colliding**) mesh, and

* a **non-visible** (but **colliding**) mesh

Thank you for the PR!

Could you see if you can your pr to work with the sample_robot_load.rs demo? The changes you added broke it.

Your PR:
demo_broke

This is what it should look like on load:
demo_works

@soraxas
Copy link
Author

soraxas commented Sep 3, 2024

That's because the current xml only contains collision tag and contains no visual tag. If the file is updated to be

�[32m�(B�[mdiff --git a/assets/model_pkg/urdf/diff_bot.xml b/assets/model_pkg/urdf/diff_bot.xml
index 437749a..c556099 100644
--- a/assets/model_pkg/urdf/diff_bot.xml
+++ b/assets/model_pkg/urdf/diff_bot.xml
@@ -6,9 +6,14 @@
         </inertial>
         <visual>
             <geometry>
                <mesh filename="package://model_pkg/models/base.obj"/>
             </geometry>
         </visual>
+        <collision>
+            <geometry>
+                <mesh filename="package://model_pkg/models/base.obj"/>
+            </geometry>
+        </collision>
     </link>
 
     <joint name="left_wheel_joint" type="continuous">
@@ -25,9 +30,14 @@
         </inertial>
         <visual>
             <geometry>
                <mesh filename="package://model_pkg/models/left_wheel_decimated.obj"/>
             </geometry>
         </visual>
+        <collision>
+            <geometry>
+                <mesh filename="package://model_pkg/models/left_wheel_decimated.obj"/>
+            </geometry>
+        </collision>
     </link>
 
     <joint name="right_wheel_joint" type="continuous">
@@ -44,9 +54,14 @@
         </inertial>
         <visual>
             <geometry>
                <mesh filename="package://model_pkg/models/right_wheel_decimated.obj"/>
             </geometry>
         </visual>
+        <collision>
+            <geometry>
+                <mesh filename="package://model_pkg/models/right_wheel_decimated.obj"/>
+            </geometry>
+        </collision>
     </link>
 
     <joint name="caster_wheel_joint" type="fixed">
@@ -66,6 +81,11 @@
                 <mesh filename="package://model_pkg/models/caster_wheel_decimated.obj"/>
             </geometry>
         </visual>
+        <collision>
+            <geometry>
+                <mesh filename="package://model_pkg/models/caster_wheel_decimated.obj"/>
+            </geometry>
+        </collision>
     </link>
 
 </robot>

then it will contains the original visual.


However, I came to a realisation that the current PR doesn't work as intended as the insertion of the geometry flag are getting overwritten; probably will need to insert separate entities to maintain both the visual and collision element.

@soraxas soraxas marked this pull request as draft September 3, 2024 01:24
@soraxas
Copy link
Author

soraxas commented Sep 3, 2024

An example of a urdf is the following panda arm

<robot name="panda" xmlns:xacro="http://www.ros.org/wiki/xacro">
    <link name="panda_link0">
        <visual>
            <geometry>
                <mesh filename="package://robot_resources/panda/meshes/visual/link0.dae" />
            </geometry>
        </visual>
        <collision>
            <geometry>
                <mesh filename="package://robot_resources/panda/meshes/collision/link0.stl" />
            </geometry>
        </collision>
    </link>
    <link name="panda_link1">
        <visual>
            <geometry>
                <mesh filename="package://robot_resources/panda/meshes/visual/link1.dae" />
            </geometry>
        </visual>
        <collision>
            <geometry>
                <mesh filename="package://robot_resources/panda/meshes/collision/link1.stl" />
            </geometry>
        </collision>
    </link>
    <joint name="panda_joint1" type="revolute">
        <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973" />
        <origin rpy="0 0 0" xyz="0 0 0.333" />
        <parent link="panda_link0" />
        <child link="panda_link1" />
        <axis xyz="0 0 1" />
        <limit effort="87" lower="-2.9671" upper="2.9671" velocity="2.3925" />
    </joint>
...

The visual tag is highly detailed: (the .dae file)
image

whereas the collision tag is a rough estimate: (the .stl file)
image


Using the visual tag for collision detection will makes it runs EXTREMELY slow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants