Main MRPT website > C++ reference for MRPT 1.9.9
test.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
12 #include <mrpt/system/CTicTac.h>
14 #include <iostream>
15 #include <thread>
16 
17 using namespace mrpt::hwdrivers;
18 using namespace mrpt::system;
19 using namespace mrpt::obs;
20 using namespace mrpt::config;
21 using namespace std;
22 
23 /** Usage : ./test <conf file name>.ini
24  */
25 int main(int argc, char** argv)
26 {
27  try
28  {
29  string confFileName;
30  if (argc < 2)
31  confFileName = string("./conf.ini");
32  else
33  confFileName = string(argv[1]);
34 
36  string section("IK_1");
37  CConfigFile conf(confFileName);
38  ik.loadConfig(conf, section);
39  ik.initialize();
41  do
42  {
43  ik.doProcess();
44  ik.getObservation(obs);
45  for (size_t i = 0; i < obs.sensedData.size(); i++)
46  {
47  cout << obs.sensedData[i].sensedDistance << "\t";
48  }
49  cout << endl;
50  std::this_thread::sleep_for(10ms);
51  } while (!mrpt::system::os::kbhit());
52 
53  return 0;
54  }
55  catch (std::exception& e)
56  {
57  std::cerr << e.what();
58  return 1;
59  }
60 }
mrpt::system::os::kbhit
bool kbhit() noexcept
An OS-independent version of kbhit, which returns true if a key has been pushed.
Definition: os.cpp:390
mrpt::config
Definition: config/CConfigFile.h:16
CConfigFile.h
mrpt::hwdrivers
Contains classes for various device interfaces.
Definition: C2DRangeFinderAbstract.h:22
mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors
: An interface for the phidget Interface kit board (1018).
Definition: CPhidgetInterfaceKitProximitySensors.h:104
mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::initialize
void initialize()
Initialize the sensor according to the parameters previously read in the configuration file.
Definition: CPhidgetInterfaceKitProximitySensors.cpp:193
mrpt::obs
This namespace contains representation of robot actions and observations.
Definition: CParticleFilter.h:17
main
int main()
Definition: vision_stereo_rectify/test.cpp:78
mrpt::obs::CObservationRange::sensedData
TMeasurementList sensedData
All the measurements.
Definition: CObservationRange.h:69
CPhidgetInterfaceKitProximitySensors.h
mrpt::obs::CObservationRange
Declares a class derived from "CObservation" that encapsules a single range measurement,...
Definition: CObservationRange.h:30
mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::getObservation
void getObservation(mrpt::obs::CObservationRange &outObservation)
This method tries to get a set of range measurements from the IR sensors.
Definition: CPhidgetInterfaceKitProximitySensors.cpp:274
CObservationRange.h
CTicTac.h
mrpt::config::CConfigFile
This class allows loading and storing values and vectors of different types from "....
Definition: config/CConfigFile.h:33
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::hwdrivers::CGenericSensor::loadConfig
void loadConfig(const mrpt::config::CConfigFileBase &configSource, const std::string &section)
Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensor...
Definition: CGenericSensor.cpp:132
mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::doProcess
void doProcess()
This method should be called periodically.
Definition: CPhidgetInterfaceKitProximitySensors.cpp:250
mrpt::system
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Definition: math_frwds.h:25



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST