Commit 90db097e authored by Olivier Stasse's avatar Olivier Stasse

Add ROS_INFO and ROS_ERROR informations when using runPython.

parent effe7be3
Pipeline #1276 failed with stage
in 14 seconds
......@@ -30,6 +30,7 @@ void SoTPyreneController::startupPython()
{
SoTTalosController::startupPython();
std::ofstream aof(LOG_PYTHON_PYRENE.c_str());
runPython
(aof,
"from dynamic_graph.sot.pyrene.prologue import robot",
......
......@@ -20,6 +20,9 @@
#include <boost/thread/thread.hpp>
#include <boost/thread/condition.hpp>
#include <ros/console.h>
const std::string SoTTalosController::LOG_PYTHON="/tmp/TalosController_python.out";
using namespace std;
......@@ -133,8 +136,9 @@ runPython(std::ostream& file,
dynamicgraph::Interpreter& interpreter)
{
file << ">>> " << command << std::endl;
std::string lerr(""),lout(""),lres("");
std::string lres(""),lout(""),lerr("");
interpreter.runCommand(command,lres,lout,lerr);
if (lres != "None")
{
if (lres=="<NULL>")
......@@ -142,9 +146,14 @@ runPython(std::ostream& file,
file << lout << std::endl;
file << "------" << std::endl;
file << lerr << std::endl;
ROS_INFO(lout.c_str());
ROS_ERROR(lerr.c_str());
}
else
file << lres << std::endl;
{
file << lres << std::endl;
ROS_INFO(lres.c_str());
}
}
}
......
......@@ -52,7 +52,8 @@ class SoTTalosController: public
// Update output port with the control computed from the
// dynamic graph.
void updateRobotState(std::vector<double> &anglesIn);
/// Run a python command
void runPython(std::ostream& file,
const std::string& command,
dynamicgraph::Interpreter& interpreter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment