Gazebo logo

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

Last updated 12 September 2005 21:38:45