ParseTypeCodeData.cpp
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 
24 // -- END LICENSE BLOCK ------------------------------------------------
25 
26 //----------------------------------------------------------------------
33 //----------------------------------------------------------------------
34 
36 
38 
39 namespace sick {
40 namespace data_processing {
41 
43 {
44  m_reader_ptr = std::make_shared<sick::data_processing::ReadWriteHelper>();
45 }
46 
47 
49  sick::datastructure::TypeCode& type_code) const
50 {
51  const uint8_t* data_ptr(buffer.getBuffer().data());
52  type_code.setInterfaceType(readInterfaceType(data_ptr));
53  type_code.setMaxRange(readMaxRange(data_ptr));
54  return true;
55 }
56 
57 
58 uint8_t ParseTypeCodeData::readInterfaceType(const uint8_t*& data_ptr) const
59 {
60  uint8_t type_code_interface_1 = m_reader_ptr->readuint8_t(data_ptr, 14);
61  uint8_t type_code_interface_2 = m_reader_ptr->readuint8_t(data_ptr, 15);
62 
64 
65  if ((type_code_interface_1 == 'Z' && type_code_interface_2 == 'A') ||
66  (type_code_interface_1 == 'A' && type_code_interface_2 == 'A'))
67  {
69  }
70  else if (type_code_interface_1 == 'I' && type_code_interface_2 == 'Z')
71  {
73  }
74  else if ((type_code_interface_1 == 'P' && type_code_interface_2 == 'Z') ||
75  (type_code_interface_1 == 'L' && type_code_interface_2 == 'Z'))
76  {
78  }
79  else if (type_code_interface_1 == 'A' && type_code_interface_2 == 'N')
80  {
82  }
83 
84  return res;
85 }
86 
87 float ParseTypeCodeData::readMaxRange(const uint8_t*& data_ptr) const
88 {
89  uint8_t type_code_interface_1 = m_reader_ptr->readuint8_t(data_ptr, 12);
90  uint8_t type_code_interface_2 = m_reader_ptr->readuint8_t(data_ptr, 13);
91 
93 
94  if ((type_code_interface_1 == '3' && type_code_interface_2 == '0') ||
95  (type_code_interface_1 == '4' && type_code_interface_2 == '0') ||
96  (type_code_interface_1 == '5' && type_code_interface_2 == '5'))
97  {
99  }
100  else if (type_code_interface_1 == '9' && type_code_interface_2 == '0')
101  {
103  }
104 
105  return (float)res;
106 }
107 
108 
109 } // namespace data_processing
110 } // namespace sick
std::shared_ptr< sick::data_processing::ReadWriteHelper > m_reader_ptr
bool parseTCPSequence(const datastructure::PacketBuffer &buffer, datastructure::TypeCode &type_code) const
Parses a tcp sequence to read the type code of the sensor.
A packetbuffer for the raw data from the sensor.
Definition: PacketBuffer.h:61
const VectorBuffer & getBuffer() const
Getter to return the VectorBuffer saved in the PacketBuffer.
ParseTypeCodeData()
Constructor of the parser.
void setMaxRange(float max_distance)
Sets the max range for the scanner.
Definition: TypeCode.cpp:57
float readMaxRange(const uint8_t *&data_ptr) const
Class containing the type code of a laser scanner.
Definition: TypeCode.h:62
void setInterfaceType(uint8_t interface_type)
Sets the interface type for the scanner.
Definition: TypeCode.cpp:47
uint8_t readInterfaceType(const uint8_t *&data_ptr) const


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Thu May 9 2019 02:41:08