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
9 #include <dynamic_graph_bridge_msgs/RunCommand.h>
10 #include <dynamic_graph_bridge_msgs/RunPythonFile.h>
11 #include <dynamic-graph/python/interpreter.hh>
22 typedef boost::function<bool(dynamic_graph_bridge_msgs::RunCommand::Request&,
23 dynamic_graph_bridge_msgs::RunCommand::Response&)>
26 typedef boost::function<bool(dynamic_graph_bridge_msgs::RunPythonFile::Request&,
27 dynamic_graph_bridge_msgs::RunPythonFile::Response&)>
34 void runCommand(
const std::string& command, std::string& result, std::string& out, std::string& err);
46 dynamic_graph_bridge_msgs::RunCommand::Response& res);
50 dynamic_graph_bridge_msgs::RunPythonFile::Response& res);
53 python::Interpreter interpreter_;
54 ros::NodeHandle& nodeHandle_;
55 ros::ServiceServer runCommandSrv_;
56 ros::ServiceServer runPythonFileSrv_;
This class wraps the implementation of the runCommand service.
Definition: ros_interpreter.hh:20
void startRosService()
Initialize service run_command.
void runPythonFile(std::string ifilename)
Method to parse python scripts.
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 runCommand(const std::string &command, std::string &result, std::string &out, std::string &err)
Method to start python interpreter and deal with messages.
bool runPythonFileCallback(dynamic_graph_bridge_msgs::RunPythonFile::Request &req, dynamic_graph_bridge_msgs::RunPythonFile::Response &res)
Run a Python file.
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:24
boost::function< bool(dynamic_graph_bridge_msgs::RunPythonFile::Request &, dynamic_graph_bridge_msgs::RunPythonFile::Response &)> runPythonFileCallback_t
Definition: ros_interpreter.hh:28