The packet layer of DYNAMIXEL protocols 1.0 and 2.0: CRC-16, checksum, byte stuffing, the frame writer, the receive scanner and register value coding. Pure functions, no I/O.
More...
|
| constexpr std::array< uint16_t, 256 > | dynamixel::protocol::detail_crc::MakeTable () noexcept |
| | The CRC-16 lookup table, generated at build time from the polynomial 0x8005.
|
| |
| constexpr uint16_t | dynamixel::protocol::Crc16 (uint16_t crc, std::span< const uint8_t > data) noexcept |
| | Continue a protocol 2.0 CRC-16 over more bytes.
|
| |
| constexpr uint8_t | dynamixel::protocol::Checksum1 (std::span< const uint8_t > data) noexcept |
| | The protocol 1.0 checksum of the bytes from the ID to the last parameter.
|
| |
| constexpr std::size_t | dynamixel::protocol::Destuff (std::span< uint8_t > params) noexcept |
| | Remove the stuffed bytes of received protocol 2.0 parameters, in place.
|
| |
| constexpr bool | dynamixel::protocol::detail_scan::MatchesV2 (std::span< const uint8_t > b, std::size_t i) noexcept |
| | Whether the four bytes at i are the protocol 2.0 header FF FF FD 00.
|
| |
| constexpr bool | dynamixel::protocol::detail_scan::IsPartialHeader (Protocol protocol, std::span< const uint8_t > bytes, std::size_t pos, std::size_t left) noexcept |
| | Whether the left bytes at pos (fewer than a header) are the start of one.
|
| |
| constexpr bool | dynamixel::protocol::detail_scan::IsCandidate (Protocol protocol, std::span< const uint8_t > bytes, std::size_t pos, std::size_t left) noexcept |
| | Whether a full header starts at pos.
|
| |
| constexpr bool | dynamixel::protocol::detail_scan::IsPlausible (Protocol protocol, std::span< const uint8_t > bytes, std::size_t pos, std::size_t left, std::size_t max_frame, std::size_t &total) noexcept |
| | The size a candidate packet claims, and whether that claim is plausible.
|
| |
| constexpr bool | dynamixel::protocol::detail_scan::IsChecked (Protocol protocol, std::span< const uint8_t > frame) noexcept |
| | Whether the CRC-16 or checksum of a complete packet matches.
|
| |
| constexpr ScanResult | dynamixel::protocol::Scan (Protocol protocol, std::span< const uint8_t > bytes, std::size_t max_frame) noexcept |
| | Find the first valid status packet in received bytes, skipping garbage and resynchronising after a damaged packet.
|
| |
| constexpr StatusView | dynamixel::protocol::Split (Protocol protocol, std::span< uint8_t > frame) noexcept |
| | Split a valid status packet found by Scan().
|
| |
| constexpr uint32_t | dynamixel::protocol::LoadLe (std::span< const uint8_t > data) noexcept |
| | Read a little-endian unsigned value of 1 to 4 bytes.
|
| |
| constexpr int32_t | dynamixel::protocol::DecodeValue (Kind kind, std::span< const uint8_t > data) noexcept |
| | Decode a register's raw bytes.
|
| |
| constexpr bool | dynamixel::protocol::EncodeValue (Kind kind, std::size_t size, int32_t value, std::span< uint8_t, 4 > out) noexcept |
| | Encode a value into a register's raw bytes.
|
| |
|
|
constexpr std::array< uint8_t, 4 > | dynamixel::protocol::kHeaderV2 {0xFF, 0xFF, 0xFD, 0x00} |
| | First three bytes of a protocol 2.0 header (the fourth is the reserved 0x00).
|
| |
| constexpr std::size_t | dynamixel::protocol::kPrefixV2 = 8 |
| |
| constexpr std::size_t | dynamixel::protocol::kPrefixV1 = 5 |
| |
|
constexpr std::size_t | dynamixel::protocol::kOverheadV2 = kPrefixV2 + 2U |
| | Fixed bytes of a protocol 2.0 packet around its parameters (prefix and CRC).
|
| |
|
constexpr std::size_t | dynamixel::protocol::kOverheadV1 = kPrefixV1 + 1U |
| | Fixed bytes of a protocol 1.0 packet around its parameters (prefix and checksum).
|
| |
| constexpr std::size_t | dynamixel::protocol::kMaxParamsV1 = 253 |
| |
|
constexpr std::array< uint16_t, 256 > | dynamixel::protocol::detail_crc::kTable = MakeTable() |
| | The table MakeTable() built.
|
| |
|
constexpr std::size_t | dynamixel::protocol::kBadStuffing = static_cast<std::size_t>(-1) |
| | Returned by Destuff() for parameters that are not validly stuffed.
|
| |
The packet layer of DYNAMIXEL protocols 1.0 and 2.0: CRC-16, checksum, byte stuffing, the frame writer, the receive scanner and register value coding. Pure functions, no I/O.
- Copyright
- Copyright (c) 2026 The driver-dynamixel authors. SPDX-License-Identifier: MIT
Protocol 2.0 packet: FF FF FD 00 | ID | LEN_L LEN_H | INST | PARAM... | CRC_L CRC_H; LEN counts the instruction, the parameters and the CRC; a status packet carries the error byte as its first parameter. Byte stuffing inserts FD after every FF FF FD of the parameters (e-Manual, protocol 2.0, "Packet Process"). CRC-16 is polynomial 0x8005, initial value 0, no reflection (e-Manual, "CRC Calculation"), computed over the stuffed packet from the header to the last parameter. Protocol 1.0 packet: FF FF | ID | LEN | INST | PARAM... | CHK, LEN = parameters + 2, CHK = ~(ID + LEN + INST + PARAM...) (e-Manual, protocol 1.0).