Robotics StackExchange | Archived questions

<gazebo reference=""> not loaded from urdf.xacro Gazebo6

Hello Everyone,

Using Gazebo6.6, Ros Indigo.

I am using a .xacro to generate my model spawn it via the spawn model plugin.

Lately i was trying to change the colors of my vehicle in the simulation. But for some reason none of my tries resulted in a change of color in my simulation. I definied a reference for each link but still no results.

Here is how i load the gazebo tag:

<gazebo reference="wheel_f_l">
     <material>
          <script>Gazebo/Black</script>
        </material>
    </gazebo>

Even with:

<gazebo reference="wheel_f_l">
     <material>Gazebo/Black</material>
    </gazebo>

it doesn't work. Though setting the colors for visualization via rgba in Rviz works. Did anybody experience sth. similar. It should work, because i saw many examples on github etc. Did i miss something? Help would be very appriciated.

EDIT: some of my launch file

<launch>

<...>

  <!-- start gazebo server-->
  <node name="gazebo" pkg="gazebo_ros" type="gzserver" respawn="false" output="screen" args="$(arg command_arg1) $(arg world_name) --verbose" />

      <!-- load vehicle description to the parameter server -->
  <param name="robot_description" command="$(find xacro)/xacro.py '$(arg robot_model)' tf_prefix:='$(arg tf_prefix)' ns:='$(arg robot_ns)'" />

  <group ns="$(arg robot_ns)">

    <!-- load vehicle description to the parameter server -->
    <param name="robot_description" command="$(find xacro)/xacro.py '$(arg robot_model)' tf_prefix:='$(arg tf_prefix)' ns:='$(arg robot_ns)'" />

    <!-- spawn vehicle model in gazebo -->
    <node name="spawn_robot_model" pkg="gazebo_ros" type="spawn_model"
      args="-param robot_description
      -urdf
      -x $(arg pos_x)
      -y $(arg pos_y)
      -z $(arg pos_z)
      -Y $(arg yaw)
      -model $(arg robot_name)"
      respawn="false" output="screen"/>


</launch>

Asked by Franzisdrak on 2016-09-26 04:59:55 UTC

Comments

Answers

The following code works for me:

  <gazebo reference="wheel_f_l">
    <visual>
      <material>
        <script>
          <uri>file://media/materials/scripts/gazebo.material</uri>
          <name>Gazebo/Black</name>
        </script>
        <emissive>0 0 0 1</emissive>
      </material>
    </visual>
  </gazebo>

Asked by nzlz on 2016-09-26 05:38:03 UTC

Comments

Tried it without success. Do you include the gazebo references at the end of your xacro or do you load them via a second file which you include at the beginning?

Asked by Franzisdrak on 2016-09-26 07:35:20 UTC

The URDF I tested is the following: https://gist.github.com/Nestor94Gonzalez/877adf2b7e63dda66ad0f3bc7f02096a . I just place that code before the final tag. Make sure you see 'wheel_f_l' as a model link in gazebo (some links are not visible in gazebo when using urdf). If the problem is the uri, you can replace the script part with this code: https://gist.github.com/Nestor94Gonzalez/54c7af6f134e2072d304e316d4ea9d88

.

Asked by nzlz on 2016-09-26 08:21:59 UTC

My filepath to the gazebo default materials was different. Didnt find where the default material are on my setup but i will try with replacing the script part with what you sent. Ty so far!

Asked by Franzisdrak on 2016-09-26 09:24:07 UTC

0 0 0 1 0 0 0 1 0.1 0.1 0.1 1 5.0 0 0 0 1

wont work :/

Asked by Franzisdrak on 2016-09-26 09:29:25 UTC

Can you share your URDF file?

Asked by nzlz on 2016-09-26 10:12:59 UTC

@Nestor94Gonzalez What version of Gazebo did you get this working with? I'm using Gazebo7/Kinetic and my URDF's also show up white. I believe it is happening at the step where Gazebo converts the UDRF to SDF (gz sdf -p model.urdf). I'm wondering if this is a bug in Gazebo/SDF...

Asked by plusk01 on 2017-01-05 01:04:10 UTC