@@ -91,12 +91,12 @@ SensorParserMap getSensorParsers(const std::vector<std::string> &allowed)
9191{
9292 static boost::mutex PARSER_PLUGIN_LOCK;
9393 static boost::shared_ptr<pluginlib::ClassLoader<urdf::SensorParser> > PARSER_PLUGIN_LOADER;
94- static SensorParserMap defaultParserMap;
95-
9694 boost::mutex::scoped_lock _ (PARSER_PLUGIN_LOCK);
95+
96+ SensorParserMap parserMap;
9797 try
9898 {
99- if (!PARSER_PLUGIN_LOADER) {
99+ if (!PARSER_PLUGIN_LOADER)
100100 PARSER_PLUGIN_LOADER.reset (new pluginlib::ClassLoader<urdf::SensorParser>(" urdf" , " urdf::SensorParser" ));
101101
102102 const std::vector<std::string> &classes = PARSER_PLUGIN_LOADER->getDeclaredClasses ();
@@ -112,18 +112,17 @@ SensorParserMap getSensorParsers(const std::vector<std::string> &allowed)
112112 } catch (const pluginlib::PluginlibException& ex) {
113113 ROS_ERROR_STREAM (" Failed to create sensor parser: " << classes[i] << " \n " << ex.what ());
114114 }
115- defaultParserMap .insert (std::make_pair (classes[i], parser));
115+ parserMap .insert (std::make_pair (classes[i], parser));
116116 ROS_DEBUG_STREAM (" added sensor parser: " << classes[i]);
117117 }
118- if (defaultParserMap .empty ())
118+ if (parserMap .empty ())
119119 ROS_WARN_STREAM (" No sensor parsers found" );
120- }
121120 }
122121 catch (const pluginlib::PluginlibException& ex)
123122 {
124123 ROS_ERROR_STREAM (" Exception while creating sensor plugin loader " << ex.what ());
125124 }
126- return defaultParserMap ;
125+ return parserMap ;
127126}
128127
129128SensorParserMap getSensorParser (const std::string &name)
0 commit comments