MRPT  2.0.0
CSinCosLookUpTableFor2DScans.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/math/CVectorDynamic.h> //CVectorFloat
13 #include <map>
14 #include <mutex>
15 
16 namespace mrpt::obs
17 {
18 // Frwd decl:
19 class CObservation2DRangeScan;
20 
21 /** A smart look-up-table (LUT) of sin/cos values for 2D laser scans.
22  * Refer to the main method CSinCosLookUpTableFor2DScans::getSinCosForScan()
23  *
24  * This class is used in mrpt::maps::CPointsMap
25  * \ingroup mrpt_obs_grp
26  */
28 {
29  public:
30  CSinCosLookUpTableFor2DScans() = default;
31  /** Do NOT copy neither the cache nor the mutex */
34  {
35  return *this;
36  }
37 
38  /** A pair of vectors with the cos and sin values. */
40  {
42  };
43 
44  /** Return two vectors with the cos and the sin of the angles for each of
45  * the
46  * rays in a scan, computing them only the first time and returning a
47  * cached copy the rest.
48  * Usage:
49  * \code
50  * CSinCosLookUpTableFor2DScans cache;
51  * ...
52  * const CSinCosLookUpTableFor2DScans::TSinCosValues & sincos_vals =
53  * cache.getSinCosForScan( scan );
54  * \endcode
55  */
57  const CObservation2DRangeScan& scan) const;
58  /** \overload */
60  const T2DScanProperties& scan_prop) const;
61 
62  private:
63  /** The cache of known scans and their sin/cos tables. */
64  mutable std::map<T2DScanProperties, TSinCosValues> m_cache;
65  mutable std::recursive_mutex m_cache_mtx;
66 };
67 
68 } // namespace mrpt::obs
std::map< T2DScanProperties, TSinCosValues > m_cache
The cache of known scans and their sin/cos tables.
const TSinCosValues & getSinCosForScan(const CObservation2DRangeScan &scan) const
Return two vectors with the cos and the sin of the angles for each of the rays in a scan...
Template for column vectors of dynamic size, compatible with Eigen.
Auxiliary struct that holds all the relevant geometry information about a 2D scan.
A smart look-up-table (LUT) of sin/cos values for 2D laser scans.
This namespace contains representation of robot actions and observations.
CSinCosLookUpTableFor2DScans & operator=(const CSinCosLookUpTableFor2DScans &)
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
A pair of vectors with the cos and sin values.
CSinCosLookUpTableFor2DScans(const CSinCosLookUpTableFor2DScans &)
Do NOT copy neither the cache nor the mutex.



Page generated by Doxygen 1.8.14 for MRPT 2.0.0 Git: b38439d21 Tue Mar 31 19:58:06 2020 +0200 at miƩ abr 1 00:50:30 CEST 2020