ViSP  2.9.0
vpSickLDMRS.h
1 /****************************************************************************
2  *
3  * $Id: vpSickLDMRS.h 4632 2014-02-03 17:06:40Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Sick LD-MRS laser driver.
36  *
37  * Authors:
38  * Fabien Spindler
39  *
40  *****************************************************************************/
41 #ifndef vpSickLDMRS_h
42 #define vpSickLDMRS_h
43 
44 #include <visp/vpConfig.h>
45 
46 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
47 
48 #include <arpa/inet.h>
49 #include <iostream>
50 #include <vector>
51 #include <string.h>
52 
53 #include <visp/vpScanPoint.h>
54 #include <visp/vpLaserScan.h>
55 #include <visp/vpLaserScanner.h>
56 #include <visp/vpColVector.h>
57 #include <visp/vpException.h>
58 
110 class VISP_EXPORT vpSickLDMRS : public vpLaserScanner
111 {
112  public:
113  enum MagicWord {
114  MagicWordC2 = 0xAFFEC0C2
115  };
116  enum DataType {
117  MeasuredData = 0x2202
118  };
119  vpSickLDMRS();
121  vpSickLDMRS(const vpSickLDMRS &sick)
122  : vpLaserScanner(sick), socket_fd(-1), body(NULL), vAngle(), time_offset(0),
123  isFirstMeasure(true), maxlen_body(104000)
124  {
125  *this = sick;
126  };
127  virtual ~vpSickLDMRS();
129  vpSickLDMRS &operator=(const vpSickLDMRS &sick)
130  {
131  socket_fd = sick.socket_fd;
132  vAngle = sick.vAngle;
133  time_offset = sick.time_offset;
134  isFirstMeasure = sick.isFirstMeasure;
135  maxlen_body = sick.maxlen_body;
136  if (body) delete [] body;
137  body = new unsigned char [104000];
138  memcpy(body, sick.body, maxlen_body);
139  return (*this);
140  };
141 
142  bool setup(std::string ip, int port);
143  bool setup();
144  bool measure(vpLaserScan laserscan[4]);
145 
146  protected:
147 #if defined(_WIN32)
148  SOCKET socket_fd;
149 #else
150  int socket_fd;
151 #endif
152  unsigned char *body;
153  vpColVector vAngle; // constant vertical angle for each layer
154  double time_offset;
155  bool isFirstMeasure;
156  size_t maxlen_body;
157  };
158 
159 #endif
160 
161 #endif
Class that defines a generic laser scanner.
Implements a laser scan data structure that contains especially the list of scanned points that have ...
Definition: vpLaserScan.h:66
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72