/* 
 * University of Leipzig: khepera.h, v0.1b  21.9.97 22:58 
 * 
 * 
 * Copyright 1997 by University of Leipzig
 * 
 * Permission to use, copy, modify, and distribute this software for noncommercial 
 * use and without fee is hereby granted, provided that the above copyright notice 
 * appear in all copies and that both that copyright notice and this permission 
 * notice appear in supporting documentation, and that the name of the U.L. not be 
 * used in advertising or publicity pertaining to distribution of the software 
 * without specific, written prior permission. The U.L. makes no representations about
 * the suitability of this software for any purpose.  It is provided "as is" 
 * without expressed or implied warranty. 
 * 
 * 
 * pantec@aix520.informatik.uni-leipzig.de   (Thomas Pantzer) 
 * 
 */


// Header for module Khepera, generated by p2c 1.21alpha-07.Dec.93
#ifndef K_EXTEND_H
#define K_EXTEND_H


#include "k_basic.h"
#include "world.h"
#include "t_path.h"
#include "trigonom.h"
#include "t_msgtype.h"

#ifdef K_EXTEND_G
# define vextern
#else
# define vextern extern
#endif


typedef struct {
                 int maximum;
                 int value;
                 int band_width;
               } t_FFT_rec;

typedef struct {
                 int num;
                 
                 t_FFT_rec record[16];
               } t_FFT_groups;


typedef struct {
	         t_vector P;          // point (x,y)
                 double aspect, delta;   // polar position
	       } t_location;

class t_robot_ext : public t_robot_basic {
public:
//  t_vertex_2d pos;	// position
  double alpha,full_alpha,sigma;   	// heading
  double d_alpha;	// last turn
  int set_speed_left, set_speed_right;

  // vars to hold last status read from sensors  
	double gone, delta_s;    // how far am I gone ?

	t_average *delta_s_avg;

	double sensor_avg_width;
	int fresh_odo,odo_frame;


  t_location Loc;	
  t_world  World;   // a world has three 2d-vectors, min (lower left corner)
                    // max (upper right corner) and  size 
  t_PATH   *Trajectory;	
  t_khepera_msgs MsgQueue;


  virtual void Init(char *);
  virtual void Done(void);
  virtual void Reset(void);		// 

  virtual void Turn(double degrees);		
  virtual void Move(double millimeter);
  virtual void SetMotorSpeed(int MotorNum, double Speed);
  virtual void SetMotorSpeed(double _left, double _right);  

  void LookHome(void);
  void SetOrientation(double);	// turn to north + degrees
  void WaitStopped(void);	// do nothing until all motors really halted

  virtual void Stop(void);		// all motors off
  void SolveCoords(char);	// probably buggy odometry
double Kompass(int, double &);
double Kompass_old(int, char , double &, double &);

//double ExtraSensorAvg(int stype,int Num);

   int GetVisualEdge(void);	// not implemented
   int GetVisualFreq(void);     // not implemented

 
  // VISION-Turret
//  virtual char ImageRead(void);			// boolean

// protected:
//   double ReadSensorAvg(int sensor_class, int sensor_num);	// 0 == IRED

private:
	int lgpl,lgpr;
};


/*
void HighPass(short int A[], int len, int offs);
void LowPass(short int A[], int len, int offs);
void Clipping(short int A[], int len, double level);
*/

#undef vextern

#endif 

// End.














/**/
/**/
/**/
/**/
/**/
/**/
/**/
/**/
/*****  End Of File  ****************************/
