/***************************************************************
 * PrTaskControl.h
 *
 * This class provides the multi-task control interface.
 *
 ****************************************************************/

/*
 * modification history
 *----------------------
 *
 * 7/28/03: Jaeheung Park: created. "experimental version"
 */

#ifndef _PrTaskControl_h
#define _PrTaskControl_h

#include "PrGlobalDefn.h"
#include "matrix/PrMatrix.h"

class PrVector;
class PrMatrix;
class PrOpControl;
class PrTreeRobotIntf;
class PrJointControl;
class PrTask;
class PrRobot;

class PrTaskControl
{
 public:
  PrTaskControl(int servoRate,PrTreeRobotIntf *robot);
  ~PrTaskControl();

  //PrOpControl &opControl();
  PrTask** tasks() {return tasks_;}
  
  void updateJointsPosVel();
  PrVector &computedTorque();

  void update();

 private:

  int servoRate_;
  int not_; // number of tasks
  int dof_; // total number of DOF
  int noj_; // number of joints
  PrTreeRobotIntf *robot_;
  PrRobot *robotVirtual_;
  //PrOpControl *opControl_;

  PrVector* q_;
  PrVector* dq_;

  PrTask** tasks_;
  
  PrVector *tau_;

  // these are for recursive calculation for torque
  PrVector *Gamma_;
  PrMatrix *Nt_;


  void CreateInitialTasks();
  PrTaskControl(const PrTaskControl &) {}

};

#endif // _PrTaskControl_h

