88 : m_parser_config(parser_config), m_verbose(
verbose), m_input_fifo(input_fifo), m_scandataformat(scandataformat), m_converter_thread(0), m_run_converter_thread(false), m_msgpack_validator_enabled(false), m_discard_msgpacks_not_validated(false)
108 m_run_converter_thread =
true;
118 m_run_converter_thread =
false;
121 m_output_fifo->Shutdown();
123 if (m_converter_thread)
125 if (m_converter_thread->joinable())
126 m_converter_thread->join();
127 delete m_converter_thread;
128 m_converter_thread = 0;
132 delete m_output_fifo;
146 m_msgpack_validator = msgpack_validator;
147 m_msgpack_validator_enabled = msgpack_validator_enabled;
148 m_discard_msgpacks_not_validated = discard_msgpacks_not_validated;
149 m_msgpack_validator_check_missing_scandata_interval = msgpack_validator_check_missing_scandata_interval;
158 if (!m_input_fifo || !m_output_fifo)
160 ROS_ERROR_STREAM(
"## ERROR MsgPackConverter::Run(): MsgPackConverter not initialized.");
166 for (
size_t msgpack_cnt = 1; m_run_converter_thread; msgpack_cnt++)
168 std::vector<uint8_t> input_payload;
170 size_t input_counter = 0;
171 if (m_input_fifo->Pop(input_payload, input_timestamp, input_counter))
176 bool parse_success =
false;
180 m_msgpack_validator, m_msgpack_validator_enabled, m_discard_msgpacks_not_validated,
true, m_verbose);
188 ROS_ERROR_STREAM(
"## ERROR MsgPackConverter::Run(): invalid scandataformat configuration, unsupported scandataformat=" << m_scandataformat
193 size_t fifo_length = m_output_fifo->Push(msgpack_output, input_timestamp, input_counter);
196 ROS_INFO_STREAM(
"MsgPackConverter::Run(): " << m_input_fifo->Size() <<
" messages in input fifo, " << fifo_length <<
" messages in output fifo.");
207 if (m_msgpack_validator_enabled)
209 if (m_msgpack_validator.validateNotOutOfBound(msgpack_validator_data_collector) ==
false)
210 ROS_ERROR_STREAM(
"## ERROR MsgPackConverter::Run(): msgpack out of bounds validation failed");
212 ROS_INFO_STREAM(
"MsgPackConverter::Run(): msgpack validation passed (no scandata out of bounds)");
213 if(msgpack_cnt >= m_msgpack_validator_check_missing_scandata_interval)
215 if (m_msgpack_validator.validateNoMissingScandata(msgpack_validator_data_collector) ==
false)
216 ROS_ERROR_STREAM(
"## ERROR MsgPackConverter::Run(): msgpack validation failed (scandata missing)");
218 ROS_INFO_STREAM(
"MsgPackConverter::Run(): msgpack validation passed (no scandata missing)");
224 catch (std::exception & e)
226 ROS_ERROR_STREAM(
"## ERROR MsgPackConverter::Run(): parse error " << e.what());
230 m_run_converter_thread =
false;
233 catch (std::exception & e)
237 m_run_converter_thread =
false;