spawning object, not visible in gazebo

asked 2019-10-22 06:54:38 -0600

Hi guys,

I am currently trying to spawn a stationnary object from a .urdf (.xacro) file, but cannot see it in gazebo. I am aware that this question was asked here already: https://answers.ros.org/question/2719... and the problum was that there was no inertia, but I have and inertia included. Cosonle output tells me that the object was spawned sucesfully. I have followed this tutorial: https://wiki.ros.org/pr2_simulator/Tu...

Console command:

rosrun gazebo_ros spawn_model -urdf -file src/sim_1/urdf/station.xacro -model station -x 0.0 -y 2.0 -z 0.695

Console output:


[INFO] [1571744435.509164]: Loading model XML from file src/sim_1/urdf/station.xacro
[INFO] [1571744435.519742]: Waiting for service /gazebo/spawn_urdf_model
[INFO] [1571744435.524289]: Calling service /gazebo/spawn_urdf_model
[INFO] [1571744435.647025]: Spawn status: SpawnModel: Successfully spawned entity

Here is my xacro file:


<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="station">
  <!--origin xyz="0 2 0" rpy="0 0 0"/-->
  <xacro:property name="cantiliver_thickness" value="0.01"/>
  <xacro:property name="cantiliver_length" value="1.74"/>
  <xacro:property name="cantiliver_width" value="0.08"/>
  <xacro:property name="base_width" value="0.2"/>
  <xacro:property name="base_length" value="1.476"/>
  <xacro:property name="base_height" value="0.2"/>
  <xacro:property name="leg_width" value="0.1"/>
  <xacro:property name="leg_height" value="0.685"/>

  <xacro:macro name="box_inertia" params="m w h d">
    <inertial>
      <mass value="${m}"/>
      <inertia ixx="${m / 12.0 * (d*d + h*h)}" ixy="0.0" ixz="0.0" iyy="${m / 12.0 * (w*w + h*h)}" iyz="0.0" izz="${m / 12.0 * (w*w + d*d)}"/>
    </inertial>
  </xacro:macro>

  <link name="station_body">
    <inertial>
      <mass value="10.0" />
      <inertia  ixx="1.0" ixy="0.0"  ixz="0.0"  iyy="1.0"  iyz="0.0"  izz="1.0" />
    </inertial>
    <visual>
      <material name="silver">
        <color rgba="0.75 0.75 0.75 1"/>
      </material>
      <geometry>
        <box size="${base_length} ${base_width} ${base_height}"/>
      </geometry>
    </visual>
    <collision>
      <geometry>
        <box size="${base_length} ${base_width} ${base_height}"/>
      </geometry>
    </collision>
    <visual>
       <origin xyz="${base_length/2-leg_width/2} 0 ${-base_height/2-leg_height/2}" rpy="0 0 0" />
      <geometry>
        <box size="${leg_width} ${leg_width} ${leg_height}"/>
      </geometry>
    </visual>
    <collision>
      <origin xyz="${base_length/2-leg_width/2} 0 ${-base_height/2-leg_height/2}" rpy="0 0 0" />
      <geometry>
        <box size="${leg_width} ${leg_width} ${leg_height}"/>
      </geometry>
    </collision>
    <visual>
       <origin xyz="${-base_length/2+leg_width/2} 0 ${-base_height/2-leg_height/2}" rpy="0 0 0" />
      <geometry>
        <box size="${leg_width} ${leg_width} ${leg_height}"/>
      </geometry>
    </visual>
    <collision>
      <origin xyz="${-base_length/2+leg_width/2} 0 ${-base_height/2-leg_height/2}" rpy="0 0 0" />
      <geometry>
        <box size="${leg_width} ${leg_width} ${leg_height}"/>
      </geometry>
    </collision>
    <visual>
      <origin xyz="${-base_length/2+leg_width/2} ${-cantiliver_length/2-base_width/2} ${-base_height/2+base_height/2}" rpy="0 0 0" />
      <geometry>
        <box size="${cantiliver_width} ${cantiliver_length} ${cantiliver_width}"/>
      </geometry>
    </visual>
    <collision>
      <origin xyz="${-base_length/2+leg_width/2} ${-cantiliver_length/2-base_width/2} ${-base_height/2+base_height/2}" rpy="0 0 0" />
      <geometry>
        <box size="${cantiliver_width} ${cantiliver_length} ${cantiliver_width}"/>
      </geometry>
    </collision>
    <visual>
      <origin xyz="${base_length/2-leg_width/2} ${-cantiliver_length/2-base_width/2} ${-base_height/2+base_height/2}" rpy="0 0 0" />
      <geometry>
        <box size="${cantiliver_width} ${cantiliver_length} ${cantiliver_width}"/>
      </geometry>
    </visual>
    <collision>
      <origin xyz ...
(more)
edit retag flag offensive close merge delete