RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.35k stars 1.27k forks source link

sdformat: Should ensure filename / lineno is included in diagnostic mechanism #17053

Closed EricCousineau-TRI closed 1 year ago

EricCousineau-TRI commented 2 years ago

Context: https://github.com/RobotLocomotion/drake/issues/16784#issuecomment-1111470081

FYI @azeey - you think this is something we can do in next ~month? (hopefully low-hanging fruit)

jwnimmer-tri commented 2 years ago

FYI in Drake's URDF parser, we have a sugar class to assist with reporting line numbers: detail_tinyxml2_diagnostic.h.

\CC @rpoyner-tri for any other thoughts

rpoyner-tri commented 2 years ago

Having not actually re-read all of the sdformat parser code, I suspect we can do something very similar, or even extend/rework some of the existing urdf solution.

sammy-tri commented 2 years ago

I've started something like this while working on #16785 https://github.com/sammy-tri/drake/blob/sdformat_warn_unsupported/multibody/parsing/detail_sdf_diagnostic.cc

azeey commented 2 years ago

@EricCousineau-TRI , yes, we can queue this up, unless @sammy-tri's work resolves this.

sammy-tri commented 2 years ago

I certainly don't mind working on it while I'm in there adding the other diagnostic stuff. Feel free to reassign to me.

EricCousineau-TRI commented 2 years ago

@marcoag said he has this en queue, assigning @azeey as proxy. Thanks!

@marcoag Can you comment on this issue so we can assign you?

marcoag commented 2 years ago

Sorry missed the ping.

This issue might benefit on the completion of https://github.com/gazebosim/sdformat/issues/820.

Adding some examples on the current status of the SDF side so we can further discuss:

error: An axis must be specified for joint 'slider'

RuntimeError: error: Joint type of nontknowntype is invalid. Refer to the SDF documentation for a list of valid joint types

I'm a bit unsure of the scope of the issue is it to ensure that if a filename/lineno is reported then it's included in the diagnostic mechanism? is it to make sure SDFormat always reports filename/lineno? do we also want it from the errors at the detail_sdf_parser.cc level?

EricCousineau-TRI commented 1 year ago

FTR, just reflecting VC: Yeah, it would be nice to root-cause why the two XML-valid but SDFormat-invalid wrong things fail (bad joint axis, bad joint type), and see if we can fix those.

For the "Unable to read SDF string", it would be nice to somehow make it clear that it is a clear string. Suggestion was to surround in quotes if string is only whitespace or empty; otherwise, just print string in following line.

EricCousineau-TRI commented 1 year ago

Resolved by https://github.com/RobotLocomotion/drake/pull/18462