Open Janphr opened 1 month ago
Spawning multiple models with DetachableJoint plugin will result in only one shared detach topic. Consider using robotNamespace like here: https://github.com/gazebosim/gz-sim/blob/6af74459f4b0f5a2a33fa112e24ac50633a90d3b/src/systems/multicopter_motor_model/MulticopterMotorModel.cc#L376 for all plugins.
https://github.com/gazebosim/gz-sim/blob/6af74459f4b0f5a2a33fa112e24ac50633a90d3b/src/systems/detachable_joint/DetachableJoint.cc#L98
std::string robotNamespace = this->model.Name(_ecm); if (_sdf->HasElement("robotNamespace")) { robotNamespace = _sdf->Get<std::string>("robotNamespace"); } // Setup detach topic std::vector<std::string> detachTopics; if (_sdf->HasElement("detach_topic")) { detachTopics.push_back(transport::TopicUtils::AsValidTopic( robotNamespace + "/" + _sdf->Get<std::string>("detach_topic"))); } else { detachTopics.push_back("/model/" + this->model.Name(_ecm) + "/detachable_joint/detach"); }
same for attach and state
Distantly related: https://github.com/gazebosim/gz-sim/pull/1097
We should probably refactor this plugin a bit.
Problem description
Spawning multiple models with DetachableJoint plugin will result in only one shared detach topic. Consider using robotNamespace like here: https://github.com/gazebosim/gz-sim/blob/6af74459f4b0f5a2a33fa112e24ac50633a90d3b/src/systems/multicopter_motor_model/MulticopterMotorModel.cc#L376 for all plugins.
Implementation suggestion
https://github.com/gazebosim/gz-sim/blob/6af74459f4b0f5a2a33fa112e24ac50633a90d3b/src/systems/detachable_joint/DetachableJoint.cc#L98
same for attach and state