Main MRPT website > C++ reference for MRPT 1.9.9
CObservationGasSensors.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef CObservationGasSensors_H
10 #define CObservationGasSensors_H
11 
13 #include <mrpt/obs/CObservation.h>
14 #include <mrpt/poses/CPose3D.h>
15 #include <mrpt/poses/CPose2D.h>
16 
17 namespace mrpt
18 {
19 namespace obs
20 {
21 /** Declares a class derived from "CObservation" that represents a set of
22  * readings from gas sensors.
23  *
24  * \sa CObservation
25  * \ingroup mrpt_obs_grp
26  */
28 {
30 
31  public:
32  /** Constructor.
33  */
35 
36  /** The structure for each e-nose
37  */
39  {
43  sensorTypes(),
44  hasTemperature(false),
45  temperature()
46  {
47  }
48 
49  /** The pose of the sensors on the robot */
51  /** The set of readings (in volts) from the array of sensors (size of
52  * "sensorTypes" is the same that the size of "readingsVoltage") */
53  std::vector<float> readingsVoltage;
54 
55  /** The kind of sensors in the array (size of "sensorTypes" is the same
56  *that the size of "readingsVoltage")
57  * The meaning of values for types of sensors is as follows:
58  * 0x0000 : No sensor installed in this slot
59  * 0x2600 : Figaro TGS 2600
60  * 0x2602 : Figaro TGS 2602
61  * 0x2620 : Figaro TGS 2620
62  * 0x4161 : Figaro TGS 4161
63  */
65  /** Must be true for "temperature" to contain a valid measurement */
67  /** Sensed temperature in Celcius (valid if hasTemperature=true only) */
68  float temperature;
69  /** True if the input to this chamber/enose is poluted air, False if
70  * clean air */
71  bool isActive;
72  };
73 
74  /** One entry per e-nose on the robot */
75  std::vector<TObservationENose> m_readings;
76 
77  // See base class docs
78  void getSensorPose(mrpt::poses::CPose3D& out_sensorPose) const override;
79  void setSensorPose(const mrpt::poses::CPose3D& newSensorPose) override;
80  void getDescriptionAsText(std::ostream& o) const override;
81 
82  /** Declares a class within "CObservationGasSensors" that represents a set
83  * of gas concentration readings from the modelation of a MOS gas sensor
84  * readings.
85  * This class provides the parameters and functions to simulate the inverse
86  * model of a MOS gas sensor.
87  *
88  * \sa CObservationGasSensors
89  */
90  class CMOSmodel
91  {
92  public:
93  /** Constructor */
94  CMOSmodel();
95  ~CMOSmodel();
96 
97  /** @name MOS-model parameters
98  * @{ */
99  /** The size of the mobile average window used to reduce noise on sensor
100  * reagings. */
102  /** [useMOSmodel] The decimate frecuency applied after noise filtering
103  */
105 
106  /** tau = a*AMPLITUDE +b (linear relationship) */
107  float a_rise;
108  /** tau = a*AMPLITUDE +b (linear relationship) */
109  float b_rise;
110  /** tau = a*AMPLITUDE +b (linear relationship) */
111  float a_decay;
112  /** tau = a*AMPLITUDE +b (linear relationship) */
113  float b_decay;
114 
115  /** If true save generated gas map as a log file */
117 
118  /** @} */
119 
120  /** Obtain an estimation of the gas distribution based on raw sensor
121  * readings */
123  float& reading, mrpt::system::TTimeStamp& timestamp);
124 
125  protected:
126  /** The content of each m_lastObservations in the estimation when using
127  * the option : MOS_MODEl (useMOSmodel =1)
128  */
129  struct TdataMap
130  {
131  /** Sensore reading */
132  float reading;
133  /** Timestamp of the observation */
135  /** tau value applied */
136  float tau;
137  /** The value estimated according to the MOXmodel */
138  float estimation;
139  /** Reading after smooth (noise averaging) */
141  };
142 
143  /** The content of each m_lastObservations in the estimation when using
144  * the option : MOS_MODEl (useMOSmodel =1) */
146  /** Vector to temporally store and averge readings to reduce noise */
147  std::vector<TdataMap> m_antiNoise_window;
148  /** Ofstream to save to file option "save_maplog" */
149  std::ofstream* m_debug_dump;
150  /** Decimate value for oversampled enose readings */
152  /** To force e-nose samples to have fixed time increments */
153  double fixed_incT;
154  /** To force e-nose samples to have fixed time increments */
156  /** Minimum reading value till the moment, used as approximation to
157  * baeline level */
158  float min_reading;
159  /** To avoid the model estimation on first iteration */
161 
162  /** Estimates the gas concentration based on readings and sensor model
163  */
164  void inverse_MOSmodeling(
165  const float& reading, const mrpt::system::TTimeStamp& timestamp);
166 
167  /** Reduce noise by averaging with a mobile window of specific size
168  * (winNoise_size)
169  */
170  void noise_filtering(
171  const float& reading, const mrpt::system::TTimeStamp& timestamp);
172 
173  /** Save the gas distribution estiamtion into a log file for offline
174  * representation
175  */
176  void save_log_map(
177  const mrpt::system::TTimeStamp& timestamp, const float& reading,
178  const float& estimation, const float& tau);
179 
180  }; // End of CMOSmodel class def.
181 
182 }; // End of class def.
183 
184 } // End of namespace
185 } // End of namespace
186 
187 #endif
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:32
float b_rise
tau = a*AMPLITUDE +b (linear relationship)
unsigned __int16 uint16_t
Definition: rptypes.h:44
void noise_filtering(const float &reading, const mrpt::system::TTimeStamp &timestamp)
Reduce noise by averaging with a mobile window of specific size (winNoise_size)
float temperature
Sensed temperature in Celcius (valid if hasTemperature=true only)
vector_int sensorTypes
The kind of sensors in the array (size of "sensorTypes" is the same that the size of "readingsVoltage...
size_t winNoise_size
The size of the mobile average window used to reduce noise on sensor reagings.
double fixed_incT
To force e-nose samples to have fixed time increments.
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const override
A general method to retrieve the sensor pose on the robot.
std::vector< TdataMap > m_antiNoise_window
Vector to temporally store and averge readings to reduce noise.
float min_reading
Minimum reading value till the moment, used as approximation to baeline level.
math::TPose3D eNosePoseOnTheRobot
The pose of the sensors on the robot.
bool hasTemperature
Must be true for "temperature" to contain a valid measurement.
TdataMap last_Obs
The content of each m_lastObservations in the estimation when using the option : MOS_MODEl (useMOSmod...
Declares a class within "CObservationGasSensors" that represents a set of gas concentration readings ...
Declares a class derived from "CObservation" that represents a set of readings from gas sensors...
bool first_iteration
To avoid the model estimation on first iteration.
float estimation
The value estimated according to the MOXmodel.
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) override
A general method to change the sensor pose on the robot.
float a_decay
tau = a*AMPLITUDE +b (linear relationship)
bool isActive
True if the input to this chamber/enose is poluted air, False if clean air.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
Definition: CObservation.h:58
void save_log_map(const mrpt::system::TTimeStamp &timestamp, const float &reading, const float &estimation, const float &tau)
Save the gas distribution estiamtion into a log file for offline representation.
bool first_incT
To force e-nose samples to have fixed time increments.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:41
bool save_maplog
If true save generated gas map as a log file.
The content of each m_lastObservations in the estimation when using the option : MOS_MODEl (useMOSmod...
std::vector< TObservationENose > m_readings
One entry per e-nose on the robot.
int decimate_value
[useMOSmodel] The decimate frecuency applied after noise filtering
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
mrpt::system::TTimeStamp timestamp
Timestamp of the observation.
void inverse_MOSmodeling(const float &reading, const mrpt::system::TTimeStamp &timestamp)
Estimates the gas concentration based on readings and sensor model.
std::vector< int32_t > vector_int
Definition: types_simple.h:24
std::vector< float > readingsVoltage
The set of readings (in volts) from the array of sensors (size of "sensorTypes" is the same that the ...
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
float b_decay
tau = a*AMPLITUDE +b (linear relationship)
std::ofstream * m_debug_dump
Ofstream to save to file option "save_maplog".
float reading_filtered
Reading after smooth (noise averaging)
float a_rise
tau = a*AMPLITUDE +b (linear relationship)
uint16_t decimate_count
Decimate value for oversampled enose readings.
bool get_GasDistribution_estimation(float &reading, mrpt::system::TTimeStamp &timestamp)
Obtain an estimation of the gas distribution based on raw sensor readings.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019