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

Should allow "drilling down" into nested model frames #293

Closed
EricCousineau-TRI opened this issue May 28, 2020 · 7 comments · Fixed by #381
Closed

Should allow "drilling down" into nested model frames #293

EricCousineau-TRI opened this issue May 28, 2020 · 7 comments · Fixed by #381
Assignees

Comments

@EricCousineau-TRI
Copy link
Collaborator

Towards #278

Should happen after #283

Some options:

  • Just "hoist" duplicates of the frames (and frame graphs) with {model_name}::{frame_name}
  • Actually try to parse the name and actually navigate down
@EricCousineau-TRI EricCousineau-TRI changed the title Allow "drilling down" into nested model frames Should allow "drilling down" into nested model frames May 28, 2020
scpeters added a commit to scpeters/sdformat that referenced this issue Jul 24, 2020
@scpeters
Copy link
Member

Some User Story ideas for this feature:

  • Loading a model that contains :: syntax for referencing frames inside a nested model in the following places:
    • //joint/parent
    • //joint/child
    • //frame/@attached_to
    • //pose/@relative_to
  • Resolving a SemanticPose to a nested frame (i.e. link->SemanticPose.Resolve(pose, "nestedModel::nestedLink");)
  • Resolving the attached-to body for a frame attached to a nested link (i.e. it returns "nestedModel::nestedLink")
  • Resolving the attached-to body for a frame attached to a nested model to the canonical link of that nested model
  • Resolving a joint parent/child to a nested link (i.e. it returns "nestedModel::nestedLink")
  • Support passing scoped names to the following functions:
    • Model::ModelByName
    • Model::LinkByName
    • Model::JointByName
    • Model::FrameByName
  • Getting a SemanticPose object corresponding to a scoped frame name (i.e. Errors Model::SemanticPoseByName(std::unique_ptr<SemanticPose> &_semanticPose, const std::string _scopedFrameName)). We could actually implement an unscoped version of this in libsdformat9 that just checks the Links, Joints, and Frames in the current model for matches with the passed name and returns the SemanticPose of the named object.

@scpeters
Copy link
Member

Support passing scoped names to the following functions:

* Model::ModelByName

* Model::LinkByName

* Model::JointByName

* Model::FrameByName

I've prototyped a variation on this in scpeters@9eec062 by adding Model::*ByNestedName and Model::*NestedNameExists methods that accept a :: delimited name while leaving the existing APIs unchanged.

@EricCousineau-TRI
Copy link
Collaborator Author

EricCousineau-TRI commented Aug 13, 2020

For supergraph + subgraph assembly, scoping, and queries, options for recursion:

  • Copy + Graft
  • Scoped Alias + Propagate
    Pros/cons are in maintaining invariants and ease of local checks (e.g. encapsulation at each level).

For element queries, e.g. LinkByName vs. LinkByNestedName, LinkByName being able to resolve with "::" may be the best for backwards compatibility (the legacy composition behavior for include) as well as being able to easily resolve elements (e.g. Joint::ResolveChildLinkX()).

scpeters added a commit to scpeters/sdformat that referenced this issue Aug 13, 2020
@scpeters
Copy link
Member

scpeters commented Aug 14, 2020

For element queries, e.g. LinkByName vs. LinkByNestedName, LinkByName being able to resolve with "::" may be the best for backwards compatibility (the legacy composition behavior for include) as well as being able to easily resolve elements (e.g. Joint::ResolveChildLinkX()).

I reverted the new APIs in my prototype branch in bd618e9 and added :: syntax to the existing APIs instead.

scpeters added a commit that referenced this issue Aug 17, 2020
Nested model elements (`//model/model`) are currently supported in the
SDFormat 1.7 spec, but are not supported by the DOM API or frame
semantics operations in libsdformat 9.2.
Per Amendment 1 of the SDFormat 1.7 proposal
(sdformat.org/tutorials?tut=pose_frame_semantics_proposal#amendment-1-directly-nested-models),
this PR adds support for nested models in the DOM API and frame
semantics (fixing #283) through three steps:

* adding `Model::Model*` methods for accessing nested models via
  the DOM API (047ec96)
* loading nested models in `Model::Load` (b57fea2, step 3 of model parsing
  stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))
* supporting nested models (`//model/model`) in frame semantics as
  opaque frames to match how models in the world scope (`//world/model`)
  are treated (85e0b4f, steps 6-9 of model parsing stages
  (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))

The first two steps are straightforward, while the 3rd step adds new behavior.
This behavior is added to `libsdformat9` because it is compatible with the
SDFormat 1.7 spec (which supports nested models) and makes the treatment
of models more consistent with regard to frame semantics.
In libsdformat 9.2.0, a `//world/model` supports frame semantics: they have
frames that can be referenced by name with `//pose/@relative_to` and
`//world/frame/@attached_to` values can resolve to a `//world/model`.
This extends that same behavior to nested `//model/model` elements;
they now have their own frames in the frame and pose graphs, and a
`//model/frame` is permitted to attach to a model.

This does not add support for referencing elements within a model via
the `::` syntax in the frame semantics or DOM APIs.
That will be added in SDFormat 1.8 (see #293).

Signed-off-by: Steve Peters <[email protected]>
scpeters added a commit to scpeters/sdformat that referenced this issue Aug 17, 2020
Nested model elements (`//model/model`) are currently supported in the
SDFormat 1.7 spec, but are not supported by the DOM API or frame
semantics operations in libsdformat 9.2.
Per Amendment 1 of the SDFormat 1.7 proposal
(sdformat.org/tutorials?tut=pose_frame_semantics_proposal#amendment-1-directly-nested-models),
this PR adds support for nested models in the DOM API and frame
semantics (fixing gazebosim#283) through three steps:

* adding `Model::Model*` methods for accessing nested models via
  the DOM API (047ec96)
* loading nested models in `Model::Load` (b57fea2, step 3 of model parsing
  stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))
* supporting nested models (`//model/model`) in frame semantics as
  opaque frames to match how models in the world scope (`//world/model`)
  are treated (85e0b4f, steps 6-9 of model parsing stages
  (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))

The first two steps are straightforward, while the 3rd step adds new behavior.
This behavior is added to `libsdformat9` because it is compatible with the
SDFormat 1.7 spec (which supports nested models) and makes the treatment
of models more consistent with regard to frame semantics.
In libsdformat 9.2.0, a `//world/model` supports frame semantics: they have
frames that can be referenced by name with `//pose/@relative_to` and
`//world/frame/@attached_to` values can resolve to a `//world/model`.
This extends that same behavior to nested `//model/model` elements;
they now have their own frames in the frame and pose graphs, and a
`//model/frame` is permitted to attach to a model.

This does not add support for referencing elements within a model via
the `::` syntax in the frame semantics or DOM APIs.
That will be added in SDFormat 1.8 (see gazebosim#293).

Signed-off-by: Steve Peters <[email protected]>
scpeters added a commit that referenced this issue Aug 17, 2020
Nested model elements (`//model/model`) are currently supported in the
SDFormat 1.7 spec, but are not supported by the DOM API or frame
semantics operations in libsdformat 9.2.
Per Amendment 1 of the SDFormat 1.7 proposal
(sdformat.org/tutorials?tut=pose_frame_semantics_proposal#amendment-1-directly-nested-models),
this PR adds support for nested models in the DOM API and frame
semantics (fixing #283) through three steps:

* adding `Model::Model*` methods for accessing nested models via
  the DOM API (047ec96)
* loading nested models in `Model::Load` (b57fea2, step 3 of model parsing
  stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))
* supporting nested models (`//model/model`) in frame semantics as
  opaque frames to match how models in the world scope (`//world/model`)
  are treated (85e0b4f, steps 6-9 of model parsing stages
  (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))

The first two steps are straightforward, while the 3rd step adds new behavior.
This behavior is added to `libsdformat9` because it is compatible with the
SDFormat 1.7 spec (which supports nested models) and makes the treatment
of models more consistent with regard to frame semantics.
In libsdformat 9.2.0, a `//world/model` supports frame semantics: they have
frames that can be referenced by name with `//pose/@relative_to` and
`//world/frame/@attached_to` values can resolve to a `//world/model`.
This extends that same behavior to nested `//model/model` elements;
they now have their own frames in the frame and pose graphs, and a
`//model/frame` is permitted to attach to a model.

This does not add support for referencing elements within a model via
the `::` syntax in the frame semantics or DOM APIs.
That will be added in SDFormat 1.8 (see #293).

Signed-off-by: Steve Peters <[email protected]>
scpeters added a commit to scpeters/sdformat that referenced this issue Aug 17, 2020
Nested model elements (`//model/model`) are currently supported in the
SDFormat 1.7 spec, but are not supported by the DOM API or frame
semantics operations in libsdformat 9.2.
Per Amendment 1 of the SDFormat 1.7 proposal
(sdformat.org/tutorials?tut=pose_frame_semantics_proposal#amendment-1-directly-nested-models),
this PR adds support for nested models in the DOM API and frame
semantics (fixing gazebosim#283) through three steps:

* adding `Model::Model*` methods for accessing nested models via
  the DOM API (047ec96)
* loading nested models in `Model::Load` (b57fea2, step 3 of model parsing
  stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))
* supporting nested models (`//model/model`) in frame semantics as
  opaque frames to match how models in the world scope (`//world/model`)
  are treated (85e0b4f, steps 6-9 of model parsing stages
  (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))

The first two steps are straightforward, while the 3rd step adds new behavior.
This behavior is added to `libsdformat9` because it is compatible with the
SDFormat 1.7 spec (which supports nested models) and makes the treatment
of models more consistent with regard to frame semantics.
In libsdformat 9.2.0, a `//world/model` supports frame semantics: they have
frames that can be referenced by name with `//pose/@relative_to` and
`//world/frame/@attached_to` values can resolve to a `//world/model`.
This extends that same behavior to nested `//model/model` elements;
they now have their own frames in the frame and pose graphs, and a
`//model/frame` is permitted to attach to a model.

This does not add support for referencing elements within a model via
the `::` syntax in the frame semantics or DOM APIs.
That will be added in SDFormat 1.8 (see gazebosim#293).

Signed-off-by: Steve Peters <[email protected]>
scpeters added a commit to scpeters/sdformat that referenced this issue Aug 17, 2020
Nested model elements (`//model/model`) are currently supported in the
SDFormat 1.7 spec, but are not supported by the DOM API or frame
semantics operations in libsdformat 9.2.
Per Amendment 1 of the SDFormat 1.7 proposal
(sdformat.org/tutorials?tut=pose_frame_semantics_proposal#amendment-1-directly-nested-models),
this PR adds support for nested models in the DOM API and frame
semantics (fixing gazebosim#283) through three steps:

* adding `Model::Model*` methods for accessing nested models via
  the DOM API (047ec96)
* loading nested models in `Model::Load` (b57fea2, step 3 of model parsing
  stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))
* supporting nested models (`//model/model`) in frame semantics as
  opaque frames to match how models in the world scope (`//world/model`)
  are treated (85e0b4f, steps 6-9 of model parsing stages
  (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))

The first two steps are straightforward, while the 3rd step adds new behavior.
This behavior is added to `libsdformat9` because it is compatible with the
SDFormat 1.7 spec (which supports nested models) and makes the treatment
of models more consistent with regard to frame semantics.
In libsdformat 9.2.0, a `//world/model` supports frame semantics: they have
frames that can be referenced by name with `//pose/@relative_to` and
`//world/frame/@attached_to` values can resolve to a `//world/model`.
This extends that same behavior to nested `//model/model` elements;
they now have their own frames in the frame and pose graphs, and a
`//model/frame` is permitted to attach to a model.

This does not add support for referencing elements within a model via
the `::` syntax in the frame semantics or DOM APIs.
That will be added in SDFormat 1.8 (see gazebosim#293).

An expected console message was updated in a test while
merging forward to libsdformat11.

Signed-off-by: Steve Peters <[email protected]>
scpeters added a commit that referenced this issue Aug 18, 2020
Nested model elements (`//model/model`) are currently supported in the
SDFormat 1.7 spec, but are not supported by the DOM API or frame
semantics operations in libsdformat 9.2.
Per Amendment 1 of the SDFormat 1.7 proposal
(sdformat.org/tutorials?tut=pose_frame_semantics_proposal#amendment-1-directly-nested-models),
this PR adds support for nested models in the DOM API and frame
semantics (fixing #283) through three steps:

* adding `Model::Model*` methods for accessing nested models via
  the DOM API (047ec96)
* loading nested models in `Model::Load` (b57fea2, step 3 of model parsing
  stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))
* supporting nested models (`//model/model`) in frame semantics as
  opaque frames to match how models in the world scope (`//world/model`)
  are treated (85e0b4f, steps 6-9 of model parsing stages
  (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))

The first two steps are straightforward, while the 3rd step adds new behavior.
This behavior is added to `libsdformat9` because it is compatible with the
SDFormat 1.7 spec (which supports nested models) and makes the treatment
of models more consistent with regard to frame semantics.
In libsdformat 9.2.0, a `//world/model` supports frame semantics: they have
frames that can be referenced by name with `//pose/@relative_to` and
`//world/frame/@attached_to` values can resolve to a `//world/model`.
This extends that same behavior to nested `//model/model` elements;
they now have their own frames in the frame and pose graphs, and a
`//model/frame` is permitted to attach to a model.

This does not add support for referencing elements within a model via
the `::` syntax in the frame semantics or DOM APIs.
That will be added in SDFormat 1.8 (see #293).

An expected console message was updated in a test while
merging forward to libsdformat11.

Signed-off-by: Steve Peters <[email protected]>
@EricCousineau-TRI
Copy link
Collaborator Author

@azeey is looking into the global graph.

@EricCousineau-TRI
Copy link
Collaborator Author

Per f2f, summary on global graph is to couple the scoping and encapsulation to call sites (e.g. at each query to large graph from elements) -- vs. having some special aliasing view.

traversaro pushed a commit to traversaro/sdformat that referenced this issue Sep 5, 2020
Nested model elements (`//model/model`) are currently supported in the
SDFormat 1.7 spec, but are not supported by the DOM API or frame
semantics operations in libsdformat 9.2.
Per Amendment 1 of the SDFormat 1.7 proposal
(sdformat.org/tutorials?tut=pose_frame_semantics_proposal#amendment-1-directly-nested-models),
this PR adds support for nested models in the DOM API and frame
semantics (fixing gazebosim#283) through three steps:

* adding `Model::Model*` methods for accessing nested models via
  the DOM API (047ec96)
* loading nested models in `Model::Load` (b57fea2, step 3 of model parsing
  stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))
* supporting nested models (`//model/model`) in frame semantics as
  opaque frames to match how models in the world scope (`//world/model`)
  are treated (85e0b4f, steps 6-9 of model parsing stages
  (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model))

The first two steps are straightforward, while the 3rd step adds new behavior.
This behavior is added to `libsdformat9` because it is compatible with the
SDFormat 1.7 spec (which supports nested models) and makes the treatment
of models more consistent with regard to frame semantics.
In libsdformat 9.2.0, a `//world/model` supports frame semantics: they have
frames that can be referenced by name with `//pose/@relative_to` and
`//world/frame/@attached_to` values can resolve to a `//world/model`.
This extends that same behavior to nested `//model/model` elements;
they now have their own frames in the frame and pose graphs, and a
`//model/frame` is permitted to attach to a model.

This does not add support for referencing elements within a model via
the `::` syntax in the frame semantics or DOM APIs.
That will be added in SDFormat 1.8 (see gazebosim#293).

Signed-off-by: Steve Peters <[email protected]>
@EricCousineau-TRI EricCousineau-TRI assigned azeey and unassigned scpeters Sep 10, 2020
@EricCousineau-TRI
Copy link
Collaborator Author

Per f2f, global graph w/ tests working.

Currently working on how to validate graphs (e.g. handling the no-longer-opaque nested models)
Has scoped graph (via weak_ptr), adds some scoping context.

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 a pull request may close this issue.

3 participants