|
Pioneer2Sonars.hhGo 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: Pioneer2Sonars model 00022 * Author: Carle Cote (Laborius - Universite de Sherbrooke - Sherbrooke, Quebec, Canada) 00023 * Date: 23 february 2004 00024 * CVS: 00025 * 00026 * TODO : Support power command 00027 * 00028 * Modification 00029 * By: Description Date 00030 * Carle Cote Add data structure for March 24, 2004 00031 * sonars position and direction 00032 */ 00033 00034 #ifndef P2SONARS_HH 00035 #define P2SONARS_HH 00036 00037 #include "gazebo.h" 00038 #include "Model.hh" 00039 #include "Body.hh" 00040 00041 class RayGeom; 00042 class RayProximity; 00043 00044 typedef struct gz_sonars gz_sonars_t; 00045 00046 class Pioneer2Sonars : public Model 00047 { 00048 //Constructor 00049 public: Pioneer2Sonars( World *world ); 00050 00051 // Destructor 00052 public: virtual ~Pioneer2Sonars(); 00053 00054 // Load the sensor 00055 public: int Load( WorldFile *file, WorldFileNode *node ); 00056 00057 // Initialize the sensor 00058 public: int Init( WorldFile *file, WorldFileNode *node ); 00059 00060 // Finalize the sensor 00061 public: int Fini(); 00062 00063 // Load ODE stuff 00064 private: int OdeLoad( WorldFile *file, WorldFileNode *node ); 00065 00066 // Initialize ODE 00067 private: int OdeInit( WorldFile *file, WorldFileNode *node ); 00068 00069 // Finalize ODE 00070 private: int OdeFini(); 00071 00072 // Initialize the external interface 00073 private: int IfaceInit(); 00074 00075 // Finalize the external interface 00076 private: int IfaceFini(); 00077 00078 // Get commands from the external interface 00079 private: void IfaceGetCmd(); 00080 00081 // Update the data in the external interface 00082 private: void IfacePutData(); 00083 00084 // Update the sensor information; returns non-zero if sensor data has 00085 // been updated 00086 public: void Update( double step ); 00087 00088 // External interface 00089 private: gz_sonars_t *sonars_iface; 00090 00091 // ODE components 00092 private: RayProximity* proximitySensors[16]; 00093 private: Body* body; 00094 00095 // Sonars positions (x,y,z) 00096 private: GzVector pos[16]; 00097 // Sonars directions (degrees) 00098 private: int dir[16]; 00099 00100 }; 00101 00102 #endif |