From 24d4406c91f417c2d7c25e15548a760aabcba526 Mon Sep 17 00:00:00 2001 From: Simon Rasmussen Date: Thu, 1 Mar 2018 10:07:44 +0100 Subject: [PATCH] Fixed compatability issue Pre-refactor version of URScript topic used to automatically append newline when not the last character of the message however that was not the case for the new version. --- src/ros/urscript_handler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ros/urscript_handler.cpp b/src/ros/urscript_handler.cpp index c2e5fe7..3b5dafd 100644 --- a/src/ros/urscript_handler.cpp +++ b/src/ros/urscript_handler.cpp @@ -13,10 +13,14 @@ URScriptHandler::URScriptHandler(URCommander &commander) void URScriptHandler::urscriptInterface(const std_msgs::String::ConstPtr& msg) { LOG_INFO("Message received"); + std::string str(msg->data); + if (str.back() != '\n') + str.append('\n'); + switch (state_) { case RobotState::Running: - if (!commander_.uploadProg(msg->data)) + if (!commander_.uploadProg(str)) { LOG_ERROR("Program upload failed!"); }