Home | Tutorials | Wiki | Issues
Ask Your Question
0

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

asked 2016-09-26 04:59:55 -0600

Franzisdrak gravatar image

updated 2016-09-26 09:37:38 -0600

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>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-09-26 05:38:03 -0600

nzlz gravatar image

updated 2016-09-26 05:38:19 -0600

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>
edit flag offensive delete link more

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?

Franzisdrak gravatar imageFranzisdrak ( 2016-09-26 07:35:20 -0600 )edit

The URDF I tested is the following: https://gist.github.com/Nestor94Gonzalez/877adf2b7e63dda66ad0f3bc7f02096a . I just place that code before the final </robot> 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 .

nzlz gravatar imagenzlz ( 2016-09-26 08:21:59 -0600 )edit

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!

Franzisdrak gravatar imageFranzisdrak ( 2016-09-26 09:24:07 -0600 )edit

<gazebo reference="wheel_f_l"> <visual> <material> <ambient>0 0 0 1</ambient> <diffuse>0 0 0 1</diffuse> <specular>0.1 0.1 0.1 1 5.0</specular> <emissive>0 0 0 1</emissive> </material> </visual> wont work :/

Franzisdrak gravatar imageFranzisdrak ( 2016-09-26 09:29:25 -0600 )edit

Can you share your URDF file?

nzlz gravatar imagenzlz ( 2016-09-26 10:12:59 -0600 )edit

@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...

plusk01 gravatar imageplusk01 ( 2017-01-05 00:04:10 -0600 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2016-09-26 04:59:55 -0600

Seen: 463 times

Last updated: Sep 26 '16