00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _MODEL_H
00026 #define _MODEL_H
00027
00033
00034 static const char header_model_rcsid[] = "$Id: Model.h,v 1.8 2006/05/16 16:46:18 gourdeau Exp $";
00035
00036 #include "base.h"
00037 #include "boxLogger.h"
00038 #include "enviro.h"
00039 #include "robotgl.h"
00040 #include "dynamics_sim.h"
00041 #include "stl.h"
00042 #include "Subject_Observer.h"
00043
00044 #include "wx/textfile.h"
00045
00046
00048 enum inv_kin_status
00049 {
00050 INV_KIN_CONV=0,
00051 INV_KIN_NOT_CONV,
00052 INV_KIN,
00053 };
00054
00064 class Target: public Subject
00065 {
00066 public:
00067 Target();
00068 ~Target();
00069 void SetTargetPos(const double X_, const double Y_, const double Z_,
00070 const double Yaw_, const double Pitch_, const double Roll_);
00071 void MoveTarget(const int X_, const int Y_, const int Z_);
00072 void DrawTarget(const double radius, const double X_, const double Y_, const double Z_,
00073 const double Yaw_, const double Pitch_, const double Roll_);
00074
00075 double X,
00076 Y,
00077 Z,
00078 Yaw,
00079 Pitch,
00080 Roll;
00081 inv_kin_status status_kin;
00082 private:
00083 Axis *axis;
00084 GLUquadricObj *qobj1;
00085 };
00086
00087
00088 class Dynamics;
00089
00090 class CModel: public Subject
00091 {
00092 public:
00093 CModel();
00094 virtual ~CModel();
00095 CModel & operator=(const CModel & x);
00096 static CModel* Instance();
00097
00098 void set_q(const ColumnVector & );
00099 ReturnMatrix get_q();
00100 ReturnMatrix kine();
00101
00102 bool IsInitialise();
00103 bool SaveModel(wxString filename, wxString pathname);
00104
00105 void SetRobot(const Matrix & initrob);
00106 void SetRobot(const string &filename, const string & robotname);
00107 void SetSTL(STL_obj* x);
00108
00109 ReturnMatrix inv_kin(const Matrix & Tobj, const int mj, const int endlink, bool & converge);
00110 int get_dof() const;
00111 void Set_q(const double value, const int idx);
00112 double get_q(const int idx) const;
00113
00114 void Render();
00115
00116 Target *m_target;
00117 Target *baseFrameAxis;
00118
00119 Robotgl *m_robotgl_dh;
00120 mRobotgl *m_robotgl_mdh;
00121
00122 private:
00123
00124 Dynamics *m_dynamics;
00125 static CModel* m_instance;
00126 };
00127
00128 #endif
00129
00130
00131
00132
00133
00134
00135