Model.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2002-2004 Jean-Francois Mercure Burroughs
00003                         Etienne Lachance
00004 
00005 This program is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation; either version 2 of the License, or
00008 (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 
00020 Report problems and direct all questions to:
00021 
00022 email: richard.gourdeau@polymtl.ca
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 

Generated on Fri Feb 9 08:52:20 2007 for GLroboop An OpenGL Robotics Object Oriented Package in C++ by  doxygen 1.5.1