camera_default_sensor.h
Go to the documentation of this file.
1 
7 #ifndef CAMERAS_DEFAULT_SENSOR_H
8 #define CAMERAS_DEFAULT_SENSOR_H
9 
10 namespace argos {
11  class CCameraDefaultSensor;
12  class CEmbodiedEntity;
13 }
14 
15 #include <argos3/core/utility/math/rng.h>
16 #include <argos3/core/simulator/space/space.h>
17 #include <argos3/core/simulator/sensor.h>
18 #include <argos3/plugins/robots/generic/control_interface/ci_camera_sensor.h>
19 #include <argos3/plugins/robots/generic/simulator/camera_sensor_algorithm.h>
20 
21 namespace argos {
22 
24  public CCI_CameraSensor {
25 
26  public:
27  struct SSensor {
32  std::vector<CCameraSensorSimulatedAlgorithm*> Algorithms;
35  /* constructor */
36  SSensor(SAnchor& s_anchor,
37  const CTransformationMatrix3& c_offset,
38  const CRange<Real>& c_range,
39  const CSquareMatrix<3>& c_projection_matrix,
40  const CVector2& c_resolution,
41  const std::vector<CCameraSensorSimulatedAlgorithm*>& vec_algorithms) :
42  Anchor(s_anchor),
43  Offset(c_offset),
44  Range(c_range),
45  ProjectionMatrix(c_projection_matrix),
46  Algorithms(vec_algorithms) {
47  Real fWidthToDepthRatio = (0.5 * c_resolution.GetX()) / c_projection_matrix(0,0);
48  Real fHeightToDepthRatio = (0.5 * c_resolution.GetY()) / c_projection_matrix(1,1);
49  NearPlaneHeight = fHeightToDepthRatio * c_range.GetMin();
50  NearPlaneWidth = fWidthToDepthRatio * c_range.GetMin();
51  FarPlaneHeight = fHeightToDepthRatio * c_range.GetMax();
52  FarPlaneWidth = fWidthToDepthRatio * c_range.GetMax();
53  }
54  };
55 
56  public:
57 
59 
60  virtual ~CCameraDefaultSensor() {}
61 
62  virtual void SetRobot(CComposableEntity& c_entity);
63 
64  virtual void Init(TConfigurationNode& t_tree);
65 
66  virtual void Update();
67 
68  protected:
72  std::vector<SSensor> m_vecSensors;
73  };
74 }
75 
76 #endif
virtual void Update()
Updates the state of the entity associated to this sensor.
Basic class for an entity that contains other entities.
SSensor(SAnchor &s_anchor, const CTransformationMatrix3 &c_offset, const CRange< Real > &c_range, const CSquareMatrix< 3 > &c_projection_matrix, const CVector2 &c_resolution, const std::vector< CCameraSensorSimulatedAlgorithm *> &vec_algorithms)
An anchor related to the body of an entity.
Definition: physics_model.h:38
Real GetX() const
Returns the x coordinate of this vector.
Definition: vector2.h:78
This entity is a link to a body in the physics engine.
virtual void Init(TConfigurationNode &t_tree)
Initializes the sensor from the XML configuration tree.
virtual void SetRobot(CComposableEntity &c_entity)
Sets the entity associated to this sensor.
CControllableEntity * m_pcControllableEntity
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
std::vector< CCameraSensorSimulatedAlgorithm * > Algorithms
T GetMin() const
Definition: range.h:32
T GetMax() const
Definition: range.h:48
An entity that contains a pointer to the user-defined controller.
The basic interface for a simulated sensor.
Definition: sensor.h:22
std::vector< SSensor > m_vecSensors
A 2D vector class.
Definition: vector2.h:25
Real GetY() const
Returns the y coordinate of this vector.
Definition: vector2.h:94
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
float Real
Collects all ARGoS code.
Definition: datatypes.h:39