All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dynamicgraph::Interpreter Class Reference

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. More...
 
void runPythonFile (std::string ifilename)
 Method to parse python scripts. More...
 
void startRosService ()
 Initialize service run_command. More...
 

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. More...
 
bool runPythonFileCallback (dynamic_graph_bridge_msgs::RunPythonFile::Request &req, dynamic_graph_bridge_msgs::RunPythonFile::Response &res)
 Run a Python file. More...
 

Detailed Description

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.

Member Typedef Documentation

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

Constructor & Destructor Documentation

dynamicgraph::Interpreter::Interpreter ( ros::NodeHandle &  nodeHandle)
explicit

Member Function Documentation

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.

Parameters
Commandstring 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.

Parameters
Inputfile 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.