37 TYPE_RESPONSE, TYPE_ERROR};
63 REG_RIGHT_MOTOR_ERROR,
77 REG_LEFT_SPEED_MEASURED,
78 REG_RIGHT_SPEED_MEASURED,
117 this->data[3] = (data >> 0) & 0xFF;
118 this->data[2] = (data >> 8) & 0xFF;
119 this->data[1] = (data >> 16) & 0xFF;
120 this->data[0] = (data >> 24) & 0xFF;
125 return (this->
data[0] << 24) | (this->
data[1] << 16) |
126 (this->
data[2] << 8) | (this->
data[3] << 0);
134 std::copy(
data.begin(),
data.end(), out.begin() + 3);
145 this->
type = serialized[1] & 0x0F;
147 std::copy(serialized.begin() + 3,
148 serialized.begin() + 7,
data.begin());
191 int sum = std::accumulate(data.begin() + 1, data.end() - 1, 0);
197 return 0xFF - (sum - tmp);
static const uint8_t delimeter
MotorMessage::MessageTypes getType() const
void setData(int32_t data)
static uint8_t generateChecksum(const std::vector< uint8_t > &data)
MotorMessage::Registers getRegister() const
boost::array< uint8_t, 8 > RawMotorMessage
static const uint8_t protocol_version
static const uint8_t valid_types[]
static int verifyType(uint8_t t)
RawMotorMessage serialize() const
boost::array< uint8_t, 4 > data
void setRegister(MotorMessage::Registers reg)
void setType(MotorMessage::MessageTypes type)
static const uint8_t valid_registers[]
static int verifyRegister(uint8_t r)
int deserialize(const RawMotorMessage &serialized)