gazebosim / gazebosim/sdformat

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

Open
#1,592 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
216
Forks
125
Avg merge
1d 14h
Merged PRs (30d)
14

Description

## 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 `` is specified, density is [documented as *not* required with a default value](http://sdformat.org/spec?ver=1.12&elem=link#inertial_density). Therefore, if I skip the child element `` 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](https://github.com/gazebosim/sdformat/blob/sdf16/src/Collision.cc#L298-L308). 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






1



```

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.

Contributor guide

Open the contributing guide

Research direction

Start in src/Collision.cc around lines 298-308 and reproduce the issue with the XML example, focusing on the auto-inertia path when density is omitted. Trace how the documented default density is reported and determine whether completion should produce no error or only a warning, then verify the parser's resulting diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.