MRPT  2.0.3
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
mrpt::obs::CObservation2DRangeScan
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
Definition: CObservation2DRangeScan.h:54
mrpt::obs::CSinCosLookUpTableFor2DScans::CSinCosLookUpTableFor2DScans
CSinCosLookUpTableFor2DScans(const CSinCosLookUpTableFor2DScans &)
Do NOT copy neither the cache nor the mutex.
Definition: CSinCosLookUpTableFor2DScans.h:32
mrpt::obs::CSinCosLookUpTableFor2DScans::m_cache
std::map< T2DScanProperties, TSinCosValues > m_cache
The cache of known scans and their sin/cos tables.
Definition: CSinCosLookUpTableFor2DScans.h:64
mrpt::obs::CSinCosLookUpTableFor2DScans::m_cache_mtx
std::recursive_mutex m_cache_mtx
Definition: CSinCosLookUpTableFor2DScans.h:65
mrpt::obs::T2DScanProperties
Auxiliary struct that holds all the relevant geometry information about a 2D scan.
Definition: T2DScanProperties.h:20
mrpt::obs::CSinCosLookUpTableFor2DScans::getSinCosForScan
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,...
Definition: CSinCosLookUpTableFor2DScans.cpp:24
mrpt::obs
This namespace contains representation of robot actions and observations.
Definition: CParticleFilter.h:17
CVectorDynamic.h
T2DScanProperties.h
mrpt::obs::CSinCosLookUpTableFor2DScans::CSinCosLookUpTableFor2DScans
CSinCosLookUpTableFor2DScans()=default
mrpt::obs::CSinCosLookUpTableFor2DScans::TSinCosValues::ccos
mrpt::math::CVectorFloat ccos
Definition: CSinCosLookUpTableFor2DScans.h:41
mrpt::obs::CSinCosLookUpTableFor2DScans::operator=
CSinCosLookUpTableFor2DScans & operator=(const CSinCosLookUpTableFor2DScans &)
Definition: CSinCosLookUpTableFor2DScans.h:33
mrpt::obs::CSinCosLookUpTableFor2DScans
A smart look-up-table (LUT) of sin/cos values for 2D laser scans.
Definition: CSinCosLookUpTableFor2DScans.h:27
mrpt::obs::CSinCosLookUpTableFor2DScans::TSinCosValues
A pair of vectors with the cos and sin values.
Definition: CSinCosLookUpTableFor2DScans.h:39
mrpt::math::CVectorDynamic
Template for column vectors of dynamic size, compatible with Eigen.
Definition: CVectorDynamic.h:31
mrpt::obs::CSinCosLookUpTableFor2DScans::TSinCosValues::csin
mrpt::math::CVectorFloat csin
Definition: CSinCosLookUpTableFor2DScans.h:41



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Thu May 21 21:53:32 UTC 2020