Surface properties won't take effect in xacro

asked 2017-08-11 10:03:46 -0600

JD-ETH gravatar image

I have been using RotorS simulator to simulate drones. For our purpose we need to look into the collision behavior, and thus make changes to the surface properties. However, my change to surface properties won't take effect. The model will go back to its default value when simulation starts. For now I have been manually editing the surface properties within gazebo, but I would like to fix this.

  <xacro:macro name="multirotor_base_macro"
params="robot_namespace mass body_width body_height use_mesh_file mesh_file *inertia">
<link name="${robot_namespace}/base_link"></link>

<joint name="${robot_namespace}/base_joint" type="fixed">
  <origin xyz="0 0 0" rpy="0 0 0" />
  <parent link="${robot_namespace}/base_link" />
  <child link="${robot_namespace}/base_link_inertia" />
</joint>

<link name="${robot_namespace}/base_link_inertia">
  <inertial>
    <mass value="${mass}" />  <!-- [kg] -->
    <origin xyz="0 0 0" />
    <xacro:insert_block name="inertia" />
  </inertial>

  <visual>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
      <xacro:if value="${use_mesh_file}">
        <mesh filename="${mesh_file}" scale="1 1 1" />
      </xacro:if>
      <xacro:unless value="${use_mesh_file}">
        <box size="${body_width} ${body_width} ${body_height}"/>
      </xacro:unless>
    </geometry>
  </visual>

  <collision>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
      <mesh filename="${collision_file}" scale="1 1 1" />
    </geometry>
    <surface>
      <friction>
        <ode mu="0.4" mu2="0.4" />
      </friction>
      <bounce restitution_coefficient="0.7" threshold="0.1" />
      <contact>
        <ode max_vel="10.00"  />
      </contact>
    </surface>
  </collision>
</link>

<gazebo>
  <plugin filename="librotors_gazebo_multirotor_base_plugin.so" name="multirotor_base_plugin">
    <robotNamespace>${robot_namespace}</robotNamespace>
    <linkName>${robot_namespace}/base_link</linkName>
    <rotorVelocitySlowdownSim>${rotor_velocity_slowdown_sim}</rotorVelocitySlowdownSim>
  </plugin>
</gazebo>

</xacro:macro>

I am unsure where I made mistakes. The drone is able to spawn correctly.

edit retag flag offensive close merge delete