1 #ifndef DYNAMIC_GRAPH_BRIDGE_INTERPRETER_HH 2 #define DYNAMIC_GRAPH_BRIDGE_INTERPRETER_HH 3 #pragma GCC diagnostic push 4 #pragma GCC system_header 6 #pragma GCC diagnostic pop 8 #include <dynamic_graph_bridge_msgs/RunCommand.h> 9 #include <dynamic_graph_bridge_msgs/RunPythonFile.h> 11 #include <dynamic-graph/python/interpreter.hh> 23 typedef boost::function<bool(
24 dynamic_graph_bridge_msgs::RunCommand::Request&,
25 dynamic_graph_bridge_msgs::RunCommand::Response&)>
28 typedef boost::function<bool(
29 dynamic_graph_bridge_msgs::RunPythonFile::Request&,
30 dynamic_graph_bridge_msgs::RunPythonFile::Response&)>
37 void runCommand(
const std::string& command, std::string& result,
38 std::string& out, std::string& err);
50 dynamic_graph_bridge_msgs::RunCommand::Response& res);
54 dynamic_graph_bridge_msgs::RunPythonFile::Request& req,
55 dynamic_graph_bridge_msgs::RunPythonFile::Response& res);
58 python::Interpreter interpreter_;
59 ros::NodeHandle& nodeHandle_;
60 ros::ServiceServer runCommandSrv_;
61 ros::ServiceServer runPythonFileSrv_;
boost::function< bool(dynamic_graph_bridge_msgs::RunCommand::Request &, dynamic_graph_bridge_msgs::RunCommand::Response &)> runCommandCallback_t
Definition: ros_interpreter.hh:26
This class wraps the implementation of the runCommand service.
Definition: ros_interpreter.hh:21
void runCommand(const std::string &command, std::string &result, std::string &out, std::string &err)
Method to start python interpreter and deal with messages.
Interpreter(ros::NodeHandle &nodeHandle)
boost::function< bool(dynamic_graph_bridge_msgs::RunPythonFile::Request &, dynamic_graph_bridge_msgs::RunPythonFile::Response &)> runPythonFileCallback_t
Definition: ros_interpreter.hh:31
bool runPythonFileCallback(dynamic_graph_bridge_msgs::RunPythonFile::Request &req, dynamic_graph_bridge_msgs::RunPythonFile::Response &res)
Run a Python file.
void startRosService()
Initialize service run_command.
bool runCommandCallback(dynamic_graph_bridge_msgs::RunCommand::Request &req, dynamic_graph_bridge_msgs::RunCommand::Response &res)
Run a Python command and return result, stderr and stdout.
void runPythonFile(std::string ifilename)
Method to parse python scripts.