ARGoS  3
A parallel, multi-engine simulator for swarm robotics
plugins/robots/foot-bot/control_interface/ci_footbot_distance_scanner_sensor.h
Go to the documentation of this file.
00001 
00051 #ifndef CCI_FOOTBOT_DISTANCE_SCANNER_SENSOR_H
00052 #define CCI_FOOTBOT_DISTANCE_SCANNER_SENSOR_H
00053 
00054 /* To avoid dependency problems when including */
00055 namespace argos {
00056    class CCI_FootBotDistanceScannerSensor;
00057 }
00058 
00059 #include <argos3/core/control_interface/ci_sensor.h>
00060 #include <argos3/core/utility/math/angles.h>
00061 #include <vector>
00062 
00063 namespace argos {
00064 
00065    class CCI_FootBotDistanceScannerSensor : public CCI_Sensor {
00066 
00067    public:
00068 
00073       struct SReading {
00074          CRadians Angle;
00075          Real Distance; // in cm from the center of the robot (about 10cm from the border)
00076 
00077          SReading() :
00078             Angle(0.0f),
00079             Distance(0.0f) {}
00080 
00081          SReading(const CRadians& c_angle,
00082                   Real f_distance) :
00083             Angle(c_angle),
00084             Distance(f_distance) {
00085          }
00086       };
00087 
00088       /* These structs are for internal use only */
00089       typedef std::vector<SReading> TReadings;
00090       typedef std::vector<TReadings> TLastReadings;
00091       typedef std::pair<CRadians,Real> TMapPair;
00092       typedef std::map<CRadians,Real> TReadingsMap;
00093 
00097       CCI_FootBotDistanceScannerSensor() :
00098          m_tReadings(4){
00099       }
00100 
00104       virtual ~CCI_FootBotDistanceScannerSensor() {}
00105 
00120       inline const TReadingsMap& GetReadingsMap(){
00121          return m_tReadingsMap;
00122       }
00123 
00135       inline const TReadingsMap& GetShortReadingsMap(){
00136          return m_tShortReadingsMap;
00137       }
00138 
00150       inline const TReadingsMap& GetLongReadingsMap(){
00151          return m_tLongReadingsMap;
00152       }
00153 
00154 #ifdef ARGOS_WITH_LUA
00155       virtual void CreateLuaState(lua_State* pt_lua_state);
00156 
00157       virtual void ReadingsToLuaState(lua_State* pt_lua_state);
00158 #endif
00159 
00160    protected:
00161 
00163       TReadings m_tReadings;
00164 
00166       TLastReadings m_tLastReadings;
00167 
00169       TReadingsMap m_tReadingsMap;
00170 
00172       TReadingsMap m_tShortReadingsMap;
00173 
00175       TReadingsMap m_tLongReadingsMap;
00176 
00177    };
00178 
00179 }
00180 
00181 #endif