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