Gazebo logo

Pioneer2DX.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 a Pioneer2DX
00022  * Author: Andrew Howard
00023  * Date: 8 May 2003
00024  * CVS: $Id: Pioneer2DX.hh,v 1.10 2004/11/05 08:02:34 inspectorg Exp $
00025  */
00026 
00027 #ifndef PIONEER2DX_HH
00028 #define PIONEER2DX_HH
00029 
00030 #include "Model.hh"
00031 
00032 // Forward declarations
00033 class Body;
00034 class HingeJoint;
00035 class BallJoint;
00036 class RayProximity;
00037 
00038 
00039 class Pioneer2DX : public Model
00040 {
00041   // Construct, destructor
00042   public: Pioneer2DX( World *world );
00043   public: virtual ~Pioneer2DX();
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   // Load ODE stuff
00058   private: int LoadODE( WorldFile *file, WorldFileNode *node );
00059 
00060   // Load sonar stuff
00061   private: int LoadSonar( WorldFile *file, WorldFileNode *node );
00062 
00063   // Update the odometry
00064   private: void UpdateOdometry( double step );
00065 
00066   // Get commands from the external interface
00067   private: void GetPositionCmd();
00068   
00069   // Update the data in the external interface
00070   private: void PutPositionData();
00071 
00072   // Update the data in the power interface
00073   private: void PutPowerData();
00074 
00075   // Update the data in the sonar interface
00076   private: void PutSonarData();
00077   
00078   // Update parameters
00079   private: double updatePeriod, updateTime;
00080 
00081   // Robot parameters
00082   private: double wheelSep, wheelDiam;
00083 
00084   // Sonar configuration
00085   private: double sonarMaxRange;
00086   private: GzVector pos[16];
00087   private: double dir[16];
00088   
00089   // ODE components
00090   private: Body *chassis;
00091   private: Body *wheels[2];
00092   private: HingeJoint *wheelJoints[3];  
00093   private: Body *castorWheel;
00094   private: BallJoint *castorJoint;
00095 
00096   // Sensor for sonar ranging
00097   private: RayProximity *sonarSensor;
00098 
00099   // External interface
00100   private: gz_position_t *position_iface;
00101   private: gz_power_t *power_iface;
00102   private: gz_sonar_t *sonar_iface;
00103 
00104   // Wheel speeds (left and right wheels are paired)
00105   private: int enableMotors;
00106   private: double wheelSpeed[2];
00107 
00108   // Odometric pose estimate
00109   private: double odomPose[3];
00110 
00111   // Odometric speed estimate
00112   private: double odomVel[3];
00113 
00114   // Battery level
00115   private: double batteryLevel;
00116 
00117   // Coefficients of battery discharge curve
00118   private: double batteryCurve[2];
00119 };
00120 
00121 #endif

Last updated 12 September 2005 21:38:45