From 19e66235f9e6a35fb49502b98222d477363f09e6 Mon Sep 17 00:00:00 2001 From: Sascha Jongebloed Date: Fri, 23 May 2025 15:48:41 +0200 Subject: [PATCH 1/2] Added correct configuration for logger --- src/ROSInterface.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ROSInterface.cpp b/src/ROSInterface.cpp index a5591aa..8ee0e95 100644 --- a/src/ROSInterface.cpp +++ b/src/ROSInterface.cpp @@ -41,6 +41,8 @@ ROSInterface::ROSInterface(const boost::property_tree::ptree &config) this, _1), false), tell_action_server_(nh_, "knowrob/tell", boost::bind(&ROSInterface::executeTellCB, this, _1), false), kb_(KnowledgeBase::create(config)) { + + // Start all action servers askall_action_server_.start(); askone_action_server_.start(); @@ -358,9 +360,16 @@ int main(int argc, char **argv) { InitKnowRob(argc, argv); // Load settings files + boost::property_tree::ptree config = InterfaceUtils::loadSettings(); + // configure logging + auto log_config = config.get_child_optional("logging"); + if (log_config) { + Logger::loadConfiguration(log_config.value()); + } + try { ros::init(argc, argv, "knowrob_node"); - ROSInterface ros_interface(InterfaceUtils::loadSettings()); + ROSInterface ros_interface(config); KB_INFO("[KnowRob] ROS node started."); ros::spin(); } From 03357db8a8fec6f902f7b3a63f3a89df7a4c90ea Mon Sep 17 00:00:00 2001 From: Sascha Jongebloed Date: Mon, 26 May 2025 13:49:29 +0200 Subject: [PATCH 2/2] Extended export interface --- src/ROSInterface.cpp | 12 +++++++++++- srv/ExportTriples.srv | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ROSInterface.cpp b/src/ROSInterface.cpp index 8ee0e95..992efa1 100644 --- a/src/ROSInterface.cpp +++ b/src/ROSInterface.cpp @@ -351,7 +351,17 @@ void ROSInterface::executeTellCB(const TellGoalConstPtr &goal) { bool ROSInterface::executeExportCB(ExportTriples::Request &req, ExportTriples::Response &res) { - kb_->exportTo(req.path); + // If req.format is empty or rdfxml + if (req.format == "rdfxml") { + kb_->exportTo(req.path, semweb::RDF_XML); + } else if (req.format == "turtle") { + kb_->exportTo(req.path, semweb::TURTLE); + } else { + // If the format is not supported, return false + ROS_ERROR("Export format not supported: %s", req.format.c_str()); + res.success = false; + return false; + } res.success = true; return true; } diff --git a/srv/ExportTriples.srv b/srv/ExportTriples.srv index 081c2c1..3425361 100644 --- a/srv/ExportTriples.srv +++ b/srv/ExportTriples.srv @@ -1,4 +1,5 @@ string path +string format # 'turtle' or 'rdfxml' --- # The result of the query bool success \ No newline at end of file