ScannerSickS300.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef SCANNERSICKS300_INCLUDEDEF_H
19 #define SCANNERSICKS300_INCLUDEDEF_H
20 //-----------------------------------------------
21 
22 // base classes
23 #include <string>
24 #include <vector>
25 #include <map>
26 #include <iostream>
27 #include <math.h>
28 #include <stdio.h>
29 
30 #include <cob_sick_s300/SerialIO.h>
32 
41 {
42 public:
43 
44  // set of parameters which are specific to the SickS300
45  struct ParamType
46  {
47  int range_field; //measurement range (1 to 5) --> usually 1 (default)
48  double dScale; // scaling of the scan (multiply with to get scan in meters)
49  double dStartAngle; // scan start angle
50  double dStopAngle; // scan stop angle
51  };
52 
53  // storage container for received scanner data
55  {
56  double dr; // distance //r;
57  double da; // angle //a;
58  double di; // intensity; //bool bGlare;
59  };
60 
61  enum
62  {
64  READ_BUF_SIZE = 10000,
66  };
67 
68  // Constructor
70 
71  // Destructor
73 
80  bool open(const char* pcPort, int iBaudRate, int iScanId);
81 
82  // not implemented
83  void resetStartup();
84 
85  // not implmented
86  void startScanner();
87 
88  // not implemented
89  void stopScanner();
90  //sick_lms.Uninitialize();
91 
92  // whether the scanner is currently in Standby or not
93  bool isInStandby() {return m_bInStandby;}
94 
95  void purgeScanBuf();
96 
97  bool getScan(std::vector<double> &vdDistanceM, std::vector<double> &vdAngleRAD, std::vector<double> &vdIntensityAU, unsigned int &iTimestamp, unsigned int &iTimeNow, const bool debug);
98 
99  void setRangeField(const int field, const ParamType &param) {m_Params[field] = param;}
100 
101 private:
102 
103  // Constants
104  static const double c_dPi;
105 
106  // Parameters
107  typedef std::map<int, ParamType> PARAM_MAP;
108  PARAM_MAP m_Params;
109  double m_dBaudMult;
110 
111  // Variables
112  unsigned char m_ReadBuf[READ_BUF_SIZE+10];
113  unsigned char m_ReadBuf2[READ_BUF_SIZE+10];
114  unsigned int m_uiSumReadBytes;
115  std::vector<int> m_viScanRaw;
117  static unsigned char m_iScanId;
120 
121  // Components
124 
125  // Functions
126  void convertScanToPolar(const PARAM_MAP::const_iterator param, std::vector<int> viScanRaw,
127  std::vector<ScanPolarType>& vecScanPolar);
128 
129 };
130 
131 //-----------------------------------------------
132 #endif
void setRangeField(const int field, const ParamType &param)
TelegramParser tp_
unsigned char m_ReadBuf2[READ_BUF_SIZE+10]
std::vector< int > m_viScanRaw
bool open(const char *pcPort, int iBaudRate, int iScanId)
unsigned int m_uiSumReadBytes
static unsigned char m_iScanId
std::map< int, ParamType > PARAM_MAP
unsigned char m_ReadBuf[READ_BUF_SIZE+10]
bool getScan(std::vector< double > &vdDistanceM, std::vector< double > &vdAngleRAD, std::vector< double > &vdIntensityAU, unsigned int &iTimestamp, unsigned int &iTimeNow, const bool debug)
static const double c_dPi
void convertScanToPolar(const PARAM_MAP::const_iterator param, std::vector< int > viScanRaw, std::vector< ScanPolarType > &vecScanPolar)


cob_sick_s300
Author(s): Florian Weisshardt
autogenerated on Wed Apr 7 2021 02:11:50