-
Notifications
You must be signed in to change notification settings - Fork 497
Fix corruption when a URDF file is included from a SDFormat 1.6 model #2734
Conversation
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
For reference, if instead I change https://github.com/osrf/gazebo/pull/2734/files#diff-b8479763685d74e12aa126230aae05ccR112 from: sdf::readFileWithoutConversion(_filename, this->dataPtr->modelSDFUnconverted,
_filename, this->dataPtr->modelSDF, errors))
errors); to sdf::readFile(_filename, this->dataPtr->modelSDFUnconverted,
_filename, this->dataPtr->modelSDF, errors))
errors); so it seems that the preview is malformed, but the final spawned model is correct. |
@traversaro Apparently I had set the sdf version to 1.7 in my |
poses even if there are errors when loading DOM objects. Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Per VC, Addisu has some tests that should show the fix, and then this will turn into a non-draft PR. |
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
I've added tests that exercise spawning a nested URDF from the GUI as well as using the |
Thanks a lot, I am checking them now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR seems great, especially the GUI tests. However, it would be useful if the PR contained a small description about the fix (just a sentence, nothing to elaborate) as I far as I understand:
This fixes #2728 by keeping an extra model that is read in without up-conversion. This is then used for serializing and sending the model to gzserver.
Is not relevant anymore.
Thanks for the review @traversaro . I've updated the PR description. |
Also, reverts addition of a new field in the Factory message. Signed-off-by: Addisu Z. Taddese <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick look at the code and added some questions.
Signed-off-by: Addisu Z. Taddese <[email protected]>
This fixes #2728 by sending the non-parsed text of the model to gzserver. Before this, when spawning a model using the GUI or the
gz
tool, the SDFormat/URDF file was parsed by libsdformat on the client side for error checking or previewing model placement in the world. This was also used to set a new name for the model. The parsed model was then reserialized to xml and sent to the server in aFactory
message. With this PR, the parsing still happens for the same reasons, but instead of reserializing the model, the original text in the file is sent over aFactory
message. To allow setting a new name, a new field ,new_name
, is added to theFactory
message type.See #2728, specifically this comment for why reserialization is a problem.