Skip to content
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

Make sdf::Model::CanonicalLinkAndRelativeName public #426

Merged
merged 2 commits into from
Dec 3, 2020

Conversation

azeey
Copy link
Collaborator

@azeey azeey commented Dec 1, 2020

This member function is the only way to obtain the relative name of the canonical link when the link is implicitly nested, i.e, the //model/@canonical_link attribute is empty and the canonical link resolves to a link nested in a child model. While sdf::Model::CanonicalLink can be used to resolve the link, the returned sdf::Link* can only provide the local (non-relative) name of the link.

When constructing models, a downstream application may first recursively construct internal representations of all the links of a model before creating an internal representation of a model. When doing so, the application would need to identify one of the internal links as the canonical link and associate it with the internal representation of the model. In order to use sdf::Model::CanonicalLink for this task, it becomes necessary to track the mapping between sdf::Link* and the internal links of the application. Whereas if the relative name of the canonical link is available via sdf::Model::CanonicalLinkAndRelativeName, the application can query its internal list of links by the the relative name. It's reasonable to assume that the mapping from name to internal link is maintained by any application that consumes libsdformat so using sdf::Model::CanonicalLinkAndRelativeName avoids extra overhead.

This member function is the only way to obtain the relative name of the
canonical link when the link is implicitly nested, i.e, the //model/@canonical_link
attribute is empty and the canonical link resolves to a link nested in a
child model. While `sdf::Model::CanonicalLink` can be used to resolve
the link, the returned `sdf::Link*` can only provide the local
(non-relative) name of the link.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@scpeters
Copy link
Member

scpeters commented Dec 2, 2020

sounds reasonable to me; I initially made it private to avoid exposing :: syntax in sdf9, but I think it's fine to make it public in 11. aside from adding it to the migration guide; this look good to me

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@azeey
Copy link
Collaborator Author

azeey commented Dec 2, 2020

sounds reasonable to me; I initially made it private to avoid exposing :: syntax in sdf9, but I think it's fine to make it public in 11. aside from adding it to the migration guide; this look good to me

I have updated the migration guide in 031ffbb. I put it in the "Additions" section since it's being added to the public API. Let me know if I should put it in "Modifications" instead.

@azeey azeey merged commit 983e8fa into gazebosim:master Dec 3, 2020
@azeey azeey deleted the canonical_link_relative_name branch December 3, 2020 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants