Visual Servoing Platform  version 3.0.0
vpSickLDMRS.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 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 #ifndef vpSickLDMRS_h
38 #define vpSickLDMRS_h
39 
40 #include <visp3/core/vpConfig.h>
41 
42 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
43 
44 #include <arpa/inet.h>
45 #include <iostream>
46 #include <vector>
47 #include <string.h>
48 
49 #include <visp3/sensor/vpScanPoint.h>
50 #include <visp3/sensor/vpLaserScan.h>
51 #include <visp3/sensor/vpLaserScanner.h>
52 #include <visp3/core/vpColVector.h>
53 #include <visp3/core/vpException.h>
54 
106 class VISP_EXPORT vpSickLDMRS : public vpLaserScanner
107 {
108  public:
109  enum MagicWord {
110  MagicWordC2 = 0xAFFEC0C2
111  };
112  enum DataType {
113  MeasuredData = 0x2202
114  };
115  vpSickLDMRS();
118  : vpLaserScanner(sick), socket_fd(-1), body(NULL), vAngle(), time_offset(0),
119  isFirstMeasure(true), maxlen_body(104000)
120  {
121  *this = sick;
122  };
123  virtual ~vpSickLDMRS();
126  {
127  socket_fd = sick.socket_fd;
128  vAngle = sick.vAngle;
129  time_offset = sick.time_offset;
130  isFirstMeasure = sick.isFirstMeasure;
131  maxlen_body = sick.maxlen_body;
132  if (body) delete [] body;
133  body = new unsigned char [104000];
134  memcpy(body, sick.body, maxlen_body);
135  return (*this);
136  };
137 
138  bool setup(std::string ip, int port);
139  bool setup();
140  bool measure(vpLaserScan laserscan[4]);
141 
142  protected:
143 #if defined(_WIN32)
144  SOCKET socket_fd;
145 #else
146  int socket_fd;
147 #endif
148  unsigned char *body;
149  vpColVector vAngle; // constant vertical angle for each layer
150  double time_offset;
152  size_t maxlen_body;
153  };
154 
155 #endif
156 
157 #endif
Class that defines a generic laser scanner.
vpSickLDMRS & operator=(const vpSickLDMRS &sick)
Definition: vpSickLDMRS.h:125
size_t maxlen_body
Definition: vpSickLDMRS.h:152
double time_offset
Definition: vpSickLDMRS.h:150
bool isFirstMeasure
Definition: vpSickLDMRS.h:151
Implements a laser scan data structure that contains especially the list of scanned points that have ...
Definition: vpLaserScan.h:63
vpColVector vAngle
Definition: vpSickLDMRS.h:149
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
Driver for the Sick LD-MRS laser scanner.
Definition: vpSickLDMRS.h:106
vpSickLDMRS(const vpSickLDMRS &sick)
Definition: vpSickLDMRS.h:117
unsigned char * body
Definition: vpSickLDMRS.h:148