Gazebo logo

B21R.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 B21R
00022  * Author: Andrew Howard
00023  * Date: 8 May 2003
00024  * CVS: $Id: B21R.hh,v 1.1 2005/05/04 00:52:16 natepak Exp $
00025  */
00026 
00027 #ifndef B21R_HH
00028 #define B21R_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 B21R : public Model
00040 {
00041   // Construct, destructor
00042   public: B21R( World *world );
00043   public: virtual ~B21R();
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   // Load ODE stuff
00055   private: int OdeLoad( WorldFile *file, WorldFileNode *node );
00056 
00057   // Load sonar stuff
00058   private: int LoadSonar( WorldFile *file, WorldFileNode *node );
00059 
00060   // Update the model state
00061   public: virtual void Update( double step );
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[48];
00087   private: double dir[48];
00088 
00089   // ODE components
00090   private: Body *chassis;
00091   private: Body *wheels[4];
00092   private: HingeJoint *wheelJoints[2];
00093   private: BallJoint *wheel2Joints[2];
00094 
00095   // Sensor for sonar ranging
00096   private: RayProximity *sonarSensor;
00097 
00098   // External interface
00099   private: gz_position_t *position_iface;
00100   private: gz_power_t *power_iface;
00101   private: gz_sonar_t *sonar_iface;
00102 
00103   // Wheel speeds 
00104   private: double wheelSpeed[2];
00105 
00106   // Odometric pose estimate
00107   private: double odomPose[3];
00108 
00109   // Odometric speed estimate
00110   private: double odomVel[3];
00111 
00112   // Battery level
00113   private: double batteryLevel;
00114 
00115   // Coefficients of battery discharge curve
00116   private: double batteryCurve[2];
00117 };
00118 
00119 #endif

Last updated 12 September 2005 21:38:45