#ifndef GL_ROBOT_H
#define GL_ROBOT_H

#include "Robot_Structure.h"
#include "Big_Gripper_Structure.h"
#include "Small_Gripper_Structure.h"
#include "Environment.h"
#include "Message.h"

#define NONE           0
#define BIG_GRIPPER    1
#define SMALL_GRIPPER  2
#define VACUUM_GRIPPER 3

class GL_Robot : public RobotStructure {
 public:

  // lengths of joints 
  float ljoints[8];

  // positions of joints (1-6 robot, 7 - gripper, 0 - reserved)
  double joints[8];

  // min-max of values of robot joints
  // (1-6 robot, 7 - gripper, 0 - reserved)
  float min[8],max[8];

  // speed of movements 
  // (1-6 robot joints, 7 - gripper, 0 - reserved)
  double js[8];

  // reference to robot_server, rather to queue of messages
  Message *robot_server;
  // frequency of network scanning in mcsec
  long net_timeout;

  // type of gripper attached 
  // (0 - none, 1 - big, 2 - small, 3 - vacuum)
  int gripper;

  GL_Robot( Message *msg_ptr, 
	    Small_Gripper* sg,
	    Big_Gripper* bg,
	    Environment* env );
  ~GL_Robot(void);
  int set_joints(double* param );
  int move_joints_by(double* param );
  int move_joints_to(double* param);
  int move_joint_by(long num, double param);
  int move_joint_to(long num, double param);
  int move_rpy_to(double* param);
  int move_rpy_by(double* param);
  int linear_move_to(double* param);
  int linear_move_by(double* param);
  int get_task(void);
  int redisplay(void);
  int set_net_timeout(long t);
  int set_cpu_idle(long t);
  int set_limits(double* param);
  int set_speeds(double* param);
  int attach_gripper(int griptype);
  int detach_gripper(void);
  int attach_object(int i = 0);
  int detach_object(int i = 0);
  int answer_to_client(int infotype);

  
  float Tmax;
  float gl_time;
  double dest_pose[7];
  double delta[7];
  int   rt_var;
  float real_time;
  long  cpu_idle;

  Environment *env_ptr;
  Big_Gripper *bgrip_ptr;
  Small_Gripper *sgrip_ptr;
}; 


#endif
