34 namespace primary_interface
59 bp.
parse(packet_size);
70 URCL_LOG_ERROR(
"Failed to read sub-package length, there's likely a parsing error");
73 uint32_t sub_size = bp.
peek<uint32_t>();
74 if (!bp.
checkSize(static_cast<size_t>(sub_size)))
76 URCL_LOG_WARN(
"Invalid sub-package size of %" PRIu32
" received!", sub_size);
88 if (packet ==
nullptr)
96 if (!packet->parseWith(sbp))
98 URCL_LOG_ERROR(
"Sub-package parsing of type %d failed!", static_cast<int>(type));
102 results.push_back(std::move(packet));
106 URCL_LOG_ERROR(
"Sub-package of type %d was not parsed completely!", static_cast<int>(type));
123 bp.
parse(message_type);
125 std::unique_ptr<PrimaryPackage> packet(
messageFromType(message_type, timestamp, source));
126 if (!packet->parseWith(bp))
128 URCL_LOG_ERROR(
"Package parsing of type %d failed!", static_cast<int>(message_type));
132 results.push_back(std::move(packet));
139 URCL_LOG_DEBUG(
"Invalid robot package type recieved: %u", static_cast<uint8_t>(type));
RobotMessagePackageType
Possible RobotMessage types.
void debug()
Logs debugging information about the BinParser object.
#define URCL_LOG_ERROR(...)
void parse(T &val)
Parses the next bytes as given type.
virtual ~PrimaryParser()=default
bool empty()
Checks if no unparsed bytes remain in the buffer.
The BinParser class handles a byte buffer and functionality to iteratively parse the content...
bool parse(comm::BinParser &bp, std::vector< std::unique_ptr< PrimaryPackage >> &results)
Uses the given BinParser to create package objects from the contained serialization.
The primary specific parser. Interprets a given byte stream as serialized primary packages and parses...
The parser is a general paser. The namsepace rtde_interface and primary_interface both iclude classes...
RobotMessage * messageFromType(RobotMessagePackageType type, uint64_t timestamp, uint8_t source)
Base class for a RobotState data packages will be used directly.
void consume()
Sets the current buffer position to the end of the buffer, finishing parsing.
The VersionMessage class handles the version messages sent via the primary UR interface.
bool checkSize(size_t bytes)
Checks if at least a given number of bytes is still remaining unparsed in the buffer.
This messages contains information about the robot's calibration. The DH parameters are a combination...
The RobotMessage class is a parent class for the different received robot messages.
RobotState * stateFromType(RobotStateType type)
#define URCL_LOG_DEBUG(...)
RobotStateType
Possible RobotState types.
#define URCL_LOG_WARN(...)
T peek()
Parses the next bytes as given type without moving the buffer pointer.
RobotPackageType
Possible RobotPackage types.