MIRA
RangeScanInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
47 #ifndef _MIRA_RANGESCANINFO_H_
48 #define _MIRA_RANGESCANINFO_H_
49 
50 #include <math/Angle.h>
51 #include <transform/Pose.h>
53 
55 
56 namespace mira { namespace robot {
57 
59 
67 {
68 public:
71 
73  minimumRange(0.0f),
74  maximumRange(1000.0f),
75  scanTime(Duration::milliseconds(0))
76  {}
77 
78  // keep using Angle for serialization compatibility
79  template <typename Reflector>
80  void reflectConeAngle(Reflector& r)
81  {
82  if (Reflector::isReadOnly::value) {
83  Anglef a(coneAngle);
84  r.property("ConeAngle", a,
85  "The opening angle of a single cone in [deg]",
87  } else {
88  Anglef a;
89  r.property("ConeAngle", a,
90  "The opening angle of a single cone in [deg]",
92  coneAngle = a.rad();
93  }
94  }
95 
97  r.property("ConeAngle",
98  rad2degGetter(coneAngle),
100  "The opening angle of a single cone in [deg]", PropertyHints::minimum(0.f));
101  }
102 
103  template <typename Reflector>
104  void reflect(Reflector& r)
105  {
106  serialization::VersionType version = r.version(2, serialization::AcceptDesiredVersion(), this);
107 
108  r.property("StartAngle", startAngle,
109  "The starting orientation of the first sensor cone in [deg]");
110  r.property("DeltaAngle", deltaAngle,
111  "The delta angle between neighboring cones in [deg]");
112  reflectConeAngle(r);
113  r.property("Aperture", aperture,
114  "The opening diameter (aperture) of the sensor in [m]");
115  r.property("StdError", stdError,
116  "The measuring error of the sensor in [m]");
117  r.property("MinimumRange", minimumRange,
118  "The minimum range of valid measurements "
119  "(measurements below this value result in BelowMinimum range code)");
120  r.property("MaximumRange", maximumRange,
121  "The the maximum range of valid measurements "
122  "(measurements above this value result in AboveMaximum range code)");
123  if (version>=2)
124  r.property("ScanTime", scanTime,
125  "Duration between first and last measurement. Time between consecutive range measurement = scanTime / number of scans",
127  }
128 
130 
131 public:
132 
140  std::pair<float, float> getAnglesForOrientation(const Pose3& mountPosition) const;
141 
142 public:
145 
148 
150  float coneAngle;
151 
153  float aperture;
154 
156  float stdError;
157 
161 
165 
169 };
170 
172 
173 }}
174 
175 #endif
REFLECT_CTRLFLAG_TEMP_TRACKING
tick_type milliseconds() const
Getter< T > rad2degGetter(const T &cref)
float aperture
The aperture of the sensor in [m].
Definition: RangeScanInfo.h:153
float maximumRange
The maximum range of valid measurements (measurements above this value result in AboveMaximum range c...
Definition: RangeScanInfo.h:164
SignedAnglef deltaAngle
The delta angle between neighboring cones.
Definition: RangeScanInfo.h:147
float stdError
The measuring error of the sensor that delivered this scan.
Definition: RangeScanInfo.h:156
Duration scanTime
Duration between first and last measurement.
Definition: RangeScanInfo.h:168
Setter< T > deg2radSetter(T &ref)
void reflectConeAngle(Reflector &r)
Definition: RangeScanInfo.h:80
float coneAngle
The resolution of a single cone.
Definition: RangeScanInfo.h:150
void reflectConeAngle(PropertySerializer &r)
Definition: RangeScanInfo.h:96
RangeScanInfo()
Definition: RangeScanInfo.h:72
RobotDataTypes export macro declaration.
This class stores information about the configuration and geometry of 2D range scans e...
Definition: RangeScanInfo.h:66
constexpr Deg2RadNonNegativeType Deg2RadNonNegative
float minimumRange
The minimum range of valid measurements (measurements below this value result in BelowMinimum range c...
Definition: RangeScanInfo.h:160
PropertyHint minimum(const T &min)
void reflect(Reflector &r)
Definition: RangeScanInfo.h:104
T rad() const
SignedAnglef startAngle
The starting orientation of the first sensor cone.
Definition: RangeScanInfo.h:144
void property(const char *name, T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
#define MIRA_ROBOT_DATATYPES_EXPORT
Definition: RobotDataTypesExports.h:61