MRPT  2.0.3
CObservationRange.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <mrpt/obs/CObservation.h>
12 #include <mrpt/poses/CPose2D.h>
13 #include <mrpt/poses/CPose3D.h>
15 
16 namespace mrpt::obs
17 {
18 /** Declares a class derived from "CObservation" that
19  encapsules a single range measurement, and associated parameters. This
20  can be used
21  * for example to store measurements from infrared proximity sensors (IR) or
22  ultrasonic sensors (sonars).
23  *
24  * \sa CObservation
25  * \ingroup mrpt_obs_grp
26  */
28 {
30 
31  public:
32  CObservationRange() = default;
33 
34  /** The data members
35  */
38 
39  /** Cone aperture of each ultrasonic beam, in radians. */
40  float sensorConeApperture = mrpt::d2f(20.0_deg);
41 
42  struct TMeasurement
43  {
45  /** Some kind of sensor ID which identifies it on the bus (if
46  * applicable, 0 otherwise)
47  */
48  uint16_t sensorID{0};
49 
50  /** The 6D position of the sensor on the robot.
51  */
53 
54  /** The measured range, in meters (or a value of 0 if there was no
55  * detected echo).
56  */
57  float sensedDistance{0};
58  };
59 
60  using TMeasurementList = std::deque<TMeasurement>;
61  using const_iterator = std::deque<TMeasurement>::const_iterator;
62  using iterator = std::deque<TMeasurement>::iterator;
63 
64  /** All the measurements */
66 
67  iterator begin() { return sensedData.begin(); }
68  iterator end() { return sensedData.end(); }
69  const_iterator begin() const { return sensedData.begin(); }
70  const_iterator end() const { return sensedData.end(); }
71  // See base class docs
72  void getSensorPose(mrpt::poses::CPose3D& out_sensorPose) const override;
73  void setSensorPose(const mrpt::poses::CPose3D& newSensorPose) override;
74  void getDescriptionAsText(std::ostream& o) const override;
75 
76 }; // End of class def.
77 } // namespace mrpt::obs
mrpt::obs::CObservationRange::CObservationRange
CObservationRange()=default
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:152
mrpt::obs::CObservationRange::begin
iterator begin()
Definition: CObservationRange.h:67
mrpt::obs::CObservationRange::iterator
std::deque< TMeasurement >::iterator iterator
Definition: CObservationRange.h:62
mrpt::obs::CObservationRange::const_iterator
std::deque< TMeasurement >::const_iterator const_iterator
Definition: CObservationRange.h:61
mrpt::obs::CObservationRange::TMeasurement
Definition: CObservationRange.h:42
CPose2D.h
mrpt::obs::CObservationRange::TMeasurement::sensedDistance
float sensedDistance
The measured range, in meters (or a value of 0 if there was no detected echo).
Definition: CObservationRange.h:57
mrpt::obs
This namespace contains representation of robot actions and observations.
Definition: CParticleFilter.h:17
mrpt::obs::CObservationRange::TMeasurementList
std::deque< TMeasurement > TMeasurementList
Definition: CObservationRange.h:60
mrpt::obs::CObservationRange::sensedData
TMeasurementList sensedData
All the measurements.
Definition: CObservationRange.h:65
mrpt::obs::CObservationRange::TMeasurement::sensorID
uint16_t sensorID
Some kind of sensor ID which identifies it on the bus (if applicable, 0 otherwise)
Definition: CObservationRange.h:48
mrpt::obs::CObservationRange::sensorConeApperture
float sensorConeApperture
Cone aperture of each ultrasonic beam, in radians.
Definition: CObservationRange.h:40
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
mrpt::obs::CObservationRange::setSensorPose
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) override
A general method to change the sensor pose on the robot.
Definition: CObservationRange.cpp:93
mrpt::d2f
float d2f(const double d)
shortcut for static_cast<float>(double)
Definition: core/include/mrpt/core/bits_math.h:189
mrpt::math::TPose3D
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
Definition: TPose3D.h:24
mrpt::obs::CObservationRange::end
const_iterator end() const
Definition: CObservationRange.h:70
mrpt::obs::CObservationRange::minSensorDistance
float minSensorDistance
The data members.
Definition: CObservationRange.h:36
mrpt::obs::CObservationRange::TMeasurement::sensorPose
math::TPose3D sensorPose
The 6D position of the sensor on the robot.
Definition: CObservationRange.h:52
CPose3D.h
mrpt::obs::CObservationRange
Declares a class derived from "CObservation" that encapsules a single range measurement,...
Definition: CObservationRange.h:27
mrpt::obs::CObservationRange::maxSensorDistance
float maxSensorDistance
Definition: CObservationRange.h:37
mrpt::obs::CObservationRange::begin
const_iterator begin() const
Definition: CObservationRange.h:69
mrpt::obs::CObservationRange::getDescriptionAsText
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
Definition: CObservationRange.cpp:98
CObservation.h
mrpt::obs::CObservation
Declares a class that represents any robot's observation.
Definition: CObservation.h:43
mrpt::obs::CObservationRange::TMeasurement::TMeasurement
TMeasurement()
Definition: CObservationRange.h:44
mrpt::obs::CObservationRange::end
iterator end()
Definition: CObservationRange.h:68
CSerializable.h
mrpt::obs::CObservationRange::getSensorPose
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const override
A general method to retrieve the sensor pose on the robot.
Definition: CObservationRange.cpp:82



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 23:51:15 UTC 2020