Skip to content

auto spatial inertia calculation fallback to documented default density is treated as an error #1592

@SeanCurtis-TRI

Description

@SeanCurtis-TRI

Environment

  • OS Version: Ubuntu 24.04
  • Source or binary build? Source from 15.3.0 (although the points below apply equally well to main).

Description

  • Expected behavior: if <inertial auto="true"> is specified, density is documented as not required with a default value. Therefore, if I skip the child element <density> in my specification, I expect things to proceed apace, picking up the default value as documented (and as occurs throughout when we devolve to the default value).

  • Actual behavior: When the default density is used, an error is dispatched. For any user of SDFormat that is taking errors seriously, this renders (what should be) a valid file, invalid.

Steps to reproduce

Simply parse something akin to:

<?xml version="1.0"?>
<sdf xmlns:drake="http://drake.mit.edu" version="1.8">
  <model name='model'>
    <link name='body'>
      <inertial auto="true"/>
      <collision name="collision">
        <geometry>
          <sphere><radius>1</radius></sphere>
        </geometry>
      </collision>
    </link>
  </model>
</sdf>

and look at the errors.

It seems the error should be demoted to warning (at most). Although, the warning can possibly be reconsidered completely in light of how other non-required elements there are with their own default values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions