gz-sim
gz-sim copied to clipboard
Sensor component name not set from the SDF
Environment
- OS Version: Ubuntu 20.04
- Source or binary build? Binay Fortress
Description
- Expected behavior: When I retrieve a sensor component in the
Config
function I expect to get the correct name as set in the SDF. - Actual behavior: sensor component name is always
__default__
Steps to reproduce
Example with a camera sensor:
auto camComp = _ecm.Component<ignition::gazebo::components::Camera>(_entity);
igndbg << "Camera name (from sensor): " << camComp->Data().CameraSensor()->Name() << std::endl;
igndbg << "Camera name (from component): " << camComp->Data().Name() << std::endl;
Output
[Dbg] [CameraSystem.cc:78] Camera name (from sensor): __default__
[Dbg] [CameraSystem.cc:79] Camera name (from component): camera
The recommended way of getting an entity's name from the ECM is through the components::Name
component. The sensor components holding SDF elements will often not have duplicated data that's already available on other components.