ARGoS 3
A parallel, multi-engine simulator for swarm robotics
ci_colored_blob_omnidirectional_camera_sensor.h
Go to the documentation of this file.
1#ifndef CI_COLORED_BLOB_OMNIDIRECTIONAL_CAMERA_SENSOR_H
2#define CI_COLORED_BLOB_OMNIDIRECTIONAL_CAMERA_SENSOR_H
3
4namespace argos {
5 class CCI_ColoredBlobOmnidirectionalCameraSensor;
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
15namespace argos {
16
27
28 public:
29
40 struct SBlob {
41 /* Color */
43 /* Angle */
45 /* Distance in cms */
51 Color(CColor::BLACK),
52 Distance(0.0f) {
53 }
60 SBlob(const CColor& c_color,
61 const CRadians& c_angle,
62 Real f_distance) :
63 Color(c_color),
64 Angle(c_angle),
65 Distance(f_distance) {
66 }
67
68 friend std::ostream& operator<<(std::ostream& c_os, const SBlob& s_blob) {
69 c_os << "(Color = " << s_blob.Color << "," << "Angle = " << ToDegrees(s_blob.Angle) << ","
70 << "Distance = " << s_blob.Distance << ")";
71 return c_os;
72 }
73 };
74
78 typedef std::vector<SBlob*> TBlobList;
79
85 struct SReadings {
88
90 Counter(0) {
91 }
92
93 friend std::ostream& operator<<(std::ostream& c_os, const SReadings& s_reading) {
94 c_os << "Counter: " << s_reading.Counter << std::endl;
95 for (size_t i = 0; i < s_reading.BlobList.size(); i++) {
96 c_os << "Blob[" << i << "]: " << s_reading.BlobList[i] << std::endl;
97 }
98 return c_os;
99 }
100 };
101
102 public:
103
108
113
118 const SReadings& GetReadings() const;
119
120#ifdef ARGOS_WITH_LUA
121 virtual void CreateLuaState(lua_State* pt_lua_state);
122
123 virtual void ReadingsToLuaState(lua_State* pt_lua_state);
124#endif
125
126 protected:
127
129
130 };
131
132}
133
134#endif
unsigned long long UInt64
64-bit unsigned integer.
Definition datatypes.h:107
float Real
Collects all ARGoS code.
Definition datatypes.h:39
The namespace containing all the ARGoS related code.
Definition ci_actuator.h:12
CDegrees ToDegrees(const CRadians &c_radians)
Converts CRadians to CDegrees.
Definition angles.h:489
The basic interface for all sensors.
Definition ci_sensor.h:34
The basic color type.
Definition color.h:25
It defines the basic type CRadians, used to store an angle value in radians.
Definition angles.h:42
This class provides the most general interface to a camera.
std::vector< SBlob * > TBlobList
Vector of pointers to colored blobs.
const SReadings & GetReadings() const
Returns a reference to the current camera readings.
An SBlob represents a generic colored 2D segment in the image.
SBlob(const CColor &c_color, const CRadians &c_angle, Real f_distance)
Constructor with paramters.
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.
friend std::ostream & operator<<(std::ostream &c_os, const SReadings &s_reading)