Gazebo logo

Pioneer2Gripper.hh

Go to the documentation of this file.
00001 /*
00002  *  Gazebo - Outdoor Multi-Robot Simulator
00003  *  Copyright (C) 2003  
00004  *     Nate Koenig & Andrew Howard
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 /* Desc: Model for Pioneer2 Gripper
00022  * CVS: $Id: Pioneer2Gripper.hh,v 1.9 2006/11/02 16:54:09 natepak Exp $
00023  */
00024 
00025 #ifndef GAZEBO_P2GRIPPER_HH
00026 #define GAZEBO_P2GRIPPER_HH
00027 
00028 #include "Model.hh"
00029 
00030 // Forward declarations
00031 class Body;
00032 class SliderJoint;
00033 class RayProximity;
00034 
00035 typedef struct gz_gripper gz_gripper_t;
00036 
00037 class Pioneer2Gripper : public Model
00038 {
00039   private: enum GripperState {OPEN,CLOSED,UP,DOWN,MOVING,STOPPED};
00040 
00041   // Constructor, destructor
00042   public: Pioneer2Gripper( World *world );
00043   public: virtual ~Pioneer2Gripper();
00044 
00045   // Load the model
00046   public: virtual int Load( WorldFile *file, WorldFileNode *node );
00047 
00048   // Initialize the model
00049   public: virtual int Init( WorldFile *file, WorldFileNode *node );
00050 
00051   // Finalize the model
00052   public: virtual int Fini();
00053 
00054   // Update the model state
00055   public: virtual void Update( double step );
00056 
00057   // Grips-intersection callback
00058   private: static void UpdateGripCallback( void *data, dGeomID o1, dGeomID o2 );
00059 
00060   // Load ODE stuff
00061   private: int OdeLoad( WorldFile *file, WorldFileNode *node );
00062 
00063   // Initialize ODE
00064   private: int OdeInit( WorldFile *file, WorldFileNode *node );
00065 
00066   // Finalize ODE
00067   private: int OdeFini();
00068 
00069   // Initialize the external interface
00070   private: int IfaceInit();
00071 
00072   // Finalize the external interface
00073   private: int IfaceFini();
00074 
00075   // Get commands from the external interface
00076   private: void IfaceGetCmd();
00077 
00078   // Update the data in the external interface
00079   private: void IfacePutData();  
00080   
00081   private: void GripOpen();
00082   private: void GripClose();
00083   private: void GripStop();
00084   private: void LiftUp();
00085   private: void LiftDown();
00086   private: void LiftStop();
00087 
00088 
00089   // ODE objects
00090   private: Body *base;
00091   private: Body *horizBar;
00092   private: Body *leftPaddle;
00093   private: Body *rightPaddle;
00094 
00095   private: SliderJoint *horizBarSlider;
00096   private: SliderJoint *rightSlider;
00097   private: SliderJoint *leftSlider;
00098 
00099   private: float liftVel;
00100   private: float rightVel;
00101   private: float leftVel;
00102 
00103   private: GripperState leftPaddleState;
00104   private: GripperState rightPaddleState;
00105   private: GripperState liftState;
00106 
00107   private: RayProximity *frontBreakBeam;
00108   private: RayProximity *rearBreakBeam;
00109 
00110   // External interface
00111   private: gz_gripper_t *iface;
00112 };
00113 
00114 #endif

Last updated 12 September 2005 21:38:45