0
$\begingroup$

Environment:
$\space$ OS: Linux Ubuntu 22.04
$\space$ gazebo version: garden
Problem:
$\space$ I downloaded the sdf from here, it is supposed to look like this enter image description here $\space$ but in my simulation it looks like this enter image description here I think it's caused by some errors when loading the matetial, in model.sdf the material element looks like this.

<material>
      <script>
        <uri>materials/scripts/</uri>
        <uri>materials/textures/</uri>
        <name>RoboCup/Carpet</name>
      </script>
    </material>

I read the Material.cc in sdfformat/src and I found that the script seems to have been implemented here.

if (_sdf->HasElement("script"))
  {
    sdf::ElementPtr elem = _sdf->GetElement("script", errors);
    std::pair<std::string, bool> uriPair =
        elem->Get<std::string>(errors, "uri", "");
    if (uriPair.first == "__default__")
      uriPair.first = "";

    if (!uriPair.second || uriPair.first.empty())
    {
      errors.push_back({ErrorCode::ELEMENT_INVALID,
          "A <script> element is missing a child <uri> element, or the "
          "<uri> element is empty."});
    }

    this->dataPtr->scriptUri = resolveURI(uriPair.first, _config, errors);

    std::pair<std::string, bool> namePair =
        elem->Get<std::string>(errors, "name", "");
    if (namePair.first == "__default__")
      namePair.first = "";

    if (!namePair.second || namePair.first.empty())
    {
      errors.push_back({ErrorCode::ELEMENT_MISSING,
          "A <script> element is missing a child <name> element, or the "
          "<name> element is empty."});
    }
    this->dataPtr->scriptName = namePair.first;
  }

so maybe there's something wrong in rendering? I wonder.

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Sim does not support the material script, this is mentioned in the migration guide.

The proposed alternatives are to either use plain colours, or to use textures.

$\endgroup$
2
  • $\begingroup$ I tried the pbr in material. But pbr do not have a scale element in sdf, is there any method to save this. $\endgroup$ Commented Oct 6, 2023 at 7:33
  • $\begingroup$ What I would do is to redraw that model in Blender, apply the texture, export as DAE and load the DAE as mesh in the SDF. $\endgroup$
    – JRTG
    Commented Oct 6, 2023 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.