Skip to content

Commit

Permalink
Remove namespace tags from from the node arguments to fix the namespa…
Browse files Browse the repository at this point in the history
…ce issue described in ros-controls#127

Also remove superfluous ROS_ARGS_FLAG
  • Loading branch information
ben.holden committed Feb 24, 2023
1 parent cea0546 commit a18aeb6
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions gazebo_ros2_control/src/gazebo_ros2_control_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,24 +204,10 @@ void GazeboRosControlPlugin::Load(gazebo::physics::ModelPtr parent, sdf::Element

if (sdf->HasElement("ros")) {
sdf = sdf->GetElement("ros");

// Set namespace if tag is present
if (sdf->HasElement("namespace")) {
std::string ns = sdf->GetElement("namespace")->Get<std::string>();
// prevent exception: namespace must be absolute, it must lead with a '/'
if (ns.empty() || ns[0] != '/') {
ns = '/' + ns;
}
std::string ns_arg = std::string("__ns:=") + ns;
arguments.push_back(RCL_REMAP_FLAG);
arguments.push_back(ns_arg);
}

// Get list of remapping rules from SDF
if (sdf->HasElement("remapping")) {
sdf::ElementPtr argument_sdf = sdf->GetElement("remapping");

arguments.push_back(RCL_ROS_ARGS_FLAG);
while (argument_sdf) {
std::string argument = argument_sdf->Get<std::string>();
arguments.push_back(RCL_REMAP_FLAG);
Expand Down

0 comments on commit a18aeb6

Please sign in to comment.