footbot_distance_scanner_rotzonly_sensor.h
Go to the documentation of this file.
1 
7 #ifndef FOOTBOT_DISTANCE_SCANNER_SENSOR_H
8 #define FOOTBOT_DISTANCE_SCANNER_SENSOR_H
9 
10 namespace argos {
11  class CFootBotDistanceScannerRotZOnlySensor;
12  class CControllableEntity;
13  class CSpace;
14 }
15 
16 #include <argos3/plugins/robots/foot-bot/control_interface/ci_footbot_distance_scanner_sensor.h>
17 #include <argos3/plugins/robots/foot-bot/simulator/footbot_distance_scanner_equipped_entity.h>
18 #include <argos3/core/simulator/entity/embodied_entity.h>
19 #include <argos3/core/utility/math/rng.h>
20 #include <argos3/core/utility/math/ray3.h>
21 #include <argos3/core/simulator/sensor.h>
22 
23 #include <string>
24 #include <map>
25 
26 namespace argos {
27 
30 
31  public:
32 
34 
36 
37  virtual void SetRobot(CComposableEntity& c_entity);
38 
39  virtual void Init(TConfigurationNode& t_tree);
40 
41  virtual void Update();
42 
43  virtual void Reset();
44 
45  private:
46 
47  void UpdateNotRotating();
48  void UpdateRotating();
49 
50  Real CalculateReadingForRay(const CRay3& c_ray,
51  Real f_min_distance);
52 
53  void CalculateRaysNotRotating();
54  void CalculateRaysRotating();
55 
60  inline bool IsShowRays() {
61  return m_bShowRays;
62  }
63 
68  inline void SetShowRays(bool b_show_rays) {
69  m_bShowRays = b_show_rays;
70  }
71 
72  private:
73 
75  CRandom::CRNG* m_pcRNG;
76 
78  bool m_bAddNoise;
79 
81  CRange<Real> m_cNoiseRange;
82 
83  CSpace& m_cSpace;
84  CFootBotDistanceScannerEquippedEntity* m_pcDistScanEntity;
85  CControllableEntity* m_pcControllableEntity;
86  CEmbodiedEntity* m_pcEmbodiedEntity;
87  CRadians m_cLastDistScanRotation;
88 
89  bool m_bShowRays;
90 
91  CRay3 m_cShortRangeRays0[6];
92  CRay3 m_cShortRangeRays2[6];
93  CRay3 m_cLongRangeRays1[6];
94  CRay3 m_cLongRangeRays3[6];
95 
96  /* Internally used to speed up ray calculations */
97  CVector3 m_cDirection;
98  CVector3 m_cOriginRayStart;
99  CVector3 m_cOriginRayEnd;
100  CVector3 m_cRayStart;
101  CVector3 m_cRayEnd;
102  };
103 
104 }
105 
106 #endif
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
Basic class for an entity that contains other entities.
The basic interface for a simulated sensor.
Definition: sensor.h:24
virtual void SetRobot(CComposableEntity &c_entity)
Sets the entity associated to this sensor.
virtual void Reset()
Resets the sensor to the state it had just after Init().
virtual void Update()
Updates the state of the entity associated to this sensor, if the sensor is currently enabled.
virtual void Init(TConfigurationNode &t_tree)
Initializes the sensor from the XML configuration tree.