Skip to content

Commit

Permalink
strip comments from parsed urdf (#695)
Browse files Browse the repository at this point in the history
Remove comments from urdf before trying to find packages. Otherwise non-existant packages will produce a fatal error, even though they are not used.
  • Loading branch information
azhural authored and j-rivero committed Apr 5, 2018
1 parent 3164e4c commit 6a82024
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gazebo_ros/src/gazebo_ros_api_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,18 @@ bool GazeboRosApiPlugin::spawnURDFModel(gazebo_msgs::SpawnModel::Request &req,
if (pos1 != std::string::npos && pos2 != std::string::npos)
model_xml.replace(pos1,pos2-pos1+2,std::string(""));
}

// Remove comments from URDF
{
std::string open_comment("<!--");
std::string close_comment("-->");
size_t pos1;
while((pos1 = model_xml.find(open_comment,0)) != std::string::npos){
size_t pos2 = model_xml.find(close_comment,0);
if (pos2 != std::string::npos)
model_xml.replace(pos1,pos2-pos1+3,std::string(""));
}
}

// Now, replace package://xxx with the full path to the package
{
Expand Down

0 comments on commit 6a82024

Please sign in to comment.