Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I get the collision model right in xacro robot urdf?

I have a .dae file that I transformed from a .stl file that serves as the mesh in my xacro file. However, I tried to use the same .dae file in the collision section, but when I launch gazebo the robot just spins out of control.

I've been trying to follow the project DAVE tutorial for uav's but there is a lot of information missing.

    <?xml version="1.0"?>
     All rights reserved.

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.

<robot name="test" xmlns:xacro="" >

  <xacro:arg name="debug" default="0"/>
  <xacro:arg name="namespace" default="test"/>

  <!-- "Dummy" base link to eliminate root link inertia warning --> 
  <link name="$(arg namespace)/base_link"/>

  <link name="$(arg namespace)/test_link">

      <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="34.622"/>
        ixx="47.76" ixy="0.0" ixz="0.0"
        iyy="47.73" iyz="0.14"
      <origin xyz="0 0 0" rpy="1.5708 0 0"/>
        <mesh filename="package://test_description/meshes/robot_wedge_mast.dae" scale="0.02 0.02 0.02"/>
      <origin xyz="0 0 0" rpy="0 0 1.5708"/>
        <mesh filename="package://test_description/meshes/robot_wedge_mast.dae" scale="0.02 0.02 0.02"/>

  <!-- Attach test_link to the dummy base link -->
  <joint name="$(arg namespace)/test_base_joint" type="fixed">
    <origin xyz="0 0 0" rpy="0 0 0"/>  <!-- X-fwd, Y-lft, Z-up (ick!) -->
    <parent link="$(arg namespace)/base_link"/>
    <child link="$(arg namespace)/test_link"/>

   <plugin name="gazebo_ros_control" filename="">
     <robotNamespace>/$(arg namespace)</robotNamespace>
     <robotParam>/$(arg namespace)/test</robotParam>

 <!-- Define thrusters for propulsion -->
 <xacro:property name="prop_mesh_file" value="file://$(find test_description)/meshes/robotics_propeller.dae"/>
 <!-- Common values, colors, converstion, standard shapes/inertia etc.
      Dependency for the thruster_snippets.xacro-->
 <xacro:include filename="$(find uuv_descriptions)/urdf/common.urdf.xacro"/>
 <!-- Various thruster models -->
 <xacro:include filename="$(find uuv_gazebo_ros_plugins)/urdf/thruster_snippets.xacro"/>
 <!-- Substitute the ECA A9 prop mesh for the larger uuv_descriptions one -->
 <!--<xacro:property name="prop_mesh_file" value="file://$(find eca_a9_description)/mesh/eca_a9_propeller.dae"/>-->

  <!-- Thruster joint and link snippet
       Wrapper for the the thruster_module_first_order_basic_fcn_macro
       defined in uuv_gazebo_ros_plugins/urdf/thruster_snippet.
       Uses the "thruster_cf_basic_macro"
         1) Basic curve
       Input: x
       Output: thrust
       Function: thrust = rotorConstant * x * abs(x)
  <xacro:macro name="thruster_macro"
               params="thruster_id *origin">
        namespace="$(arg namespace)"
        scale = "0.02 0.02 0.02"
        rotor_constant="0.0001">  <!-- This is a guess for now (~1/3 RexROV) -->
      <xacro:insert_block name="origin"/>

  <xacro:thruster_macro thruster_id="0">
    <origin xyz="-1.2 -0.415 -0.09" rpy="${0*d2r} ${0*d2r} ${150.0*d2r}"/>

 <!-- Default joint state publisher -->
   <plugin name="uuv_joint_state_publisher" filename="">
     <robotNamespace>$(arg namespace)</robotNamespace>