Main MRPT website > C++ reference for MRPT 1.4.0
obs/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-2016, 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
14#include <mrpt/poses/CPose3D.h>
15#include <mrpt/poses/CPose2D.h>
16
17namespace mrpt
18{
19namespace obs
20{
21
23
24 /** Declares a class derived from "CObservation" that represents a set of readings from gas sensors.
25 *
26 * \sa CObservation
27 * \ingroup mrpt_obs_grp
28 */
30 {
31 // This must be added to any CSerializable derived class:
33
34 public:
35 /** Constructor.
36 */
38
39 /** The structure for each e-nose
40 */
42 {
44 eNosePoseOnTheRobot(),
45 readingsVoltage(),
46 sensorTypes(),
47 hasTemperature(false),
48 temperature()
49 {}
50
51 math::TPose3D eNosePoseOnTheRobot;//!< The pose of the sensors on the robot
52 std::vector<float> readingsVoltage;//!< The set of readings (in volts) from the array of sensors (size of "sensorTypes" is the same that the size of "readingsVoltage")
53
54 /** The kind of sensors in the array (size of "sensorTypes" is the same that the size of "readingsVoltage")
55 * The meaning of values for types of sensors is as follows:
56 * 0x0000 : No sensor installed in this slot
57 * 0x2600 : Figaro TGS 2600
58 * 0x2602 : Figaro TGS 2602
59 * 0x2620 : Figaro TGS 2620
60 * 0x4161 : Figaro TGS 4161
61 */
63 bool hasTemperature;//!< Must be true for "temperature" to contain a valid measurement
64 float temperature;//!< Sensed temperature in Celcius (valid if hasTemperature=true only)
65 bool isActive;//!< True if the input to this chamber/enose is poluted air, False if clean air
66 };
67
68 /** One entry per e-nose on the robot */
69 std::vector<TObservationENose> m_readings;
70
71 // See base class docs
72 void getSensorPose( mrpt::poses::CPose3D &out_sensorPose ) const MRPT_OVERRIDE;
73 void setSensorPose( const mrpt::poses::CPose3D &newSensorPose ) MRPT_OVERRIDE;
74 void getDescriptionAsText(std::ostream &o) const MRPT_OVERRIDE;
75
76 /** Declares a class within "CObservationGasSensors" that represents a set of gas concentration readings from the modelation of a MOS gas sensor readings.
77 * This class provides the parameters and functions to simulate the inverse model of a MOS gas sensor.
78 *
79 * \sa CObservationGasSensors
80 */
82 {
83 public:
84 /** Constructor */
87
88 /** @name MOS-model parameters
89 * @{ */
90 size_t winNoise_size; //!< The size of the mobile average window used to reduce noise on sensor reagings.
91 int decimate_value; //!< [useMOSmodel] The decimate frecuency applied after noise filtering
92
93 float a_rise; //!< tau = a*AMPLITUDE +b (linear relationship)
94 float b_rise; //!< tau = a*AMPLITUDE +b (linear relationship)
95 float a_decay; //!< tau = a*AMPLITUDE +b (linear relationship)
96 float b_decay; //!< tau = a*AMPLITUDE +b (linear relationship)
97
98 bool save_maplog; //!< If true save generated gas map as a log file
99
100 /** @} */
101
102 /** Obtain an estimation of the gas distribution based on raw sensor readings */
104 float &reading,
105 mrpt::system::TTimeStamp &timestamp );
106
107 protected:
108
109 /** The content of each m_lastObservations in the estimation when using the option : MOS_MODEl (useMOSmodel =1)
110 */
112 {
113 float reading; //!< Sensore reading
114 mrpt::system::TTimeStamp timestamp; //!< Timestamp of the observation
115 float tau; //!< tau value applied
116 float estimation; //!< The value estimated according to the MOXmodel
117 float reading_filtered; //!< Reading after smooth (noise averaging)
118 };
119
120 TdataMap last_Obs, temporal_Obs; //!< The content of each m_lastObservations in the estimation when using the option : MOS_MODEl (useMOSmodel =1)
121 std::vector<TdataMap> m_antiNoise_window; //!< Vector to temporally store and averge readings to reduce noise
122 std::ofstream *m_debug_dump; //!< Ofstream to save to file option "save_maplog"
123 uint16_t decimate_count; //!< Decimate value for oversampled enose readings
124 double fixed_incT; //!< To force e-nose samples to have fixed time increments
125 bool first_incT; //!< To force e-nose samples to have fixed time increments
126 float min_reading; //!< Minimum reading value till the moment, used as approximation to baeline level
127 bool first_iteration; //!< To avoid the model estimation on first iteration
128
129 /** Estimates the gas concentration based on readings and sensor model
130 */
132 const float &reading,
133 const mrpt::system::TTimeStamp &timestamp);
134
135 /** Reduce noise by averaging with a mobile window of specific size (winNoise_size)
136 */
138 const float &reading,
139 const mrpt::system::TTimeStamp &timestamp );
140
141 /** Save the gas distribution estiamtion into a log file for offline representation
142 */
144 const mrpt::system::TTimeStamp &timestamp,
145 const float &reading,
146 const float &estimation,
147 const float &tau);
148
149 }; //End of CMOSmodel class def.
150
151 }; // End of class def.
153
154 } // End of namespace
155} // End of namespace
156
157#endif
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
Declares a class within "CObservationGasSensors" that represents a set of gas concentration readings ...
float b_rise
tau = a*AMPLITUDE +b (linear relationship)
double fixed_incT
To force e-nose samples to have fixed time increments.
std::ofstream * m_debug_dump
Ofstream to save to file option "save_maplog".
void noise_filtering(const float &reading, const mrpt::system::TTimeStamp &timestamp)
Reduce noise by averaging with a mobile window of specific size (winNoise_size)
size_t winNoise_size
The size of the mobile average window used to reduce noise on sensor reagings.
void inverse_MOSmodeling(const float &reading, const mrpt::system::TTimeStamp &timestamp)
Estimates the gas concentration based on readings and sensor model.
bool first_iteration
To avoid the model estimation on first iteration.
bool first_incT
To force e-nose samples to have fixed time increments.
float b_decay
tau = a*AMPLITUDE +b (linear relationship)
bool save_maplog
If true save generated gas map as a log file.
bool get_GasDistribution_estimation(float &reading, mrpt::system::TTimeStamp &timestamp)
Obtain an estimation of the gas distribution based on raw sensor readings
float a_rise
tau = a*AMPLITUDE +b (linear relationship)
float min_reading
Minimum reading value till the moment, used as approximation to baeline level.
uint16_t decimate_count
Decimate value for oversampled enose readings.
std::vector< TdataMap > m_antiNoise_window
Vector to temporally store and averge readings to reduce noise.
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.
float a_decay
tau = a*AMPLITUDE +b (linear relationship)
int decimate_value
[useMOSmodel] The decimate frecuency applied after noise filtering
Declares a class derived from "CObservation" that represents a set of readings from gas sensors.
std::vector< TObservationENose > m_readings
One entry per e-nose on the robot.
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) MRPT_OVERRIDE
A general method to change the sensor pose on the robot.
void getDescriptionAsText(std::ostream &o) const MRPT_OVERRIDE
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const MRPT_OVERRIDE
A general method to retrieve the sensor pose on the robot.
Declares a class that represents any robot's observation.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:73
std::vector< int32_t > vector_int
Definition: types_simple.h:23
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
Definition: datetime.h:30
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
The content of each m_lastObservations in the estimation when using the option : MOS_MODEl (useMOSmod...
float reading_filtered
Reading after smooth (noise averaging)
float estimation
The value estimated according to the MOXmodel.
mrpt::system::TTimeStamp timestamp
Timestamp of the observation.
math::TPose3D eNosePoseOnTheRobot
The pose of the sensors on the robot.
std::vector< float > readingsVoltage
The set of readings (in volts) from the array of sensors (size of "sensorTypes" is the same that the ...
vector_int sensorTypes
The kind of sensors in the array (size of "sensorTypes" is the same that the size of "readingsVoltage...
bool hasTemperature
Must be true for "temperature" to contain a valid measurement.
bool isActive
True if the input to this chamber/enose is poluted air, False if clean air.
float temperature
Sensed temperature in Celcius (valid if hasTemperature=true only)



Page generated by Doxygen 1.9.2 for MRPT 1.4.0 SVN: at Mon Sep 20 00:21:41 UTC 2021