gazebosim/sdformat

`/test/sdf/model_nested_static_model.sdf` doesn't define a `@canonical_link`

Open

#718 opened on Sep 28, 2021

View on GitHub
 (4 comments) (0 reactions) (0 assignees)C++ (122 forks)auto 404
bughelp wanted

Repository metrics

Stars
 (216 stars)
PR merge metrics
 (PR metrics pending)

Description

This could be related to me not having full knowledge of the @canonical_link resolution rules. The current order that I am aware of is:

  1. If @canonical_link is set, use that link
  2. If @canonical_link is missing, but the model has at least one direct child //link use the first link
  3. If @canonical_link is missing, direct //links are missing, and the model has a nested //model or //include use the nested models's __model__ frame (https://github.com/ignitionrobotics/sdformat/issues/705#issuecomment-926909748)
  4. The canonical_link is undefined / the SDF is faulty

With this in mind, the following SDF (/test/sdfmodel_nested_static_model.sdf) would be invalid in v1.8:

<?xml version="1.0" ?>
<sdf version='1.8'>
  <model name="model_nested_static_model">
    <model name="child_model">
      <model name="static_model">
        <static>true</static>
      </model>
    </model>
  </model>
</sdf>

static_model has neither child //links nor child //models, which makes the canonical link undetermined. The fact that it is //static will make its __model__ frame attach to world, and as such it would be possible to resolve all frame positions again, but - as far as I know - this behavior is currently not part of the spec.

On a tangent: It also strikes me as a bit odd that a __model__ frame can become a @canonical_link in this particular situation ... I believe it is not valid to directly/explicitly set it in this way? The frame is - technically - not a link, but rather a //link is a frame/frame-bearing.

My suggestion for resolving it would be to add a dummy link in static_model.

Contributor guide