Gazebo logo

PeopleBot.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 PeopleBot header file
00022  * Author: Konstantinos Karantzis
00023  */
00024 
00025 #ifndef PEOPLEBOT_HH
00026 #define PEOPLEBOT_HH
00027 
00028 #include "Body.hh"
00029 #include "Model.hh"
00030 
00031 // Forward declarations
00032 class Body;
00033 class HingeJoint;
00034 class BallJoint;
00035 class RayProximity;
00036 
00037 class PeopleBot : public Model
00038 {
00039   // Construct, destructor
00040   public: PeopleBot( World *world );
00041   public: virtual ~PeopleBot();
00042 
00043   // Load the model
00044   public: virtual int Load( WorldFile *file, WorldFileNode *node );
00045 
00046   // Initialize the model
00047   public: virtual int Init( WorldFile *file, WorldFileNode *node );
00048 
00049   // Finalize the model
00050   public: virtual int Fini();
00051 
00052   // Update the model state
00053   public: virtual void Update( double step );
00054 
00055   // Load ODE stuff
00056   private: int LoadODE( WorldFile *file, WorldFileNode *node );
00057 
00058   // Load sonar stuff
00059   private: int LoadSonar( WorldFile *file, WorldFileNode *node );
00060 
00061   // Update the odometry
00062   private: void UpdateOdometry( double step );
00063 
00064   // Get commands from the external interface
00065   private: void GetPositionCmd();
00066   
00067   // Update the data in the external interface
00068   private: void PutPositionData();
00069 
00070   // Update the data in the power interface
00071   private: void PutPowerData();
00072 
00073   // Update the data in the sonar interface
00074   private: void PutSonarData();
00075   
00076   // Update parameters
00077   private: double updatePeriod, updateTime;
00078 
00079   // Robot parameters
00080   private: double wheelSep, wheelDiam;
00081 
00082   // Sonar configuration
00083   private: double sonarMaxRange;
00084   private: GzVector pos[16];
00085   private: double dir[16];
00086   
00087   // ODE components
00088   private: Body *chassis;
00089   private: Body *wheels[2];
00090   private: HingeJoint *wheelJoints[3];  
00091   private: Body *castorWheel;
00092   private: BallJoint *castorJoint;
00093 
00094   // Sensor for sonar ranging
00095   private: RayProximity *sonarSensor;
00096 
00097   // External interface
00098   private: gz_position_t *position_iface;
00099   private: gz_power_t *power_iface;
00100   private: gz_sonar_t *sonar_iface;
00101 
00102   // Wheel speeds (left and right wheels are paired)
00103   private: int enableMotors;
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