This class wraps the implementation of the runCommand service. More...
#include <dynamic_graph_bridge/ros_interpreter.hh>
Public Types | |
typedef boost::function< bool(dynamic_graph_bridge_msgs::RunCommand::Request &, dynamic_graph_bridge_msgs::RunCommand::Response &)> | runCommandCallback_t |
typedef boost::function< bool(dynamic_graph_bridge_msgs::RunPythonFile::Request &, dynamic_graph_bridge_msgs::RunPythonFile::Response &)> | runPythonFileCallback_t |
Public Member Functions | |
Interpreter (ros::NodeHandle &nodeHandle) | |
void | runCommand (const std::string &command, std::string &result, std::string &out, std::string &err) |
Method to start python interpreter and deal with messages. | |
void | runPythonFile (std::string ifilename) |
Method to parse python scripts. | |
void | startRosService () |
Initialize service run_command. | |
Protected Member Functions | |
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. | |
bool | runPythonFileCallback (dynamic_graph_bridge_msgs::RunPythonFile::Request &req, dynamic_graph_bridge_msgs::RunPythonFile::Response &res) |
Run a Python file. |
This class wraps the implementation of the runCommand service.
This takes as input a ROS node handle and do not handle the callback so that the service behavior can be controlled from the outside.
typedef boost::function< bool (dynamic_graph_bridge_msgs::RunCommand::Request&, dynamic_graph_bridge_msgs::RunCommand::Response&)> dynamicgraph::Interpreter::runCommandCallback_t |
typedef boost::function< bool (dynamic_graph_bridge_msgs::RunPythonFile::Request&, dynamic_graph_bridge_msgs::RunPythonFile::Response&)> dynamicgraph::Interpreter::runPythonFileCallback_t |
dynamicgraph::Interpreter::Interpreter | ( | ros::NodeHandle & | nodeHandle | ) | [explicit] |
void dynamicgraph::Interpreter::runCommand | ( | const std::string & | command, |
std::string & | result, | ||
std::string & | out, | ||
std::string & | err | ||
) |
Method to start python interpreter and deal with messages.
Command | string to execute, result, stdout, stderr strings. |
bool dynamicgraph::Interpreter::runCommandCallback | ( | dynamic_graph_bridge_msgs::RunCommand::Request & | req, |
dynamic_graph_bridge_msgs::RunCommand::Response & | res | ||
) | [protected] |
Run a Python command and return result, stderr and stdout.
void dynamicgraph::Interpreter::runPythonFile | ( | std::string | ifilename | ) |
Method to parse python scripts.
Input | file name to parse. |
bool dynamicgraph::Interpreter::runPythonFileCallback | ( | dynamic_graph_bridge_msgs::RunPythonFile::Request & | req, |
dynamic_graph_bridge_msgs::RunPythonFile::Response & | res | ||
) | [protected] |
Run a Python file.
void dynamicgraph::Interpreter::startRosService | ( | ) |
Initialize service run_command.