ci_colored_blob_perspective_camera_sensor.h
Go to the documentation of this file.
1 #ifndef CI_COLORED_BLOB_PERSPECTIVE_CAMERA_SENSOR_H
2 #define CI_COLORED_BLOB_PERSPECTIVE_CAMERA_SENSOR_H
3 
4 namespace argos {
5  class CCI_ColoredBlobPerspectiveCameraSensor;
6 }
7 
8 #include <argos3/core/control_interface/ci_sensor.h>
9 #include <argos3/core/utility/math/angles.h>
10 #include <argos3/core/utility/datatypes/color.h>
11 #include <vector>
12 
13 #include <argos3/core/utility/logging/argos_log.h>
14 
15 namespace argos {
16 
27 
28  public:
29 
40  struct SBlob {
41  /* Color */
43  /* Blob position */
48  SBlob() :
49  Color(CColor::BLACK),
50  X(0), Y(0) {
51  }
55  SBlob(const CColor& c_color,
56  SInt32 n_x,
57  SInt32 n_y) :
58  Color(c_color),
59  X(n_x),
60  Y(n_y) {
61  }
62 
63  friend std::ostream& operator<<(std::ostream& c_os, const SBlob& s_blob) {
64  c_os << "(Color = " << s_blob.Color << "," << "X = " << s_blob.X << ",Y = " << s_blob.Y << ")";
65  return c_os;
66  }
67  };
68 
72  typedef std::vector<SBlob*> TBlobList;
73 
79  struct SReadings {
82 
84  Counter(0) {
85  }
86 
87  friend std::ostream& operator<<(std::ostream& c_os, const SReadings& s_reading) {
88  c_os << "Counter: " << s_reading.Counter << std::endl;
89  for (size_t i = 0; i < s_reading.BlobList.size(); i++) {
90  c_os << "Blob[" << i << "]: " << s_reading.BlobList[i] << std::endl;
91  }
92  return c_os;
93  }
94  };
95 
96  public:
97 
102 
107 
112  const SReadings& GetReadings() const;
113 
117  virtual void Enable() = 0;
118 
122  virtual void Disable() = 0;
123 
124 #ifdef ARGOS_WITH_LUA
125  virtual void CreateLuaState(lua_State* pt_lua_state);
126 
127  virtual void ReadingsToLuaState(lua_State* pt_lua_state);
128 #endif
129 
130  protected:
131 
133 
134  };
135 
136 }
137 
138 #endif
The basic interface for all sensors.
Definition: ci_sensor.h:34
std::vector< SBlob * > TBlobList
Vector of pointers to colored blobs.
virtual void Disable()=0
Disables image acquisition and processing.
friend std::ostream & operator<<(std::ostream &c_os, const SBlob &s_blob)
It represents the readings collected through the camera at a specific time step.
virtual void Enable()=0
Enables image acquisition and processing.
The basic color type.
Definition: color.h:25
An SBlob represents a generic colored 2D segment in the image.
friend std::ostream & operator<<(std::ostream &c_os, const SReadings &s_reading)
unsigned long long UInt64
64-bit unsigned integer.
Definition: datatypes.h:107
const SReadings & GetReadings() const
Returns a reference to the current camera readings.
SBlob(const CColor &c_color, SInt32 n_x, SInt32 n_y)
Constructor with paramters.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
signed int SInt32
32-bit signed integer.
Definition: datatypes.h:93
This class provides the most general interface to a camera.