Skip to content

Commit

Permalink
Revert behavior change introduced in gazebosim#2452
Browse files Browse the repository at this point in the history
PR gazebosim#2452 changed the loading order of plugins attached to worlds and models. While the change is desirable, it changed the behavior of functions like `topicFromScopedName`. This reverts the behavior and the changes in associated tests.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
  • Loading branch information
azeey committed Aug 16, 2024
1 parent 007aa87 commit b96f8af
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions src/SdfEntityCreator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void SdfEntityCreator::CreateEntities(const sdf::World *_world,
levelEntityNames.find(model->Name()) != levelEntityNames.end())

{
Entity modelEntity = this->CreateEntities(model, false);
Entity modelEntity = this->CreateEntities(model);

this->SetParent(modelEntity, _worldEntity);
}
Expand Down Expand Up @@ -387,7 +387,7 @@ void SdfEntityCreator::CreateEntities(const sdf::World *_world,
if (_world->ModelNameExists(_ref->Data()))
{
const sdf::Model *model = _world->ModelByName(_ref->Data());
Entity modelEntity = this->CreateEntities(model, false);
Entity modelEntity = this->CreateEntities(model);
this->SetParent(modelEntity, _worldEntity);
this->SetParent(_entity, modelEntity);
}
Expand Down Expand Up @@ -450,17 +450,13 @@ void SdfEntityCreator::CreateEntities(const sdf::World *_world,
this->dataPtr->ecm->CreateComponent(
_worldEntity, components::WorldSdf(*_world));

// Load world plugins first.
this->dataPtr->eventManager->Emit<events::LoadSdfPlugins>(_worldEntity,
_world->Plugins());

GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
this->dataPtr->eventManager->Emit<events::LoadPlugins>(_worldEntity,
_world->ToElement());
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION

// Load model plugins after the world plugin.
this->LoadModelPlugins();
}

//////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ void LogicalAudioSensorPluginPrivate::CreateAudioSource(
};

// create services for this source
const auto validName = topicFromScopedName(entity, _ecm, true);
const auto validName = topicFromScopedName(entity, _ecm, false);
if (validName.empty())
{
gzerr << "Failed to create valid topics with entity scoped name ["
Expand Down Expand Up @@ -503,7 +503,7 @@ void LogicalAudioSensorPluginPrivate::CreateMicrophone(

// create the detection publisher for this microphone
auto pub = this->node.Advertise<msgs::Double>(
topicFromScopedName(entity, _ecm, true) + "/detection");
topicFromScopedName(entity, _ecm, false) + "/detection");
if (!pub)
{
gzerr << "Error creating a detection publisher for microphone "
Expand Down
2 changes: 1 addition & 1 deletion src/systems/pose_publisher/PosePublisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void PosePublisher::Configure(const Entity &_entity,
this->dataPtr->usePoseV =
_sdf->Get<bool>("use_pose_vector_msg", this->dataPtr->usePoseV).first;

std::string poseTopic = topicFromScopedName(_entity, _ecm, true) + "/pose";
std::string poseTopic = topicFromScopedName(_entity, _ecm, false) + "/pose";
if (poseTopic.empty())
{
poseTopic = "/pose";
Expand Down

0 comments on commit b96f8af

Please sign in to comment.