diff --git a/include/dynamic_graph_bridge/ros_interpreter.hh b/include/dynamic_graph_bridge/ros_interpreter.hh index ed6173e8fbba0c7d6059e2d1223c8f890c76ef6c..271562cb40b8fc53c51fe9bb3755b03ed5a89b0f 100644 --- a/include/dynamic_graph_bridge/ros_interpreter.hh +++ b/include/dynamic_graph_bridge/ros_interpreter.hh @@ -23,6 +23,9 @@ namespace dynamicgraph explicit Interpreter (ros::NodeHandle& nodeHandle); + /// \brief Run a command and return result. + std::string runCommand (const std::string& command); + protected: /// \brief Run a Python command and return result, stderr and stdout. bool runCommandCallback (dynamic_graph_bridge::RunCommand::Request& req, diff --git a/src/ros_interpreter.cpp b/src/ros_interpreter.cpp index fac3a751d0686b44a615840d57f39d648dd88a4a..d9a4ca9ceb008a53d505a6b670e7ceaf263d29ab 100644 --- a/src/ros_interpreter.cpp +++ b/src/ros_interpreter.cpp @@ -17,11 +17,19 @@ namespace dynamicgraph } bool - Interpreter::runCommandCallback(dynamic_graph_bridge::RunCommand::Request& req, - dynamic_graph_bridge::RunCommand::Response& res) + Interpreter::runCommandCallback + (dynamic_graph_bridge::RunCommand::Request& req, + dynamic_graph_bridge::RunCommand::Response& res) { interpreter_.python(req.input, res.result, res.stdout, res.stderr); return true; } + + std::string + Interpreter::runCommand + (const std::string& command) + { + return interpreter_.python(command); + } } // end of namespace dynamicgraph.