Changes have been pushed for the repository "fawkes.git". (Fawkes Robotics Software Framework)
Clone: g...@git.fawkesrobotics.org:fawkes.git Gitweb: http://git.fawkesrobotics.org/fawkes.git Trac: http://trac.fawkesrobotics.org The branch, thofmann/robot-memory-pddl-duplicate-template-names has been created at d43529416c07e5fad0096ade4113ec9de9296d12 (commit) http://git.fawkesrobotics.org/fawkes.git/thofmann/robot-memory-pddl-duplicate-template-names - *Log* --------------------------------------------------------------- commit d43529416c07e5fad0096ade4113ec9de9296d12 Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> AuthorDate: Thu Jan 11 21:38:34 2018 +0100 Commit: Till Hofmann <hofm...@kbsg.rwth-aachen.de> CommitDate: Thu Jan 11 21:44:36 2018 +0100 pddl-robot-memory: check for duplicate names in problem template For each query in the problem template, we create a dictionary entry with the template name as key and the result of the query as value. If the same name is used twice in the template, then we create duplicate entries in the resulting problem. To avoid this, remember all names and their respective queries. If a name occurs again with the same query, skip querying the database and use the result from the previous query. If the queries are different, print an error message. http://git.fawkesrobotics.org/fawkes.git/commit/d435294 http://trac.fawkesrobotics.org/changeset/d435294 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *Summary* ----------------------------------------------------------- - *Diffs* ------------------------------------------------------------- - *commit* d43529416c07e5fad0096ade4113ec9de9296d12 - - - - - - - - - - Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> Date: Thu Jan 11 21:38:34 2018 +0100 Subject: pddl-robot-memory: check for duplicate names in problem template .../pddl-robot-memory/pddl_robot_memory_thread.cpp | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) _Diff for modified files_: diff --git a/src/plugins/pddl-robot-memory/pddl_robot_memory_thread.cpp b/src/plugins/pddl-robot-memory/pddl_robot_memory_thread.cpp index f288b1b..2c76485 100644 --- a/src/plugins/pddl-robot-memory/pddl_robot_memory_thread.cpp +++ b/src/plugins/pddl-robot-memory/pddl_robot_memory_thread.cpp @@ -113,6 +113,7 @@ PddlRobotMemoryThread::loop() //find queries in template size_t cur_pos = 0; + std::map<std::string, std::string> templates; while(input.find("<<#", cur_pos) != std::string::npos) { cur_pos = input.find("<<#", cur_pos) + 3; @@ -124,6 +125,18 @@ PddlRobotMemoryThread::loop() //parse: template name | query std::string template_name = input.substr(cur_pos, q_del_pos - cur_pos); std::string query_str = input.substr(q_del_pos + 1, tpl_end_pos - (q_del_pos + 1)); + if (templates.find(template_name) != templates.end()) { + if (templates[template_name] != query_str) { + logger->log_error(name(), + "Template with same name '%s' but different query '%s' vs '%s'!", + template_name.c_str(), query_str.c_str(), + templates[template_name].c_str()); + } else { + input.erase(q_del_pos, tpl_end_pos - q_del_pos); + continue; + } + } + templates[template_name] = query_str; //remove query stuff from input (its not part of the ctemplate features) input.erase(q_del_pos, tpl_end_pos - q_del_pos); -- Fawkes Robotics Framework http://www.fawkesrobotics.org _______________________________________________ fawkes-commits mailing list fawkes-commits@lists.kbsg.rwth-aachen.de https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits