1
0
mirror of https://gitlab.com/obbart/universal_robots_ros_driver.git synced 2026-04-10 10:00:48 +02:00

Ignore initial version message

This commit is contained in:
Simon Rasmussen
2017-04-13 10:42:39 +02:00
parent 1e34cdaa37
commit 0302b05691

View File

@@ -33,6 +33,13 @@ public:
bp.parse(packet_size); bp.parse(packet_size);
bp.parse(type); bp.parse(type);
//quietly ignore the intial version message
if (type == message_type::ROBOT_MESSAGE)
{
bp.consume();
return true;
}
if (type != message_type::ROBOT_STATE) if (type != message_type::ROBOT_STATE)
{ {
LOG_WARN("Invalid message type recieved: %u", static_cast<uint8_t>(type)); LOG_WARN("Invalid message type recieved: %u", static_cast<uint8_t>(type));
@@ -53,6 +60,8 @@ public:
return false; return false;
} }
LOG_DEBUG("sub-packet size: %" PRIu32, sub_size);
// deconstruction of a sub parser will increment the position of the parent parser // deconstruction of a sub parser will increment the position of the parent parser
BinParser sbp(bp, sub_size); BinParser sbp(bp, sub_size);
sbp.consume(sizeof(sub_size)); sbp.consume(sizeof(sub_size));
@@ -64,7 +73,7 @@ public:
if (packet == nullptr) if (packet == nullptr)
{ {
sbp.consume(); sbp.consume();
LOG_INFO("Skipping sub-packet of type %d", type); LOG_DEBUG("Skipping sub-packet of type %d", type);
continue; continue;
} }
@@ -78,7 +87,8 @@ public:
if (!sbp.empty()) if (!sbp.empty())
{ {
LOG_ERROR("Sub-package was not parsed completely!"); LOG_ERROR("Sub-package of type %d was not parsed completely!", type);
sbp.debug();
return false; return false;
} }
} }