MRPT  2.0.4
ICP_SLAM_App.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 
18 #include <atomic>
19 
20 namespace mrpt::apps
21 {
22 /** ICP-SLAM virtual base class for application wrappers.
23  *
24  * This virtual base provides the common code to the applications icp-slam and
25  * icp-slam-live, and could be used by users to build their own ICP-SLAM
26  * solution.
27  *
28  * \sa mrpt::slam::CMetricMapBuilderICP
29  * \ingroup mrpt_apps_grp
30  */
33  virtual public mrpt::apps::BaseAppDataSource
34 {
35  public:
37 
38  /** @name Main API
39  * @{ */
40 
41  /** Initializes the application from CLI parameters. Refer to the manpage of
42  * icp-slam and icp-slam-live. Throws on errors.
43  */
44  void initialize(int argc, const char** argv);
45 
46  inline void initialize(int argc, char** argv)
47  {
48  initialize(argc, const_cast<const char**>(argv));
49  }
50 
51  /** Runs with the current parameter set. Throws on errors. */
52  void run();
53 
54  /** @} */
55 
56  /** @name Parameters and options. See: initialize()
57  * @{ */
58 
59  /** Populated in initialize(). Can be replaced or manipulated by the user
60  * after that and before run() to change the parameters loaded from INI
61  * file. */
63 
64  /** If enabled (default), stdin will be watched and application quits if ESC
65  * is pressed. */
66  bool quits_with_esc_key = true;
67 
68  /** @} */
69 
70  /** @name Outputs and result variables
71  * @{ */
72 
73  std::map<mrpt::system::TTimeStamp, mrpt::math::TPose3D> out_estimated_path;
74 
75  /** @} */
76 };
77 
78 /** Instance of ICP_SLAM_App_Base to run mapping from an offline dataset file.
79  */
81 {
82  public:
84 
85  protected:
86  void impl_initialize(int argc, const char** argv) override;
87  std::string impl_get_usage() const override
88  {
89  return "icp-slam <config_file> [dataset.rawlog]";
90  }
91 };
92 
93 /** Instance of ICP_SLAM_App_Base to run mapping from a live LIDAR sensor.
94  */
96 {
97  public:
99  virtual ~ICP_SLAM_App_Live() override;
100 
101  protected:
102  void impl_initialize(int argc, const char** argv) override;
103  std::string impl_get_usage() const override
104  {
105  return "icp-slam-live <config_file>";
106  }
107 
110  mrpt::obs::CSensoryFrame::Ptr& observations,
111  mrpt::obs::CObservation::Ptr& observation) override;
112 
114  {
116  std::string section_name;
117  };
118 
120 
123  std::atomic_bool m_allThreadsMustExit = false;
124 };
125 
126 } // namespace mrpt::apps
mrpt::apps::ICP_SLAM_App_Live::~ICP_SLAM_App_Live
virtual ~ICP_SLAM_App_Live() override
mrpt::obs::CObservation::Ptr
std::shared_ptr< CObservation > Ptr
Definition: CObservation.h:45
mrpt::apps::ICP_SLAM_App_Live::TThreadParams::section_name
std::string section_name
Definition: ICP_SLAM_App.h:116
mrpt::hwdrivers::CGenericSensor::TListObservations
std::multimap< mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr > TListObservations
Definition: CGenericSensor.h:77
mrpt::apps::DataSourceRawlog
Implementation of BaseAppDataSource for reading from a rawlog file.
Definition: DataSourceRawlog.h:22
mrpt::apps::ICP_SLAM_App_Live::m_allThreadsMustExit
std::atomic_bool m_allThreadsMustExit
Definition: ICP_SLAM_App.h:123
CConfigFileMemory.h
mrpt::apps::ICP_SLAM_App_Live::TThreadParams::cfgFile
mrpt::config::CConfigFileBase * cfgFile
Definition: ICP_SLAM_App.h:115
mrpt::apps::ICP_SLAM_App_Rawlog::ICP_SLAM_App_Rawlog
ICP_SLAM_App_Rawlog()
Definition: ICP_SLAM_App.cpp:473
mrpt::obs::CSensoryFrame::Ptr
std::shared_ptr< mrpt::obs ::CSensoryFrame > Ptr
Definition: CSensoryFrame.h:53
mrpt::apps::ICP_SLAM_App_Live::SensorThread
void SensorThread(TThreadParams params)
Definition: ICP_SLAM_App.cpp:594
mrpt::apps::ICP_SLAM_App_Live::impl_get_next_observations
bool impl_get_next_observations(mrpt::obs::CActionCollection::Ptr &action, mrpt::obs::CSensoryFrame::Ptr &observations, mrpt::obs::CObservation::Ptr &observation) override
Get next sensory data.
Definition: ICP_SLAM_App.cpp:540
mrpt::apps::ICP_SLAM_App_Base::run
void run()
Runs with the current parameter set.
Definition: ICP_SLAM_App.cpp:71
mrpt::obs::CActionCollection::Ptr
std::shared_ptr< mrpt::obs ::CActionCollection > Ptr
Definition: CActionCollection.h:28
BaseAppDataSource.h
mrpt::apps::ICP_SLAM_App_Base
ICP-SLAM virtual base class for application wrappers.
Definition: ICP_SLAM_App.h:31
mrpt::apps::ICP_SLAM_App_Live
Instance of ICP_SLAM_App_Base to run mapping from a live LIDAR sensor.
Definition: ICP_SLAM_App.h:95
mrpt::apps::BaseAppDataSource
Virtual interface for offline datasets (rawlog) or live sensors.
Definition: BaseAppDataSource.h:21
mrpt::apps::ICP_SLAM_App_Base::out_estimated_path
std::map< mrpt::system::TTimeStamp, mrpt::math::TPose3D > out_estimated_path
Definition: ICP_SLAM_App.h:73
mrpt::apps::ICP_SLAM_App_Live::TThreadParams
Definition: ICP_SLAM_App.h:113
mrpt::apps::ICP_SLAM_App_Base::initialize
void initialize(int argc, const char **argv)
Initializes the application from CLI parameters.
Definition: ICP_SLAM_App.cpp:44
mrpt::apps::ICP_SLAM_App_Base::quits_with_esc_key
bool quits_with_esc_key
If enabled (default), stdin will be watched and application quits if ESC is pressed.
Definition: ICP_SLAM_App.h:66
CConfigFileBase.h
mrpt::apps::ICP_SLAM_App_Live::m_cs_global_list_obs
std::mutex m_cs_global_list_obs
Definition: ICP_SLAM_App.h:122
mrpt::apps::ICP_SLAM_App_Base::params
mrpt::config::CConfigFileMemory params
Populated in initialize().
Definition: ICP_SLAM_App.h:62
COutputLogger.h
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
CGenericSensor.h
mrpt::apps
Definition: BaseAppDataSource.h:15
argv
const char * argv[]
Definition: RawlogGrabberApp_unittest.cpp:50
mrpt::apps::ICP_SLAM_App_Rawlog::impl_get_usage
std::string impl_get_usage() const override
Definition: ICP_SLAM_App.h:87
mrpt::apps::ICP_SLAM_App_Live::ICP_SLAM_App_Live
ICP_SLAM_App_Live()
Definition: ICP_SLAM_App.cpp:498
mrpt::apps::ICP_SLAM_App_Rawlog::impl_initialize
void impl_initialize(int argc, const char **argv) override
Definition: ICP_SLAM_App.cpp:478
mrpt::apps::ICP_SLAM_App_Base::ICP_SLAM_App_Base
ICP_SLAM_App_Base()
Definition: ICP_SLAM_App.cpp:38
mrpt::system::COutputLogger
Versatile class for consistent logging and management of output messages.
Definition: system/COutputLogger.h:117
mrpt::apps::ICP_SLAM_App_Live::impl_get_usage
std::string impl_get_usage() const override
Definition: ICP_SLAM_App.h:103
mrpt::apps::ICP_SLAM_App_Live::impl_initialize
void impl_initialize(int argc, const char **argv) override
Definition: ICP_SLAM_App.cpp:505
BaseAppInitializableCLI.h
argc
const int argc
Definition: RawlogGrabberApp_unittest.cpp:51
DataSourceRawlog.h
mrpt::apps::BaseAppInitializableCLI
Virtual interface for applications that initialize from CLI parameters.
Definition: BaseAppInitializableCLI.h:19
mrpt::config::CConfigFileMemory
This class implements a config file-like interface over a memory-stored string list.
Definition: config/CConfigFileMemory.h:36
mrpt::apps::ICP_SLAM_App_Rawlog
Instance of ICP_SLAM_App_Base to run mapping from an offline dataset file.
Definition: ICP_SLAM_App.h:80
mrpt::apps::ICP_SLAM_App_Live::m_global_list_obs
mrpt::hwdrivers::CGenericSensor::TListObservations m_global_list_obs
Definition: ICP_SLAM_App.h:121
mrpt::apps::ICP_SLAM_App_Base::initialize
void initialize(int argc, char **argv)
Definition: ICP_SLAM_App.h:46



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Fri Jul 17 08:43:33 UTC 2020