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

◆ runCommandCallback_t

typedef boost::function<bool(dynamic_graph_bridge_msgs::RunCommand::Request&, dynamic_graph_bridge_msgs::RunCommand::Response&)> dynamicgraph::Interpreter::runCommandCallback_t

◆ runPythonFileCallback_t

typedef boost::function<bool(dynamic_graph_bridge_msgs::RunPythonFile::Request&, dynamic_graph_bridge_msgs::RunPythonFile::Response&)> dynamicgraph::Interpreter::runPythonFileCallback_t

Constructor & Destructor Documentation

◆ Interpreter()

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

Member Function Documentation

◆ runCommand()

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.

◆ runCommandCallback()

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.

◆ runPythonFile()

void dynamicgraph::Interpreter::runPythonFile ( std::string  ifilename)

Method to parse python scripts.

Parameters
Inputfile name to parse.

◆ runPythonFileCallback()

bool dynamicgraph::Interpreter::runPythonFileCallback ( dynamic_graph_bridge_msgs::RunPythonFile::Request &  req,
dynamic_graph_bridge_msgs::RunPythonFile::Response &  res 
)
protected

Run a Python file.

◆ startRosService()

void dynamicgraph::Interpreter::startRosService ( )

Initialize service run_command.


The documentation for this class was generated from the following file: