model.hh

来自「机器人人3D仿真工具,可以加入到Simbad仿真环境下应用。」· HH 代码 · 共 193 行

HH
193
字号
/* *  Gazebo - Outdoor Multi-Robot Simulator *  Copyright (C) 2003   *     Nate Koenig & Andrew Howard * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * *//* Desc: Base class for all models * Author: Andrew Howard * Date: 8 May 2003 * CVS: $Id: Model.hh,v 1.36 2006/02/22 14:58:57 natepak Exp $ */#ifndef MODEL_HH#define MODEL_HH#include <ode/ode.h>#include "Vector.hh"#include "GL/gl.h"// Forward declaraionsclass World;class WorldFile;class WorldFileNode;class Body;class Geom;class Joint;class HingeJoint;class RenderOptions;class Model{  // Default constructor  public: Model( World *world );  // Destructor  public: virtual ~Model();  // Load default values for the entire model. This calls Model::Load  public: int MasterLoad( WorldFile *file, WorldFileNode *node );   // Load the model  public: virtual int Load( WorldFile *file, WorldFileNode *node ) = 0;   // Initialize the model  public: virtual int Init( WorldFile *file, WorldFileNode *node ) = 0;  // Finalize the model  public: virtual int Fini() = 0;  // Update the model state  public: virtual void Update( double step ) = 0;  // Called for all models. This calls Update  public: void MasterUpdate( double step );  // Get the model pose (global frame)  public: GzPose GetPose();  // Set the model pose (global frame)  public: void SetPose( GzPose pose );  // Log the current pose of the canonical body  public: void LogPose();  // Set our parent  public: void SetParent(Model *parent, Body *parentBody);  // Attach this model to another.   public: void Attach();  // Detach this model from its parent.  public: void Detach();  // Add a body to this model; exactly one body must be used as the  // canonical body  protected: void AddBody(Body *body, bool canonical = false);  // Get the canonical body for this model (returns canonical body by  // default)  public: Body *GetBody(const char *bodyName = NULL);  // Get the list of bodies  public: int GetNumBodies() {return this->bodyCount;}  public: Body **GetBodies() {return this->bodies;}  // Set the id of the model  public: void SetId(const char* id);  // Get the id of the model  public: const char* GetId() const {return this->id;}  // Set the name of the model  public: void SetName(const char *name);  // Get the name of the model  public: const char* GetName();  // Set the Pick id of the model  public: void SetPickId( GLuint id );   // Get the Pick id of the model  public: GLuint GetPickId() const;  // Return the integer ID of this model  public: int GetIntId() const;  // Return the integer ID of this model's parent  public: int GetParentIntId() const;  // Draw this model  public: virtual void Render( int pass, RenderOptions *renderOpt );  // The world  public: World *world;  // The node this was loaded from  public: WorldFileNode *node;  // Our parent model  public: Model *parent;  // Our parent body  public: Body *parentBody;  /// Initial pose (for reseting)  public: GzPose initPose;  // The models id  private: char *id;  // The name of this model  private: char *name;  // Joint attaching us to parent body (for ODE bodies)  public: HingeJoint *joint;  // Pose relative to parent body (for dummy bodies)  public: GzPose relPose;  // Flag is true if this is a fixed object  public: bool fixed;  // The space for all the bodies in this model  public: dSpaceID modelSpaceId;  // A list of bodies making up this model  protected: int bodyCount, bodyMaxCount;  protected: Body **bodies;  // The canonical body (reference for the model cs)  private: Body *canonicalBody;  // A list of joints making up this model  private: int jointCount, jointMaxCount;  private: Joint **joints;  private: GLuint pickId;  private: static GLuint pickIdMaster;  private: bool gravityMode;  private: bool enable;  // Integer based ID   private: static int integerIdCounter;  private: int integerId;  // TESTING:  public: bool logPoses;  public: int poseCount, poseMaxCount;  public: GzPose *poses;};#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?