-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser treats missing required elements inconsistently #428
Comments
this check has no test coverage as of c1e703d. it may be dead code |
This adds two model files with joints that are missing the //joint/child element, one with a fixed joint and the other a ball joint. The parser treats these joint types differently (see gazebosim#428). Signed-off-by: Steve Peters <[email protected]>
This adds two model files with joints that are missing the //joint/child element, one with a fixed joint and the other a ball joint. The parser treats these joint types differently (see gazebosim#428). Signed-off-by: Steve Peters <[email protected]>
I've added some example files with missing fixed_joint_child_missing.sdf has a hard failure when trying to print it:
ball_joint_child_missing.sdf is able to print successfully, with the
This is an invalid value, though, so
|
The
If we want the parser to perform both of these behaviors, I would propose creating a new attribute like |
Would this be an attribute that the person writing the SDF file would set? I'm not sure about the use case for this, could you write an example? Just checking my understanding about default values. I'm not sure what the current behaviour is, but maybe something like this could work?
This way, the SDF spec could define whether to fail softly with an error message or hard by not parsing, by defining a default value or not. |
Having a required attribute with a default value can be useful when an SDFormat element or attribute changes from being optional to being required and we want to tick-tock the change by assigning a default value. So, what @chapulina suggested in the table sounds good to me. I would support removing the default values we currently have, but I'm afraid it might break some things. |
First noticed in #389 (comment):
In researching how to respond to this comment I found some inconsistent code (code links from 10.0.0)
Near the beginning of readXml() in parser.cc, there is a block of code that looks like it fails hard whenever a required element is missing
Later in the function (parser.cc:1131-1156), there is code that generates errors if any required child elements are missing, but only for joints that aren't of type
ball
! This seems to apply to//joint/parent
and//joint/child
. But for anything else, required elements are simply inserted with default values and no error message.I'll try to make examples that illustrate the different types of behavior here.
The text was updated successfully, but these errors were encountered: