00001 00007 #ifndef LIGHT_SENSOR_EQUIPPED_ENTITY_H 00008 #define LIGHT_SENSOR_EQUIPPED_ENTITY_H 00009 00010 namespace argos { 00011 class CLightSensorEquippedEntity; 00012 struct SAnchor; 00013 } 00014 00015 #include <argos3/core/utility/math/vector3.h> 00016 #include <argos3/core/simulator/entity/entity.h> 00017 #include <map> 00018 00019 namespace argos { 00020 00021 class CLightSensorEquippedEntity : public CEntity { 00022 00023 public: 00024 00025 ENABLE_VTABLE(); 00026 00027 struct SSensor { 00028 typedef std::vector<SSensor*> TList; 00029 00030 CVector3 Position; 00031 CVector3 Direction; 00032 SAnchor& Anchor; 00033 00034 SSensor(const CVector3& c_position, 00035 const CVector3& c_direction, 00036 Real f_range, 00037 SAnchor& s_anchor); 00038 }; 00039 00040 public: 00041 00042 CLightSensorEquippedEntity(CComposableEntity* pc_parent); 00043 00044 CLightSensorEquippedEntity(CComposableEntity* pc_parent, 00045 const std::string& str_id); 00046 00047 virtual ~CLightSensorEquippedEntity(); 00048 00049 virtual void Init(TConfigurationNode& t_tree); 00050 00051 virtual std::string GetTypeDescription() const { 00052 return "light_sensors"; 00053 } 00054 00055 virtual void Enable(); 00056 00057 virtual void Disable(); 00058 00059 inline size_t GetNumSensors() const { 00060 return m_tSensors.size(); 00061 } 00062 00063 inline SSensor& GetSensor(size_t un_idx) { 00064 return *m_tSensors[un_idx]; 00065 } 00066 00067 inline SSensor::TList& GetSensors() { 00068 return m_tSensors; 00069 } 00070 00071 void AddSensor(const CVector3& c_position, 00072 const CVector3& c_direction, 00073 Real f_range, 00074 SAnchor& s_anchor); 00075 00076 void AddSensorRing(const CVector3& c_center, 00077 Real f_radius, 00078 const CRadians& c_start_angle, 00079 Real f_range, 00080 UInt32 un_num_sensors, 00081 SAnchor& s_anchor); 00082 00083 protected: 00084 00086 SSensor::TList m_tSensors; 00087 00088 }; 00089 00090 } 00091 00092 #endif