#include <ScannerSickS300.h>
Classes | |
struct | ParamType |
struct | ScanPolarType |
Public Types | |
enum | { SCANNER_S300_READ_BUF_SIZE = 10000, READ_BUF_SIZE = 10000, WRITE_BUF_SIZE = 10000 } |
Public Member Functions | |
bool | getScan (std::vector< double > &vdDistanceM, std::vector< double > &vdAngleRAD, std::vector< double > &vdIntensityAU, unsigned int &iTimestamp, unsigned int &iTimeNow, const bool debug) |
bool | isInStandby () |
bool | open (const char *pcPort, int iBaudRate, int iScanId) |
void | purgeScanBuf () |
void | resetStartup () |
ScannerSickS300 () | |
void | setRangeField (const int field, const ParamType ¶m) |
void | startScanner () |
void | stopScanner () |
~ScannerSickS300 () | |
Private Types | |
typedef std::map< int, ParamType > | PARAM_MAP |
Private Member Functions | |
void | convertScanToPolar (const PARAM_MAP::const_iterator param, std::vector< int > viScanRaw, std::vector< ScanPolarType > &vecScanPolar) |
Private Attributes | |
int | m_actualBufferSize |
bool | m_bInStandby |
double | m_dBaudMult |
int | m_iPosReadBuf2 |
PARAM_MAP | m_Params |
unsigned char | m_ReadBuf [READ_BUF_SIZE+10] |
unsigned char | m_ReadBuf2 [READ_BUF_SIZE+10] |
SerialIO | m_SerialIO |
unsigned int | m_uiSumReadBytes |
std::vector< int > | m_viScanRaw |
TelegramParser | tp_ |
Static Private Attributes | |
static const double | c_dPi = 3.14159265358979323846 |
static unsigned char | m_iScanId = 7 |
Driver class for the laser scanner SICK S300 Professional. This driver only supports use with 500KBaud in cont. mode
S300 header format in continuous mode:
| 00 00 00 00 | 4 byte reply header
Now starts the actual telegram
| 00 00 | data block number (fixed) | xx xx | size of data telegram (should be dec 1104) | FF xx | last byte decides scanner id, 07 in most cases, but 08 for slave configured scanners | xx xx | protocol version | 0x 00 | status: 00 00 = normal, 01 00 = lockout | xx xx xx xx | scan number | xx xx | telegram number | BB BB | fixed | 11 11 | fixed ... data | xx xx | CRC
Readout of buffer starts with Reply-Header Reply-Header:byte 0 to 3 = 4 bytes Telegram (as it is stored in the Buffer): Position in the telegram Header: bytes 4 to 23 = 20 bytes bytes 0 to 19 Data: bytes 24 to 1105 = 1082 bytes bytes 20 to 1101 CRC: bytes 1106, 1107 = 2 bytes bytes 1102, 1103
for easier parsing Reply-Header and Telegram-Header are combined in the folllowing --> Headerlength = 24 bytes (iHeaderLength) --> Total length in buffer is 1108 bytes --> Telegram length (read from telegram) is 1104 bytes (iDataLength)
if the scanner is in standby, the measurements are 0x4004 according to the Sick Support
Definition at line 106 of file ScannerSickS300.h.
typedef std::map<int, ParamType> ScannerSickS300::PARAM_MAP [private] |
Definition at line 173 of file ScannerSickS300.h.
anonymous enum |
Definition at line 127 of file ScannerSickS300.h.
Definition at line 116 of file ScannerSickS300.cpp.
Definition at line 132 of file ScannerSickS300.cpp.
void ScannerSickS300::convertScanToPolar | ( | const PARAM_MAP::const_iterator | param, |
std::vector< int > | viScanRaw, | ||
std::vector< ScanPolarType > & | vecScanPolar | ||
) | [private] |
Definition at line 255 of file ScannerSickS300.cpp.
bool ScannerSickS300::getScan | ( | std::vector< double > & | vdDistanceM, |
std::vector< double > & | vdAngleRAD, | ||
std::vector< double > & | vdIntensityAU, | ||
unsigned int & | iTimestamp, | ||
unsigned int & | iTimeNow, | ||
const bool | debug | ||
) |
Definition at line 196 of file ScannerSickS300.cpp.
bool ScannerSickS300::isInStandby | ( | ) | [inline] |
Definition at line 159 of file ScannerSickS300.h.
bool ScannerSickS300::open | ( | const char * | pcPort, |
int | iBaudRate, | ||
int | iScanId = 7 |
||
) |
Opens serial port.
pcPort | used "COMx" or "/dev/tty1" |
iBaudRate | baud rate |
iScanId | the scanner id in the data header (7 by default) |
Definition at line 139 of file ScannerSickS300.cpp.
void ScannerSickS300::purgeScanBuf | ( | ) |
Definition at line 171 of file ScannerSickS300.cpp.
void ScannerSickS300::resetStartup | ( | ) |
Definition at line 179 of file ScannerSickS300.cpp.
void ScannerSickS300::setRangeField | ( | const int | field, |
const ParamType & | param | ||
) | [inline] |
Definition at line 165 of file ScannerSickS300.h.
void ScannerSickS300::startScanner | ( | ) |
Definition at line 185 of file ScannerSickS300.cpp.
void ScannerSickS300::stopScanner | ( | ) |
Definition at line 191 of file ScannerSickS300.cpp.
const double ScannerSickS300::c_dPi = 3.14159265358979323846 [static, private] |
Definition at line 170 of file ScannerSickS300.h.
int ScannerSickS300::m_actualBufferSize [private] |
Definition at line 184 of file ScannerSickS300.h.
bool ScannerSickS300::m_bInStandby [private] |
Definition at line 185 of file ScannerSickS300.h.
double ScannerSickS300::m_dBaudMult [private] |
Definition at line 175 of file ScannerSickS300.h.
int ScannerSickS300::m_iPosReadBuf2 [private] |
Definition at line 182 of file ScannerSickS300.h.
unsigned char ScannerSickS300::m_iScanId = 7 [static, private] |
Definition at line 183 of file ScannerSickS300.h.
PARAM_MAP ScannerSickS300::m_Params [private] |
Definition at line 174 of file ScannerSickS300.h.
unsigned char ScannerSickS300::m_ReadBuf[READ_BUF_SIZE+10] [private] |
Definition at line 178 of file ScannerSickS300.h.
unsigned char ScannerSickS300::m_ReadBuf2[READ_BUF_SIZE+10] [private] |
Definition at line 179 of file ScannerSickS300.h.
SerialIO ScannerSickS300::m_SerialIO [private] |
Definition at line 188 of file ScannerSickS300.h.
unsigned int ScannerSickS300::m_uiSumReadBytes [private] |
Definition at line 180 of file ScannerSickS300.h.
std::vector<int> ScannerSickS300::m_viScanRaw [private] |
Definition at line 181 of file ScannerSickS300.h.
TelegramParser ScannerSickS300::tp_ [private] |
Definition at line 189 of file ScannerSickS300.h.