/* LICENSE:
  =========================================================================
    CMPack'04 Source Code Release for OPEN-R SDK 1.1.5-r2 for ERS7
    Copyright (C) 2004 Multirobot Lab [Project Head: Manuela Veloso]
    School of Computer Science, Carnegie Mellon University
    All rights reserved.
  ========================================================================= */

#ifndef ObeyGameMgr_h
#define ObeyGameMgr_h

#include "state_machine.h"
#include "Behavior.h"
#include "FeatureSet.h"
#include "BeLowLevel.h"
#include "../Main/Events.h"
#include "../Motion/MotionInterface.h"
#include "../headers/Sensors.h"
#include "../Main/RobotMain.h"

class ObeyGameMgr : public IndependentBehavior {

 public:

  static const int beh_id;
  static char const * const beh_name;

private:
  EventManager *event_mgr;

  int trans_button_down_cnt;
  int kick_button_down_cnt;
  int color_button_down_cnt;

  uint fs_id;
  EventProcessor *fs_ep;
  FeatureSet *fs;

  BeGotoPointGlobal *gotopoint;
  BeNavToPointGlobal *navtopoint;
  BeTrackObjects *track_obj;
  vector3d target;
  
  ulong start_time;
  static const ulong timeout = 500000L;

  MotionCommand out_command;

public:
  static EventProcessor *create() { return new ObeyGameMgr; }

  ObeyGameMgr();
  virtual ~ObeyGameMgr();

  double operator()(FeatureSet *features, Motion::MotionCommand *Command);


  virtual bool initConnections();
  virtual bool setupEventMgr();
  virtual double status(FeatureSet *features);
  virtual void reset(ulong time);

  virtual bool update(ulong time,const EventList *events){return true;}
  virtual const MotionCommand *get(ulong time);
};

#endif
