Skip to content
Snippets Groups Projects
Commit 3540b88d authored by Joaquim Casals Buñuel's avatar Joaquim Casals Buñuel
Browse files

Rename Callbacks -> SubscriberManager; Subscriber->Type

parent 5b156a7b
No related branches found
No related tags found
No related merge requests found
Pipeline #4653 passed
...@@ -180,7 +180,7 @@ class ParserYAML { ...@@ -180,7 +180,7 @@ class ParserYAML {
std::string _plugin; std::string _plugin;
YAML::Node n; YAML::Node n;
}; };
struct Callbacks{ struct SubscriberManager{
std::string _package; std::string _package;
std::string _subscriber; std::string _subscriber;
std::string _topic; std::string _topic;
...@@ -196,7 +196,7 @@ class ParserYAML { ...@@ -196,7 +196,7 @@ class ParserYAML {
std::string _file; std::string _file;
bool _relative_path; bool _relative_path;
std::string _path_root; std::string _path_root;
std::vector<Callbacks> _callbacks; std::vector<SubscriberManager> _subscriber_managers;
YAML::Node problem; YAML::Node problem;
std::string generatePath(std::string); std::string generatePath(std::string);
YAML::Node loadYAML(std::string); YAML::Node loadYAML(std::string);
...@@ -212,7 +212,7 @@ public: ...@@ -212,7 +212,7 @@ public:
_active_name = ""; _active_name = "";
_paramsSens = std::vector<ParamsInitSensor>(); _paramsSens = std::vector<ParamsInitSensor>();
_paramsProc = std::vector<ParamsInitProcessor>(); _paramsProc = std::vector<ParamsInitProcessor>();
_callbacks = std::vector<Callbacks>(); _subscriber_managers = std::vector<SubscriberManager>();
_raw_libs = std::vector<std::string>(); _raw_libs = std::vector<std::string>();
_parsing_file = std::stack<std::string>(); _parsing_file = std::stack<std::string>();
_file = file; _file = file;
...@@ -418,20 +418,19 @@ void ParserYAML::parseFirstLevel(std::string file){ ...@@ -418,20 +418,19 @@ void ParserYAML::parseFirstLevel(std::string file){
throw std::runtime_error("Error parsing processors @" + generatePath(file) + ". Please make sure that each processor has 'type', 'name', 'plugin' and 'sensor_name' entries."); throw std::runtime_error("Error parsing processors @" + generatePath(file) + ". Please make sure that each processor has 'type', 'name', 'plugin' and 'sensor_name' entries.");
} }
try { try {
for (const auto &kv : n_config["callbacks"]) { for (const auto &kv : n_config["ROS subscriber managers"]) {
Callbacks pCallback = {kv["package"].Scalar(), kv["subscriber"].Scalar(), kv["topic"].Scalar(), kv["sensor_name"].Scalar(), kv}; SubscriberManager pSubscriberManager = {kv["package"].Scalar(), kv["type"].Scalar(), kv["topic"].Scalar(), kv["sensor_name"].Scalar(), kv};
_callbacks.push_back(pCallback); _subscriber_managers.push_back(pSubscriberManager);
map_container.push_back(std::map<std::string, std::string>({ map_container.push_back(std::map<std::string, std::string>({
{"package", kv["package"].Scalar()}, {"package", kv["package"].Scalar()},
{"subscriber", kv["subscriber"].Scalar()}, {"type", kv["type"].Scalar()},
{"topic", kv["topic"].Scalar()}, {"topic", kv["topic"].Scalar()},
{"sensor_name", kv["sensor_name"].Scalar()}})); {"sensor_name", kv["sensor_name"].Scalar()}}));
} }
insert_register("callbacks", insert_register("ROS subscriber managers", wolf::converter<std::string>::convert(map_container));
wolf::converter<std::string>::convert(map_container));
map_container.clear(); map_container.clear();
} catch (YAML::InvalidNode &e) { } catch (YAML::InvalidNode &e) {
throw std::runtime_error("Error parsing callbacks @" + generatePath(file) + ". Please make sure that each callback has 'package', 'subscriber', 'topic' and 'sensor_name' entries."); throw std::runtime_error("Error parsing subscriber managers @" + generatePath(file) + ". Please make sure that each manager has 'package', 'subscriber', 'topic' and 'sensor_name' entries.");
} }
//TODO: Defined for testing purposes, maybe should be removed when releasing //TODO: Defined for testing purposes, maybe should be removed when releasing
...@@ -466,7 +465,7 @@ void ParserYAML::parse(){ ...@@ -466,7 +465,7 @@ void ParserYAML::parse(){
std::list<std::string> plugins, packages; std::list<std::string> plugins, packages;
for(const auto &it : this->_paramsSens) plugins.push_back(it._plugin); for(const auto &it : this->_paramsSens) plugins.push_back(it._plugin);
for (const auto &it : this->_paramsProc) plugins.push_back(it._plugin); for (const auto &it : this->_paramsProc) plugins.push_back(it._plugin);
for(const auto &it : this->_callbacks) packages.push_back(it._package); for(const auto &it : this->_subscriber_managers) packages.push_back(it._package);
plugins.sort(); plugins.sort();
plugins.unique(); plugins.unique();
packages.sort(); packages.sort();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment