Visual Servoing Platform  version 3.0.1
SickLDMRS-Acq.cpp
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Sick LD-MRS laser driver.
32  *
33  * Authors:
34  * Fabien Spindler
35  *
36  *****************************************************************************/
37 
38 
49 #include <visp3/core/vpDebug.h>
50 #include <visp3/sensor/vpSickLDMRS.h>
51 #include <visp3/io/vpParseArgv.h>
52 
53 
54 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
55 
56 int main()
57 {
58  try {
59  vpSickLDMRS laser;
60  std::string ip = "131.254.12.119";
61 
62  laser.setIpAddress(ip);
63  laser.setup();
64  unsigned long int iter = 0;
65 
66  for ( ; ; ) {
67  double t1 = vpTime::measureTimeMs();
68  vpLaserScan laserscan[4];
69  if (laser.measure(laserscan) == false)
70  continue;
71 
72  iter ++;
73  std::cout << "iter: " << iter << " time: "
74  << vpTime::measureTimeMs() - t1 << " ms" << std::endl;
75  }
76  return 0;
77  }
78  catch(vpException &e) {
79  std::cout << "Catch an exception: " << e << std::endl;
80  return 1;
81  }
82 }
83 
84 #else // #ifdef UNIX
85 
86 int main()
87 {
88  std::cout << "This example is only working on UNIX platforms \n"
89  << "since the Sick LD-MRS driver was not ported to Windows."
90  << std::endl;
91 
92  return 0;
93 }
94 #endif // #ifdef UNIX
bool setup(std::string ip, int port)
error that can be emited by ViSP classes.
Definition: vpException.h:73
VISP_EXPORT double measureTimeMs()
Definition: vpTime.cpp:93
Implements a laser scan data structure that contains especially the list of scanned points that have ...
Definition: vpLaserScan.h:63
Driver for the Sick LD-MRS laser scanner.
Definition: vpSickLDMRS.h:106
bool measure(vpLaserScan laserscan[4])
void setIpAddress(std::string ip_address)