From d2fb8067167785b299482d247aaf90a35f55b62c Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 28 Jan 2013 16:15:50 +0100 Subject: LocomotorPrimitives: Switch to using Logger class for logging --- LocomotorPrimitivesController.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'LocomotorPrimitivesController.cpp') diff --git a/LocomotorPrimitivesController.cpp b/LocomotorPrimitivesController.cpp index 27ac205..0bdaf81 100644 --- a/LocomotorPrimitivesController.cpp +++ b/LocomotorPrimitivesController.cpp @@ -2,14 +2,11 @@ #include "LocomotorPrimitivesController.h" -#define VERBOSE 1 - -// XXX -extern clock_t ts_start; - static const double TIME_DAMP = 0.1; static const unsigned int N_PRINT = 1000; +static Logger &logger = Logger::getInstance(); + int LocomotorPrimitivesController::checkControls() { const int act_set_siz = getActuatorSet().getSize(); @@ -22,7 +19,7 @@ int LocomotorPrimitivesController::checkControls() const OpenSim::Array indices = _act.getColumnIndicesForIdentifier(muscle->getName()); if (indices.getSize() == 0) { - std::cerr << "Error: no actuation data for muscle '" << muscle->getName() << "' found" << std::endl; + logger.err("no actuation data for muscle '%s' found\n", muscle->getName().c_str()); ret--; } } @@ -52,10 +49,11 @@ void LocomotorPrimitivesController::computeControls(const SimTK::State &s, SimTK if (indices.getSize() != 0) { int idx = indices.get(0) - 1; if (n % N_PRINT == 0) - std::cout << "[" << (1.e3 * clock() - ts_start) / CLOCKS_PER_SEC << "ms] " << t << " (" << idx << ") actuation data for '" << muscle->getName() << "' found: " << _muscle_act[idx] << std::endl; + logger.log("%f (%d) actuation data for muscle '%s' found: %f\n", + t, idx, muscle->getName().c_str(), _muscle_act[idx]); if (_muscle_act[idx] > 1.0) { - std::cerr << "Error: muscle actuation larger than 1.0 (" << _muscle_act[idx] << "), truncating" << std::endl; + logger.err("muscle actuation larger than 1.0 (%f), truncating to 1.0\n", _muscle_act[idx]); _muscle_act[idx] = 1.0; } -- cgit v1.2.3-54-g00ecf