mars_lib  0.1.0.3dc76ee85e09
Modular and Robust Sensor-Fusion
pressure_measurement_type.h
Go to the documentation of this file.
1 // Copyright (C) 2021-2023 Martin Scheiber, Christian Brommer,
2 // Control of Networked Systems, University of Klagenfurt, Austria.
3 //
4 // All rights reserved.
5 //
6 // This software is licensed under the terms of the BSD-2-Clause-License with
7 // no commercial use allowed, the full terms of which are made available
8 // in the LICENSE file. No license in patents is granted.
9 //
10 // You can contact the authors at <christian.brommer@ieee.org>
11 // and <martin.scheiber@ieee.org>.
12 
13 #ifndef PRESSURE_MEASUREMENT_TYPE_H
14 #define PRESSURE_MEASUREMENT_TYPE_H
15 
18 #include <Eigen/Dense>
19 #include <utility>
20 
21 namespace mars
22 {
24 {
25 public:
26  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
27 
29 
30  PressureMeasurementType(const double& height)
31  {
33  pressure_.data_ = height;
34  }
35 
36  PressureMeasurementType(const double& pressure, const double& temperature)
37  : PressureMeasurementType(pressure, temperature, Pressure::Type::GAS)
38  {
39  }
40 
41  PressureMeasurementType(const double& pressure, const double& temperature, const Pressure::Type& type)
42  {
43  pressure_.type_ = type;
44  pressure_.data_ = pressure;
45  pressure_.temperature_K_ = temperature;
46  }
47 
48  static std::string get_csv_header_string()
49  {
50  std::stringstream os;
51  os << "t, ";
52  os << "pressure, ";
53  os << "temperature, ";
54  os << "type";
55 
56  return os.str();
57  }
58 
59  std::string to_csv_string(const double& timestamp) const
60  {
61  std::stringstream os;
62  os.precision(17);
63  os << timestamp;
64 
65  os << ", " << pressure_.data_;
66  os << ", " << pressure_.temperature_K_;
67  os << ", " << pressure_.type_;
68 
69  return os.str();
70  }
71 };
72 } // namespace mars
73 
74 #endif // PRESSURE_MEASUREMENT_TYPE_H
Definition: measurement_base_class.h:20
Definition: pressure_measurement_type.h:24
PressureMeasurementType(const double &height)
Definition: pressure_measurement_type.h:30
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Pressure pressure_
Raw pressure measurement [Pascal] including the ambient temperature in [K].
Definition: pressure_measurement_type.h:28
PressureMeasurementType(const double &pressure, const double &temperature, const Pressure::Type &type)
Definition: pressure_measurement_type.h:41
static std::string get_csv_header_string()
Definition: pressure_measurement_type.h:48
PressureMeasurementType(const double &pressure, const double &temperature)
Definition: pressure_measurement_type.h:36
std::string to_csv_string(const double &timestamp) const
Definition: pressure_measurement_type.h:59
Definition: buffer.h:27
The Pressure struct describes the raw pressure measurement used for conversion later.
Definition: pressure_conversion.h:25
Type type_
type of the measurement
Definition: pressure_conversion.h:66
double data_
measurement data
Definition: pressure_conversion.h:64
Type
The Type enum determines the type of pressure measurement used for conversion.
Definition: pressure_conversion.h:30
@ HEIGHT
pressure measurement has already been converted to height by sensor
double temperature_K_
ambient temperature when measurement data was observed
Definition: pressure_conversion.h:65