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

Add package to publishers @problem::autosetup

parent 1d295f68
No related branches found
No related tags found
No related merge requests found
Pipeline #5243 failed
...@@ -30,6 +30,7 @@ class ParserYAML { ...@@ -30,6 +30,7 @@ class ParserYAML {
YAML::Node n_; YAML::Node n_;
}; };
struct PublisherManager{ struct PublisherManager{
std::string package_;
std::string subscriber_; std::string subscriber_;
std::string topic_; std::string topic_;
std::string period_; std::string period_;
......
...@@ -129,6 +129,13 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server) ...@@ -129,6 +129,13 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
l->load(); l->load();
loaders.push_back(l); loaders.push_back(l);
} }
for (auto it : _server.getParam<std::vector<std::string>>("packages")) {
std::string subscriber = packages_path + "/libpublisher_" + it + lib_extension;
WOLF_TRACE("Loading publisher " + subscriber);
auto l = new LoaderRaw(subscriber);
l->load();
loaders.push_back(l);
}
std::vector<std::string> raw_libs; std::vector<std::string> raw_libs;
try { try {
raw_libs = _server.getParam<std::vector<std::string>>("raw_libs"); raw_libs = _server.getParam<std::vector<std::string>>("raw_libs");
......
...@@ -430,12 +430,12 @@ void ParserYAML::parseFirstLevel(std::string _file) ...@@ -430,12 +430,12 @@ void ParserYAML::parseFirstLevel(std::string _file)
{ {
for (const auto& kv : n_config["ROS publisher"]) for (const auto& kv : n_config["ROS publisher"])
{ {
WOLF_DEBUG("WHAT");
PublisherManager pPublisherManager = { PublisherManager pPublisherManager = {
kv["type"].Scalar(), kv["topic"].Scalar(), kv["period"].Scalar(), kv kv["package"].Scalar(), kv["type"].Scalar(), kv["topic"].Scalar(), kv["period"].Scalar(), kv
}; };
publisher_managers_.push_back(pPublisherManager); publisher_managers_.push_back(pPublisherManager);
map_container.push_back(std::map<std::string, std::string>({ { "type", kv["type"].Scalar() }, map_container.push_back(std::map<std::string, std::string>({ { "package", kv["package"].Scalar() },
{ "type", kv["type"].Scalar() },
{ "topic", kv["topic"].Scalar() }, { "topic", kv["topic"].Scalar() },
{ "period", kv["period"].Scalar() } })); { "period", kv["period"].Scalar() } }));
} }
...@@ -445,7 +445,7 @@ void ParserYAML::parseFirstLevel(std::string _file) ...@@ -445,7 +445,7 @@ void ParserYAML::parseFirstLevel(std::string _file)
catch (YAML::InvalidNode& e) catch (YAML::InvalidNode& e)
{ {
throw std::runtime_error("Error parsing publisher @" + generatePath(_file) + throw std::runtime_error("Error parsing publisher @" + generatePath(_file) +
". Please make sure that each manager has 'type', 'topic' and 'period' entries."); ". Please make sure that each manager has 'package', 'type', 'topic' and 'period' entries.");
} }
} }
std::map<std::string, std::string> ParserYAML::getParams() std::map<std::string, std::string> ParserYAML::getParams()
...@@ -482,6 +482,8 @@ void ParserYAML::parse() ...@@ -482,6 +482,8 @@ void ParserYAML::parse()
plugins.push_back(it.plugin_); plugins.push_back(it.plugin_);
for (const auto& it : subscriber_managers_) for (const auto& it : subscriber_managers_)
packages.push_back(it.package_); packages.push_back(it.package_);
for (const auto& it : publisher_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