Model.hh
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
00026
00027 #ifndef MODEL_HH
00028 #define MODEL_HH
00029
00030
00031 #include <map>
00032 #include <string>
00033 #include <vector>
00034
00035 #include "MovableText.hh"
00036 #include "UpdateParams.hh"
00037 #include "Pose3d.hh"
00038 #include "Joint.hh"
00039 #include "Entity.hh"
00040 #include "gazebo.h"
00041
00042
00043 namespace gazebo
00044 {
00045
00046
00047 class XMLConfigNode;
00048 class Body;
00049 class Controller;
00050 class HingeJoint;
00051
00055
00057 class Model : public Entity
00058 {
00060 public: Model(Model *parent);
00061
00063 public: virtual ~Model();
00064
00066 public: int Load(XMLConfigNode *node);
00067
00069 public: void Save();
00070 public: void Test();
00071
00073 public: int Init();
00074
00077 public: int Update(UpdateParams ¶ms);
00078
00080 public: int Fini();
00081
00083 public: void Reset();
00084
00086 protected: virtual int LoadChild(XMLConfigNode * ) {return 0;}
00087
00089 protected: virtual int InitChild() {return 0;}
00090
00092 protected: virtual int UpdateChild() {return 0;}
00093
00095 protected: virtual int FiniChild() {return 0;}
00096
00098 public: const std::string &GetType() const;
00099
00101 public: void SetInitPose(const Pose3d &pose);
00102
00104 public: const Pose3d &GetInitPose() const;
00105
00107 public: void SetPose(const Pose3d &pose);
00108
00110 public: const Pose3d &GetPose() const;
00111
00114 public: Body *CreateBody();
00115
00119 public: Joint *CreateJoint(Joint::Type type);
00120
00124 public: Joint *GetJoint(std::string name);
00125
00128 public: Body *GetBody();
00129
00132 public: Body *GetBody(const std::string &name);
00133
00135 public: void Attach(XMLConfigNode *node);
00136
00139 public: Body *GetCanonicalBody();
00140
00143 private: void LoadBody(XMLConfigNode *node);
00144
00147 private: void LoadJoint(XMLConfigNode *node);
00148
00151 private: void LoadController(XMLConfigNode *node);
00152
00154 private: void LoadPhysical(XMLConfigNode *node);
00155
00157 private: void LoadRenderable(XMLConfigNode *node);
00158
00160 private: std::string type;
00161
00163 private: XMLConfigNode *xmlNode;
00164
00166 private: Pose3d initPose;
00167
00169 private: Pose3d pose;
00170
00172 protected: std::map<std::string, Body* > bodies;
00173
00175 protected: std::map<std::string, Joint* > joints;
00176
00178 protected: std::map<std::string, Controller* > controllers;
00179
00181 private: std::string canonicalBodyName;
00182
00184 private: HingeJoint *joint;
00185
00187 private: static uint lightNumber;
00188
00189
00190
00191
00192
00193
00194
00195 };
00197 }
00198
00199 #endif