Apollo 10.0
自动驾驶开放平台
aeb_wheelimpulse_355.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
19#include "glog/logging.h"
20
23
24namespace apollo {
25namespace canbus {
26namespace neolix_edu {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Aebwheelimpulse355::ID = 0x355;
32
33void Aebwheelimpulse355::Parse(const std::uint8_t* bytes, int32_t length,
34 Neolix_edu* chassis) const {
35 chassis->mutable_aeb_wheelimpulse_355()->set_flimpulse(
36 flimpulse(bytes, length));
37 chassis->mutable_aeb_wheelimpulse_355()->set_flimpulsevalid(
38 flimpulsevalid(bytes, length));
39 chassis->mutable_aeb_wheelimpulse_355()->set_frimpulse(
40 frimpulse(bytes, length));
41 chassis->mutable_aeb_wheelimpulse_355()->set_frimpulsevalid(
42 frimpulsevalid(bytes, length));
43 chassis->mutable_aeb_wheelimpulse_355()->set_rlimpulse(
44 rlimpulse(bytes, length));
45 chassis->mutable_aeb_wheelimpulse_355()->set_rlimpulsevalid(
46 rlimpulsevalid(bytes, length));
47 chassis->mutable_aeb_wheelimpulse_355()->set_rrimpulse(
48 rrimpulse(bytes, length));
49 chassis->mutable_aeb_wheelimpulse_355()->set_rrimpulsevalid(
50 rrimpulsevalid(bytes, length));
51 chassis->mutable_aeb_wheelimpulse_355()->set_alivecounter(
52 alivecounter(bytes, length));
53 chassis->mutable_aeb_wheelimpulse_355()->set_checksum(
54 checksum(bytes, length));
55}
56
57// config detail: {'description': '0x0:Invalid;0x1:Valid', 'offset': 0.0,
58// 'precision': 1.0, 'len': 10, 'name': 'flimpulse', 'is_signed_var': False,
59// 'physical_range': '[0.0|1023.0]', 'bit': 7, 'type': 'double', 'order':
60// 'motorola', 'physical_unit': 'bit'}
61double Aebwheelimpulse355::flimpulse(const std::uint8_t* bytes,
62 int32_t length) const {
63 Byte t0(bytes + 0);
64 int32_t x = t0.get_byte(0, 8);
65
66 Byte t1(bytes + 1);
67 int32_t t = t1.get_byte(6, 2);
68 x <<= 2;
69 x |= t;
70
71 double ret = x;
72 return ret;
73}
74
75// config detail: {'description': '0x0:Invalid;0x1:Valid', 'offset': 0.0,
76// 'precision': 1.0, 'len': 1, 'name': 'flimpulsevalid', 'is_signed_var': False,
77// 'physical_range': '[0.0|1.0]', 'bit': 13, 'type': 'bool', 'order':
78// 'motorola', 'physical_unit': 'bit'}
79bool Aebwheelimpulse355::flimpulsevalid(const std::uint8_t* bytes,
80 int32_t length) const {
81 Byte t0(bytes + 1);
82 int32_t x = t0.get_byte(5, 1);
83
84 bool ret = x;
85 return ret;
86}
87
88// config detail: {'name': 'frimpulse', 'offset': 0.0, 'precision': 1.0, 'len':
89// 10, 'is_signed_var': False, 'physical_range': '[0.0|1023.0]', 'bit': 12,
90// 'type': 'double', 'order': 'motorola', 'physical_unit': 'km/h'}
91double Aebwheelimpulse355::frimpulse(const std::uint8_t* bytes,
92 int32_t length) const {
93 Byte t0(bytes + 1);
94 int32_t x = t0.get_byte(0, 5);
95
96 Byte t1(bytes + 2);
97 int32_t t = t1.get_byte(3, 5);
98 x <<= 5;
99 x |= t;
100
101 double ret = x;
102 return ret;
103}
104
105// config detail: {'name': 'frimpulsevalid', 'offset': 0.0, 'precision': 1.0,
106// 'len': 1, 'is_signed_var': False, 'physical_range': '[0.0|1.0]', 'bit': 18,
107// 'type': 'bool', 'order': 'motorola', 'physical_unit': 'km/h'}
108bool Aebwheelimpulse355::frimpulsevalid(const std::uint8_t* bytes,
109 int32_t length) const {
110 Byte t0(bytes + 2);
111 int32_t x = t0.get_byte(2, 1);
112
113 bool ret = x;
114 return ret;
115}
116
117// config detail: {'description': '0x0:Invalid;0x1:Valid', 'offset': 0.0,
118// 'precision': 1.0, 'len': 10, 'name': 'rlimpulse', 'is_signed_var': False,
119// 'physical_range': '[0.0|1023.0]', 'bit': 17, 'type': 'double', 'order':
120// 'motorola', 'physical_unit': 'bit'}
121double Aebwheelimpulse355::rlimpulse(const std::uint8_t* bytes,
122 int32_t length) const {
123 Byte t0(bytes + 2);
124 int32_t x = t0.get_byte(0, 2);
125
126 Byte t1(bytes + 3);
127 int32_t t = t1.get_byte(0, 8);
128 x <<= 8;
129 x |= t;
130
131 double ret = x;
132 return ret;
133}
134
135// config detail: {'description': '0x0:Invalid;0x1:Valid', 'offset': 0.0,
136// 'precision': 1.0, 'len': 1, 'name': 'rlimpulsevalid', 'is_signed_var': False,
137// 'physical_range': '[0.0|1.0]', 'bit': 39, 'type': 'bool', 'order':
138// 'motorola', 'physical_unit': 'bit'}
139bool Aebwheelimpulse355::rlimpulsevalid(const std::uint8_t* bytes,
140 int32_t length) const {
141 Byte t0(bytes + 4);
142 int32_t x = t0.get_byte(7, 1);
143
144 bool ret = x;
145 return ret;
146}
147
148// config detail: {'name': 'rrimpulse', 'offset': 0.0, 'precision': 1.0, 'len':
149// 10, 'is_signed_var': False, 'physical_range': '[0.0|1023.0]', 'bit': 38,
150// 'type': 'double', 'order': 'motorola', 'physical_unit': 'km/h'}
151double Aebwheelimpulse355::rrimpulse(const std::uint8_t* bytes,
152 int32_t length) const {
153 Byte t0(bytes + 4);
154 int32_t x = t0.get_byte(0, 7);
155
156 Byte t1(bytes + 5);
157 int32_t t = t1.get_byte(5, 3);
158 x <<= 3;
159 x |= t;
160
161 double ret = x;
162 return ret;
163}
164
165// config detail: {'name': 'rrimpulsevalid', 'offset': 0.0, 'precision': 1.0,
166// 'len': 1, 'is_signed_var': False, 'physical_range': '[0.0|1.0]', 'bit': 44,
167// 'type': 'bool', 'order': 'motorola', 'physical_unit': 'km/h'}
168bool Aebwheelimpulse355::rrimpulsevalid(const std::uint8_t* bytes,
169 int32_t length) const {
170 Byte t0(bytes + 5);
171 int32_t x = t0.get_byte(4, 1);
172
173 bool ret = x;
174 return ret;
175}
176
177// config detail: {'name': 'alivecounter', 'offset': 0.0, 'precision': 1.0,
178// 'len': 4, 'is_signed_var': False, 'physical_range': '[0.0|15.0]', 'bit': 51,
179// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
180double Aebwheelimpulse355::alivecounter(const std::uint8_t* bytes,
181 int32_t length) const {
182 Byte t0(bytes + 6);
183 int32_t x = t0.get_byte(0, 4);
184
185 double ret = x;
186 return ret;
187}
188
189// config detail: {'name': 'checksum', 'offset': 0.0, 'precision': 1.0, 'len':
190// 8, 'is_signed_var': False, 'physical_range': '[0.0|255.0]', 'bit': 63,
191// 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
192double Aebwheelimpulse355::checksum(const std::uint8_t* bytes,
193 int32_t length) const {
194 Byte t0(bytes + 7);
195 int32_t x = t0.get_byte(0, 8);
196
197 double ret = x;
198 return ret;
199}
200} // namespace neolix_edu
201} // namespace canbus
202} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Neolix_edu *chassis) const override
class register implement
Definition arena_queue.h:37