Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions src/ROSInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -349,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;
}
Expand All @@ -358,9 +370,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();
}
Expand Down
1 change: 1 addition & 0 deletions srv/ExportTriples.srv
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
string path
string format # 'turtle' or 'rdfxml'
---
# The result of the query
bool success