Home | Tutorials | Wiki | Issues
Ask Your Question
0

Bug with colors loading from xacro in Gazebo 7 [closed]

asked 2017-04-12 03:23:49 -0500

eed gravatar image

updated 2017-04-13 01:34:29 -0500

In my model.xacro file there is:

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

And I only get an white model. If I Edit the model in Gazebo7 and write 'Gazebo/Black' in Visusal/Material/Scrip/Name it works. I want it to be black while loarding. Has someboady an idea how to fix this bug.

My launch file:

<launch>

<include file="$(find gazebo_ros)/launch/empty_world.launch">
<!-- Note: the world_name is with respect to GAZEBO_RESOURCE_PATH environmental variable -->

  <arg name="world_name" value="worlds/empty.world"/> 
  <arg name="paused" value="false"/>
  <arg name="use_sim_time" value="true"/>
  <arg name="gui" value="true"/>
  <arg name="headless" value="false"/>
  <arg name="debug" value="false"/>
  <extra_gazebo_args value="verbose" />
</include>


<include file="$(find project_gazebo)/urdf/pioneer3at_kinect.xml" />

  <node name="spawn_p3dx" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model robot_description -x -0.0 -y -0.0 -z 0.051" respawn="false" output="screen" />

</launch>

My model file:

<?xml version="1.0"?>

<robot xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
   xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
   xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
   xmlns:xacro="http://ros.org/wiki/xacro"
>

<!-- Chassis -->
<link name="base_link">
    <inertial>
        <mass value="15.0"/>
        <origin xyz="0 0 0.10"/>
        <inertia ixx="0.3338" ixy="0.0" ixz="0.0"
             iyy="0.4783" iyz="0.0"
             izz="0.3338"/>
    </inertial>
    <visual name="base_visual">
        <origin xyz="0 0 0.177" rpy="0 0 0"/>
        <geometry name="pioneer_geom">
            <mesh filename="package://project_gazebo/meshes/p3at_meshes/chassis.stl"/>
        </geometry>
                   <material name="ChassisRed">
            <color rgba="0.851 0.0 0.0 1.0"/>
                   </material>
    </visual>
    <collision>
        <origin xyz="0 0 0.177" rpy="0 0 0"/>
            <geometry>
                <mesh filename="package://project_gazebo/meshes/p3at_meshes/chassis.stl"/>
            </geometry>
    </collision>
  </link>
  <gazebo reference="base_link">
    <visual>
      <material>
        <script>
          <name value="Gazebo/Red"/>
        </script>
      </material>
    </visual>
  </gazebo>
</robot>

And the Gazbeo look like: image description

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by eed
close date 2017-04-19 04:59:36.693893

Comments

it works in my gazebo 7.0.0. Are you sure you wrote the link name correctly?

eugene-katsevman gravatar imageeugene-katsevman ( 2017-04-12 05:35:03 -0500 )edit

What's the output look like with the --verbose argument given to gazebo? If you're launching gazebo with roslaunch the arg atribute can be used to provide it http://wiki.ros.org/roslaunch/XML/node

sloretz gravatar imagesloretz ( 2017-04-12 09:40:37 -0500 )edit

the link name is corrct. It worked in ros-indigo and gazebo 2 @sloretz what exactly you mean can I just add "<extra_gazebo_args value="verbose"/>" to the launch file? I posted my launch file above

eed gravatar imageeed ( 2017-04-13 00:59:22 -0500 )edit

empty_world.launch in gazebo_ros allows enabling verbose with either <arg name="extra_gazebo_args" value="--verbose"/> or <arg name="verbose" value="true"/>

sloretz gravatar imagesloretz ( 2017-04-13 09:51:32 -0500 )edit

It won't help him much,though

eugene-katsevman gravatar imageeugene-katsevman ( 2017-04-13 09:53:47 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-04-13 09:40:42 -0500

eugene-katsevman gravatar image

updated 2017-04-13 09:49:44 -0500

Seems to be a bug in sdformat. When converting from urdf to sdf, material property is omitted in some occasions due to name mangling and link reduction. I'm digging it further.

Remove name attribute from your visual tag

UPD: And here they are:

https://bitbucket.org/osrf/sdformat/i...

https://bitbucket.org/osrf/sdformat/i...

UPD: remove name attribute from your visial tag

edit flag offensive delete link more

Comments

That worked for me. Thanks!

eed gravatar imageeed ( 2017-04-19 04:58:37 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-04-12 03:23:49 -0500

Seen: 62 times

Last updated: Apr 13