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 
10 /*
11  This example was contributed by Adrien Barral - Robopec (France)
12 */
13 
14 #include <mrpt/gui.h>
15 #include <mrpt/opengl/CPlanarLaserScan.h> // [mrpt-maps]
17 #include <iostream>
18 
19 using namespace mrpt;
20 using namespace mrpt::obs;
21 using namespace mrpt::opengl;
22 using namespace mrpt::hwdrivers;
23 using namespace mrpt::gui;
24 using namespace std;
25 
26 int main(int argc, char* argv[])
27 {
28  if (argc < 3)
29  {
30  cout << "Usage : " << argv[0] << " <IP> <port> " << endl;
31  return 0;
32  }
33 
34  CLMS100Eth laser(string(argv[1]), atoi(argv[2]));
35  laser.turnOn();
36 
37  bool isOutObs, hardwareError;
39  laser.doProcessSimple(isOutObs, outObs, hardwareError);
40 
41  CDisplayWindow3D win3D("Scan", 200, 200);
42 
43  COpenGLScene::Ptr ptr_scene = win3D.get3DSceneAndLock();
44 
46  mrpt::make_aligned_shared<opengl::CPlanarLaserScan>();
47  obj->clear();
48  obj->setColor(0, 0, 1);
49  obj->setName("scan_LMS100");
50  obj->setScan(outObs);
51  ptr_scene->insert(obj);
52 
53  win3D.unlockAccess3DScene();
54  win3D.forceRepaint();
55 
56  while (win3D.isOpen())
57  {
58  laser.doProcessSimple(isOutObs, outObs, hardwareError);
59 
60  ptr_scene = win3D.get3DSceneAndLock();
62  std::dynamic_pointer_cast<opengl::CPlanarLaserScan>(
63  ptr_scene->getByName("scan_LMS100"));
64  obj->clear();
65  obj->setScan(outObs);
66  win3D.unlockAccess3DScene();
67  win3D.forceRepaint();
68  std::this_thread::sleep_for(20ms);
69  }
70  win3D.waitForKey();
71  return 0;
72 }
mrpt::obs::CObservation2DRangeScan
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
Definition: CObservation2DRangeScan.h:56
obj
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
mrpt::hwdrivers
Contains classes for various device interfaces.
Definition: C2DRangeFinderAbstract.h:22
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
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::opengl::CPlanarLaserScan::Ptr
std::shared_ptr< CPlanarLaserScan > Ptr
Definition: CPlanarLaserScan.h:59
mrpt::hwdrivers::CLMS100Eth
This "software driver" implements the communication protocol for interfacing a SICK LMS100 laser scan...
Definition: CLMS100eth.h:75
mrpt::gui
Classes for creating GUI windows for 2D and 3D visualization.
Definition: about_box.h:16
gui.h
mrpt::opengl::COpenGLScene::Ptr
std::shared_ptr< COpenGLScene > Ptr
Definition: COpenGLScene.h:61
CPlanarLaserScan.h
mrpt::opengl
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
CLMS100eth.h
mrpt::gui::CDisplayWindow3D
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
Definition: CDisplayWindow3D.h:117



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