Skip to content

Gazebo material format #1534

@Tacha-S

Description

@Tacha-S

SDF allows the use of script within the material definition, and in gz simulator, the material tag inside the gazebo tag also supports script.
However, when specifying it as follows, gz simulator requests a string upon startup.

http://sdformat.org/spec?ver=1.12&elem=material

sdformat/src/parser_urdf.cc

Lines 1317 to 1321 in 2b583cb

// material
if (strcmp(childElem->Name(), "material") == 0)
{
sdf->material = GetKeyValueAsString(childElem);
}

<gazebo reference="link1">
      <material>
        <script>
          <uri>file://media/materials/scripts/gazebo.material</uri>
          <name>Gazebo/Black</name>
        </script>
      </material>
    </gazebo>

Environment

  • OS Version: Ubuntu 24.04
  • Source or binary build: Binary 14.6.0

Description

  • Expected behavior:
    NO warning.
  • Actual behavior:
    Attribute value string not set is shown.

Steps to reproduce

  1. Set material color to a link
<gazebo reference="link1">
      <material>
        <script>
          <uri>file://media/materials/scripts/gazebo.material</uri>
          <name>Gazebo/Black</name>
        </script>
      </material>
    </gazebo>
  1. launch gz server

Output

[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set
[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set
[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set
[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set
[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set
[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set
[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set
[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set
[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set
[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set
[gazebo-1] Warning [parser_urdf.cc:1220] Attribute value string not set

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions