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> 10 #include <dynamic-graph/python/interpreter.hh> 21 typedef boost::function<bool(dynamic_graph_bridge_msgs::RunCommand::Request&,
22 dynamic_graph_bridge_msgs::RunCommand::Response&)>
25 typedef boost::function<bool(dynamic_graph_bridge_msgs::RunPythonFile::Request&,
26 dynamic_graph_bridge_msgs::RunPythonFile::Response&)>
33 void runCommand(
const std::string& command, std::string& result, std::string& out, std::string& err);
45 dynamic_graph_bridge_msgs::RunCommand::Response& res);
49 dynamic_graph_bridge_msgs::RunPythonFile::Response& res);
52 python::Interpreter interpreter_;
53 ros::NodeHandle& nodeHandle_;
54 ros::ServiceServer runCommandSrv_;
55 ros::ServiceServer runPythonFileSrv_;
This class wraps the implementation of the runCommand service.
Definition: ros_interpreter.hh:19
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::RunCommand::Request &, dynamic_graph_bridge_msgs::RunCommand::Response &)> runCommandCallback_t
Definition: ros_interpreter.hh:23
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.
Definition: ros_init.hh:5
boost::function< bool(dynamic_graph_bridge_msgs::RunPythonFile::Request &, dynamic_graph_bridge_msgs::RunPythonFile::Response &)> runPythonFileCallback_t
Definition: ros_interpreter.hh:27
void runPythonFile(std::string ifilename)
Method to parse python scripts.