gazebosim / gazebosim/sdformat

sdf::Model::CanonicalLinkAndName returns nullptr when canonical link is an interface link

Open
#544 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
216
Forks
125
Avg merge
1d 14h
Merged PRs (30d)
14

Description

## Desired behavior
The user should have a way of getting the canonical link of a model regardless of whether the canonical link is a regular `Link` or an `InterfaceLink`. The current API has `sdf::Model::CanonicalLinkAndName` and `sdf::Model::CanonicalLink` for getting the canonical link of a model. These can only return `sdf::Link *`, so if the canonical link is an `InterfaceLink`, these functions return a `nullptr`.

## Alternatives considered
The current workaround is to use `sdf::Model::CanonicalLinkAndName` to get the name and manually search through `Link`s or `InterfaceLink`s for the link that matches the name. This is very inconvenient and it is more difficult when multiple levels of nesting is present in the model

## Implementation suggestion
n/a

## Additional context
There's a TODO in the code about this: https://github.com/osrf/sdformat/blob/25004f0bad227cf11854cc208e74be08e8623359/include/sdf/Model.hh#L312-L314

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.