ARGoS  3
A parallel, multi-engine simulator for swarm robotics
plugins/simulator/entities/ground_sensor_equipped_entity.h
Go to the documentation of this file.
00001 
00007 #ifndef GROUND_SENSOR_EQUIPPED_ENTITY_H
00008 #define GROUND_SENSOR_EQUIPPED_ENTITY_H
00009 
00010 namespace argos {
00011    class CGroundSensorEquippedEntity;
00012 }
00013 
00014 #include <argos3/core/utility/math/vector3.h>
00015 #include <argos3/core/simulator/entity/entity.h>
00016 #include <map>
00017 
00018 namespace argos {
00019 
00020    class CGroundSensorEquippedEntity : public CEntity {
00021 
00022    public:
00023 
00024       ENABLE_VTABLE();
00025 
00026       enum ESensorType {
00027          TYPE_BLACK_WHITE = 0,
00028          TYPE_GRAYSCALE
00029       };
00030 
00031       struct SSensor {
00032          CVector2 Offset;
00033          ESensorType Type;
00034          SSensor(const CVector2& c_position,
00035                  ESensorType e_type) :
00036             Offset(c_position),
00037             Type(e_type) {}
00038       };
00039 
00040       typedef std::vector<SSensor*> TSensors;
00041 
00042    public:
00043 
00044       CGroundSensorEquippedEntity(CComposableEntity* pc_parent);
00045 
00046       CGroundSensorEquippedEntity(CComposableEntity* pc_parent,
00047                                   const std::string& str_id);
00048 
00049       virtual ~CGroundSensorEquippedEntity();
00050 
00051       virtual void Init(TConfigurationNode& t_tree);
00052 
00053       virtual std::string GetTypeDescription() const {
00054          return "ground_sensors";
00055       }
00056 
00057       inline size_t GetNumSensors() const {
00058          return m_tSensors.size();
00059       }
00060 
00061       inline SSensor& GetSensor(size_t un_idx) {
00062          return *m_tSensors[un_idx];
00063       }
00064 
00065       inline TSensors& GetSensors() {
00066          return m_tSensors;
00067       }
00068 
00069       void AddSensor(const CVector2& c_offset,
00070                      ESensorType e_type);
00071 
00072       void AddSensorRing(const CVector2& c_center,
00073                          Real f_radius,
00074                          const CRadians& c_start_angle,
00075                          ESensorType e_type,
00076                          UInt32 un_num_sensors);
00077 
00078    protected:
00079       
00080       ESensorType ParseType(const std::string& str_type) const;
00081 
00082    protected:
00083 
00085       TSensors m_tSensors;
00086 
00087    };
00088 
00089 }
00090 
00091 #endif