/***************************************************************************
 *   Copyright (C) 2005 by Robot Group Leipzig                             *
 *    martius@informatik.uni-leipzig.de                                    *
 *    fhesse@informatik.uni-leipzig.de                                     *
 *    der@informatik.uni-leipzig.de                                        *
 *                                                                         *
 *   ANY COMMERCIAL USE FORBIDDEN!                                         * 
 *                                                                         *
 *   $Log: invertnchannelcontroller_gnu.h,v $
 *   Revision 1.2  2005/10/27 15:02:06  fhesse
 *   commercial use added
 *                                *
 *                                                                         *
 ***************************************************************************/

#ifndef __INVERTNCHANNELCONTROLLER_GNU_H
#define __INVERTNCHANNELCONTROLLER_GNU_H

#include "invertnchannelcontroller.h"

#include "plotlog.h"
using namespace matrix;

/**
 * child of InvertNChannelController (using it's functionality)
 * adds gnuplot windows for A, C, h and x, y 
 *
 * Implements standart parameters: eps, rho, mu, stepnumber4avg, stepnumber4delay
 */
class InvertNChannelController_Gnu : public InvertNChannelController {

 public:
  InvertNChannelController_Gnu(int _number_channels, int _buffersize);

  virtual ~InvertNChannelController_Gnu(){}


  /// performs one step (includes learning). 
  /// Calulates motor commands from sensor inputs.
  virtual void step(const sensor* , int number_sensors, motor* , int number_motors);


  /// performs one step without learning. Calulates motor commands from sensor inputs.
  virtual void stepNoLearning(const sensor* , int number_sensors, 
			      motor* , int number_motors);



 protected:

  PlotLog<std::string> plotlog;
  PlotLog<std::string> plotlog_x;
  PlotLog<std::string> plotlog_a; 

  /**
   * plotting sensorvalues x, motorvalues y, matrix A, matrix C and vector h
   * @param x actual sensorvalues (used for generation of motorcommand in actual timestep)
   * @param y actual motorcommand (generated in the actual timestep)
   */
  virtual void plot(const sensor* x, const motor* y);

  /**
   * converts integer to string
   * @param value interger to convert
   */
  std::string intToStr(int value);
  
};

#include "invertnchannelcontroller_gnu.hpp"  
#endif


