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;
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
ScannerSickS300::isInStandby
bool isInStandby()
Definition: ScannerSickS300.h:93
ScannerSickS300::ScannerSickS300
ScannerSickS300()
Definition: ScannerSickS300.cpp:80
ScannerSickS300::READ_BUF_SIZE
@ READ_BUF_SIZE
Definition: ScannerSickS300.h:64
ScannerSickS300::m_iScanId
static unsigned char m_iScanId
Definition: ScannerSickS300.h:117
TelegramS300.h
ScannerSickS300::m_dBaudMult
double m_dBaudMult
Definition: ScannerSickS300.h:109
ScannerSickS300::convertScanToPolar
void convertScanToPolar(const PARAM_MAP::const_iterator param, std::vector< int > viScanRaw, std::vector< ScanPolarType > &vecScanPolar)
Definition: ScannerSickS300.cpp:219
ScannerSickS300::m_uiSumReadBytes
unsigned int m_uiSumReadBytes
Definition: ScannerSickS300.h:114
ScannerSickS300::m_Params
PARAM_MAP m_Params
Definition: ScannerSickS300.h:108
ScannerSickS300::ScanPolarType::dr
double dr
Definition: ScannerSickS300.h:56
SerialIO
Definition: SerialIO.h:30
ScannerSickS300::ScanPolarType::da
double da
Definition: ScannerSickS300.h:57
ScannerSickS300::m_SerialIO
SerialIO m_SerialIO
Definition: ScannerSickS300.h:122
ScannerSickS300::m_bInStandby
bool m_bInStandby
Definition: ScannerSickS300.h:119
ScannerSickS300::m_ReadBuf
unsigned char m_ReadBuf[READ_BUF_SIZE+10]
Definition: ScannerSickS300.h:112
ScannerSickS300::getScan
bool getScan(std::vector< double > &vdDistanceM, std::vector< double > &vdAngleRAD, std::vector< double > &vdIntensityAU, unsigned int &iTimestamp, unsigned int &iTimeNow, const bool debug)
Definition: ScannerSickS300.cpp:160
ScannerSickS300::ParamType
Definition: ScannerSickS300.h:45
ScannerSickS300::PARAM_MAP
std::map< int, ParamType > PARAM_MAP
Definition: ScannerSickS300.h:107
ScannerSickS300::WRITE_BUF_SIZE
@ WRITE_BUF_SIZE
Definition: ScannerSickS300.h:65
ScannerSickS300::ParamType::dStartAngle
double dStartAngle
Definition: ScannerSickS300.h:49
ScannerSickS300::m_iPosReadBuf2
int m_iPosReadBuf2
Definition: ScannerSickS300.h:116
ScannerSickS300::~ScannerSickS300
~ScannerSickS300()
Definition: ScannerSickS300.cpp:96
ScannerSickS300::ScanPolarType
Definition: ScannerSickS300.h:54
TelegramParser
Definition: TelegramS300.h:44
ScannerSickS300::purgeScanBuf
void purgeScanBuf()
Definition: ScannerSickS300.cpp:135
ScannerSickS300::m_actualBufferSize
int m_actualBufferSize
Definition: ScannerSickS300.h:118
ScannerSickS300::m_viScanRaw
std::vector< int > m_viScanRaw
Definition: ScannerSickS300.h:115
ScannerSickS300::resetStartup
void resetStartup()
Definition: ScannerSickS300.cpp:143
ScannerSickS300::startScanner
void startScanner()
Definition: ScannerSickS300.cpp:149
ScannerSickS300::tp_
TelegramParser tp_
Definition: ScannerSickS300.h:123
param
T param(const std::string &param_name, const T &default_val)
ScannerSickS300::m_ReadBuf2
unsigned char m_ReadBuf2[READ_BUF_SIZE+10]
Definition: ScannerSickS300.h:113
ScannerSickS300::c_dPi
static const double c_dPi
Definition: ScannerSickS300.h:104
ScannerSickS300::ParamType::dStopAngle
double dStopAngle
Definition: ScannerSickS300.h:50
ScannerSickS300::SCANNER_S300_READ_BUF_SIZE
@ SCANNER_S300_READ_BUF_SIZE
Definition: ScannerSickS300.h:63
ScannerSickS300::ParamType::dScale
double dScale
Definition: ScannerSickS300.h:48
ScannerSickS300::open
bool open(const char *pcPort, int iBaudRate, int iScanId)
Definition: ScannerSickS300.cpp:103
ScannerSickS300::ScanPolarType::di
double di
Definition: ScannerSickS300.h:58
ScannerSickS300
Definition: ScannerSickS300.h:40
SerialIO.h
ScannerSickS300::ParamType::range_field
int range_field
Definition: ScannerSickS300.h:47
ScannerSickS300::stopScanner
void stopScanner()
Definition: ScannerSickS300.cpp:155
ScannerSickS300::setRangeField
void setRangeField(const int field, const ParamType &param)
Definition: ScannerSickS300.h:99


cob_sick_s300
Author(s): Florian Weisshardt
autogenerated on Wed Nov 8 2023 03:47:48