MRXT: The Multi-Robot eXploration Tool
Multi-Robot autonomous exploration and mapping simulator.
include/model/sensors/rangeSensorData.h
00001 /*
00002 *
00003 * Author: Miguel Julia <mjulia@umh.es> 
00004 * 
00005 * Date:   2008
00006 * 
00007 * Class binMap
00008 *
00009 */
00010 #ifndef __RANGE__SENSOR__DATA__
00011 #define __RANGE__SENSOR__DATA__
00012 
00013 #include "robotTypes.h"
00014 #include "ConfigFile.h"
00015 
00016 /**
00017 * @brief Implements the data returned by a range sensor like a laser
00018 *
00019 */
00020 class rangeSensorData{
00021 
00022 ///////////////////////////////////////////////////////////////////////
00023 //-------------------------  Attributes  ------------------------------
00024 ///////////////////////////////////////////////////////////////////////
00025 private:
00026 
00027         int numSensors;
00028         float devError;
00029         float gammamax;
00030         float aperture;
00031         float maxDist;
00032         float minDist;
00033         float* data;
00034         pose* sensorPos;
00035 
00036 //--------------------------------------------------------------------- 
00037 ///////////////////////////////////////////////////////////////////////
00038 
00039 ///////////////////////////////////////////////////////////////////////
00040 //-------------------------  Methods  ---------------------------------
00041 ///////////////////////////////////////////////////////////////////////
00042 public:
00043 
00044         /// Default constructor
00045         rangeSensorData();
00046         /// constructor from config file
00047         rangeSensorData(int numSensors, float devError, float gammamax, float aperture, float maxDist, float minDist);
00048         /// Copy constructor
00049         rangeSensorData(const rangeSensorData&);
00050         /// Default destructor
00051         virtual ~rangeSensorData();
00052         
00053         /// assignment operator
00054         rangeSensorData& operator= (const rangeSensorData &rsd);  
00055 
00056         /// initializer
00057         void initialize(int numSensors, float devError, float gammamax, float aperture, float maxDist, float minDist);
00058 
00059         /// returns the number of measurements
00060         int getNumSensors() const;
00061         /// returns the error of the measurement device
00062         float getDevError() const;
00063         /// returns aperture of the cone of measure
00064         float getAperture() const;
00065         /// returns the maximum range of the sensor
00066         float getMaxAngle() const;
00067         /// returns the maximum range of the sensor
00068         float getMaxDist() const;
00069         /// returns the minimum range of the sensor
00070         float getMinDist() const;
00071         /// returns the pose of a sensor s in robot coordinates
00072         pose& getSensorPose(int s) const;
00073         /// returns a sensor measurement
00074         float getSensorValue(int s) const;
00075 
00076         /// sets the pose of a sensor s in robot coordinates
00077         void setSensorPose(int s, const pose& pos);
00078         /// sets a sensor measurement
00079         void setSensorValue(int s, float val);
00080 
00081         /// returns a pointer to the array of sensor poses
00082         pose* getSensorPoses();
00083         /// returns a pointer to the array of data
00084         float* getData();
00085 
00086 //--------------------------------------------------------------------- 
00087 ///////////////////////////////////////////////////////////////////////
00088 };
00089 
00090 inline int rangeSensorData::getNumSensors() const                                       {return numSensors;}
00091 inline float rangeSensorData::getDevError() const                                       {return devError;}
00092 inline float rangeSensorData::getMaxAngle() const                                       {return gammamax;}
00093 inline float rangeSensorData::getAperture() const                                       {return aperture;}
00094 inline float rangeSensorData::getMaxDist() const                                        {return maxDist;}
00095 inline float rangeSensorData::getMinDist() const                                        {return minDist;}       
00096 inline pose& rangeSensorData::getSensorPose(int s) const                        {return (s<numSensors)? sensorPos[s]: nullpose;}
00097 inline float rangeSensorData::getSensorValue(int s) const                       {return data[s];}
00098 inline void rangeSensorData::setSensorPose(int s, const pose& pos)      {if (s<numSensors) sensorPos[s] = pos;}
00099 inline void rangeSensorData::setSensorValue(int s, float val)           {data[s] = val;}
00100 inline pose* rangeSensorData::getSensorPoses()                                          {return sensorPos;}
00101 inline float* rangeSensorData::getData()                                                        {return data;}
00102 
00103 #endif
00104 
 All Classes Functions Variables Typedefs