cyberbotics / urdf2webots

Utility to convert URDF files to Webots PROTO nodes
Apache License 2.0
132 stars 43 forks source link

How do I set the contactMaterial? #197

Closed pinkponk closed 1 year ago

pinkponk commented 1 year ago

I have a differential robot and it was not moving. I add friction between the wheels and the ground in order to get it to move but how do I set the contactMaterial to my new friction material from the URDF/xacro?

World info: (no friciton between default and some friction between wheel and default)

WorldInfo {
  contactProperties [
    ContactProperties {
      coulombFriction [
        0
      ]
    }
    ContactProperties {
      material1 "wheel"
      coulombFriction [
        1.1
      ]
    }
  ]
}

One of my wheels. How do I add the material or add friction to ground here?

    <link name="right_wheel">
        <visual>
            <geometry>
                <cylinder radius="0.05" length="0.04"/>
            </geometry>
            <material name="blue"/>
        </visual>
        <collision>
            <geometry>
                <cylinder radius="0.05" length="0.04"/>
            </geometry>
        </collision>
        <xacro:inertial_cylinder mass="0.1" length="0.04" radius="0.05">
            <origin xyz="0 0 0" rpy="0 0 0"/>
        </xacro:inertial_cylinder>
    </link>
omichel commented 1 year ago

Unfortunately, this is not yet supported by the urdf2webots script. Either you implement this feature, or you use/maintain the PROTO version of your robot instead of the URDF/xacro file, which is what I would recommend, given that Webots can export it back to URDF if needed.