25using ::apollo::drivers::canbus::Byte;
34 static const uint32_t PERIOD = 20 * 1000;
39 Demo* chassis)
const {
40 chassis->mutable_gear_command_103()->set_heartbeat_103(
41 heartbeat_103(bytes, length));
42 chassis->mutable_gear_command_103()->set_gear_target(
43 gear_target(bytes, length));
44 chassis->mutable_gear_command_103()->set_gear_en_ctrl(
45 gear_en_ctrl(bytes, length));
46 chassis->mutable_gear_command_103()->set_checksum_103(
47 checksum_103(bytes, length));
53 heartbeat_103_ = (heartbeat_103_) % 16;
54 set_p_heartbeat_103(data, heartbeat_103_);
56 data[0] ^ data[1] ^ data[2] ^ data[3] ^ data[4] ^ data[5] ^ data[6];
57 set_p_checksum_103(data, checksum_103_);
61 set_p_gear_target(data, gear_target_);
62 set_p_gear_en_ctrl(data, gear_en_ctrl_);
74 heartbeat_103_ = heartbeat_103;
81void Gearcommand103::set_p_heartbeat_103(uint8_t* data,
int heartbeat_103) {
82 heartbeat_103 = ProtocolData::BoundedValue(0, 15, heartbeat_103);
83 int x = heartbeat_103;
85 Byte to_set(data + 0);
86 to_set.set_value(x, 4, 4);
91 gear_target_ = gear_target;
101void Gearcommand103::set_p_gear_target(
105 Byte to_set(data + 1);
106 to_set.set_value(x, 0, 3);
111 gear_en_ctrl_ = gear_en_ctrl;
121void Gearcommand103::set_p_gear_en_ctrl(
123 int x = gear_en_ctrl;
125 Byte to_set(data + 0);
126 to_set.set_value(x, 0, 1);
130 checksum_103_ = checksum_103;
137void Gearcommand103::set_p_checksum_103(uint8_t* data,
int checksum_103) {
138 checksum_103 = ProtocolData::BoundedValue(0, 255, checksum_103);
139 int x = checksum_103;
141 Byte to_set(data + 7);
142 to_set.set_value(x, 0, 8);
145int Gearcommand103::heartbeat_103(
const std::uint8_t* bytes,
146 int32_t length)
const {
148 int32_t x = t0.get_byte(4, 4);
155 const std::uint8_t* bytes, int32_t length)
const {
157 int32_t x = t0.get_byte(0, 3);
165 const std::uint8_t* bytes, int32_t length)
const {
167 int32_t x = t0.get_byte(0, 1);
174int Gearcommand103::checksum_103(
const std::uint8_t* bytes,
175 int32_t length)
const {
177 int32_t x = t0.get_byte(0, 8);
Gearcommand103 * set_heartbeat_103(int heartbeat_103)
void UpdateData_Heartbeat(uint8_t *data) override
uint32_t GetPeriod() const override
Gearcommand103 * set_checksum_103(int checksum_103)
Gearcommand103 * set_gear_en_ctrl(Gear_command_103::Gear_en_ctrlType gear_en_ctrl)
void Parse(const std::uint8_t *bytes, int32_t length, Demo *chassis) const override
void UpdateData(uint8_t *data) override
Gearcommand103 * set_gear_target(Gear_command_103::Gear_targetType gear_target)