Apollo 10.0
自动驾驶开放平台
scu_vcu_1_312.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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#include "glog/logging.h"
21
22namespace apollo {
23namespace canbus {
24namespace ge3 {
25
26using ::apollo::drivers::canbus::Byte;
27
29const int32_t Scuvcu1312::ID = 0x312;
30
31void Scuvcu1312::Parse(const std::uint8_t* bytes, int32_t length,
32 Ge3* chassis) const {
33 chassis->mutable_scu_vcu_1_312()->set_vcu_elcsysfault(
34 vcu_elcsysfault(bytes, length));
35 chassis->mutable_scu_vcu_1_312()->set_vcu_brkpedst(
36 vcu_brkpedst(bytes, length));
37 chassis->mutable_scu_vcu_1_312()->set_vcu_intidx(
38 vcu_intidx(bytes, length));
39 chassis->mutable_scu_vcu_1_312()->set_vcu_gearintidx(
40 vcu_gearintidx(bytes, length));
41 chassis->mutable_scu_vcu_1_312()->set_vcu_geardrvmode(
42 vcu_geardrvmode(bytes, length));
43 chassis->mutable_scu_vcu_1_312()->set_vcu_accpedact(
44 vcu_accpedact(bytes, length));
45 chassis->mutable_scu_vcu_1_312()->set_vcu_brkpedpst(
46 vcu_brkpedpst(bytes, length));
47 chassis->mutable_scu_vcu_1_312()->set_vcu_vehrng(
48 vcu_vehrng(bytes, length));
49 chassis->mutable_scu_vcu_1_312()->set_vcu_accpedpst(
50 vcu_accpedpst(bytes, length));
51 chassis->mutable_scu_vcu_1_312()->set_vcu_vehrdyst(
52 vcu_vehrdyst(bytes, length));
53 chassis->mutable_scu_vcu_1_312()->set_vcu_faultst(
54 vcu_faultst(bytes, length));
55 chassis->mutable_scu_vcu_1_312()->set_vcu_drvmode(
56 vcu_drvmode(bytes, length));
57 chassis->mutable_scu_vcu_1_312()->set_vcu_gearpst(
58 vcu_gearpst(bytes, length));
59 chassis->mutable_scu_vcu_1_312()->set_vcu_gearfaultst(
60 vcu_gearfaultst(bytes, length));
61 chassis->mutable_scu_vcu_1_312()->set_vcu_gearact(
62 vcu_gearact(bytes, length));
63}
64
65// config detail: {'description': 'Gear fault status', 'enum': {0:
66// 'VCU_ELCSYSFAULT_NORMAL', 1: 'VCU_ELCSYSFAULT_FAULT'}, 'precision': 1.0,
67// 'len': 1, 'name': 'vcu_elcsysfault', 'is_signed_var': False, 'offset': 0.0,
68// 'physical_range': '[0|0]', 'bit': 49, 'type': 'enum', 'order': 'motorola',
69// 'physical_unit': ''}
70Scu_vcu_1_312::Vcu_elcsysfaultType Scuvcu1312::vcu_elcsysfault(
71 const std::uint8_t* bytes, int32_t length) const {
72 Byte t0(bytes + 6);
73 int32_t x = t0.get_byte(1, 1);
74
77 return ret;
78}
79
80// config detail: {'description': 'Brake pedal position', 'enum': {0:
81// 'VCU_BRKPEDST_UNPRESSED', 1: 'VCU_BRKPEDST_PRESSED'}, 'precision': 1.0,
82// 'len': 1, 'name': 'vcu_brkpedst', 'is_signed_var': False, 'offset': 0.0,
83// 'physical_range': '[0|1]', 'bit': 48, 'type': 'enum', 'order': 'motorola',
84// 'physical_unit': ''}
85Scu_vcu_1_312::Vcu_brkpedstType Scuvcu1312::vcu_brkpedst(
86 const std::uint8_t* bytes, int32_t length) const {
87 Byte t0(bytes + 6);
88 int32_t x = t0.get_byte(0, 1);
89
91 static_cast<Scu_vcu_1_312::Vcu_brkpedstType>(x);
92 return ret;
93}
94
95// config detail: {'description': 'VCU interrupt index', 'enum': {0:
96// 'VCU_INTIDX_NOINT', 1: 'VCU_INTIDX_OVERFLOW', 2: 'VCU_INTIDX_TIMEOUT', 3:
97// 'VCU_INTIDX_ACCPEDINT', 4: 'VCU_INTIDX_BRKPEDINT', 5: 'VCU_INTIDX_GEARINT'},
98// 'precision': 1.0, 'len': 3, 'name': 'vcu_intidx', 'is_signed_var': False,
99// 'offset': 0.0, 'physical_range': '[0|7]', 'bit': 58, 'type': 'enum', 'order':
100// 'motorola', 'physical_unit': ''}
101Scu_vcu_1_312::Vcu_intidxType Scuvcu1312::vcu_intidx(const std::uint8_t* bytes,
102 int32_t length) const {
103 Byte t0(bytes + 7);
104 int32_t x = t0.get_byte(0, 3);
105
107 static_cast<Scu_vcu_1_312::Vcu_intidxType>(x);
108 return ret;
109}
110
111// config detail: {'description': 'Gear interrupt index', 'enum': {0:
112// 'VCU_GEARINTIDX_NOINT', 1: 'VCU_GEARINTIDX_OVERFLOW', 2:
113// 'VCU_GEARINTIDX_TIMEOUT'}, 'precision': 1.0, 'len': 3, 'name':
114// 'vcu_gearintidx', 'is_signed_var': False, 'offset': 0.0, 'physical_range':
115// '[0|7]', 'bit': 61, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
116Scu_vcu_1_312::Vcu_gearintidxType Scuvcu1312::vcu_gearintidx(
117 const std::uint8_t* bytes, int32_t length) const {
118 Byte t0(bytes + 7);
119 int32_t x = t0.get_byte(3, 3);
120
122 static_cast<Scu_vcu_1_312::Vcu_gearintidxType>(x);
123 return ret;
124}
125
126// config detail: {'description': 'VCU Gear drive mode', 'enum': {0:
127// 'VCU_GEARDRVMODE_INVALID', 1: 'VCU_GEARDRVMODE_MANUAL', 2:
128// 'VCU_GEARDRVMODE_INTERRUPT', 3: 'VCU_GEARDRVMODE_AUTO'}, 'precision': 1.0,
129// 'len': 2, 'name': 'vcu_geardrvmode', 'is_signed_var': False, 'offset': 0.0,
130// 'physical_range': '[0|3]', 'bit': 63, 'type': 'enum', 'order': 'motorola',
131// 'physical_unit': ''}
132Scu_vcu_1_312::Vcu_geardrvmodeType Scuvcu1312::vcu_geardrvmode(
133 const std::uint8_t* bytes, int32_t length) const {
134 Byte t0(bytes + 7);
135 int32_t x = t0.get_byte(6, 2);
136
139 return ret;
140}
141
142// config detail: {'description': 'Actual acceleration pedal position',
143// 'offset': 0.0, 'precision': 0.05, 'len': 12, 'name': 'vcu_accpedact',
144// 'is_signed_var': False, 'physical_range': '[0|100]', 'bit': 47, 'type':
145// 'double', 'order': 'motorola', 'physical_unit': '%'}
146double Scuvcu1312::vcu_accpedact(const std::uint8_t* bytes,
147 int32_t length) const {
148 Byte t0(bytes + 5);
149 int32_t x = t0.get_byte(0, 8);
150
151 Byte t1(bytes + 6);
152 int32_t t = t1.get_byte(4, 4);
153 x <<= 4;
154 x |= t;
155
156 double ret = x * 0.050000;
157 return ret;
158}
159
160// config detail: {'description': 'Brake pedal position', 'offset': 0.0,
161// 'precision': 0.392, 'len': 8, 'name': 'vcu_brkpedpst', 'is_signed_var':
162// False, 'physical_range': '[0|99.96]', 'bit': 39, 'type': 'double', 'order':
163// 'motorola', 'physical_unit': '%'}
164double Scuvcu1312::vcu_brkpedpst(const std::uint8_t* bytes,
165 int32_t length) const {
166 Byte t0(bytes + 4);
167 int32_t x = t0.get_byte(0, 8);
168
169 double ret = x * 0.392000;
170 return ret;
171}
172
173// config detail: {'description': 'Veh range', 'offset': 0.0, 'precision': 1.0,
174// 'len': 10, 'name': 'vcu_vehrng', 'is_signed_var': False, 'physical_range':
175// '[0|1000]', 'bit': 9, 'type': 'int', 'order': 'motorola', 'physical_unit':
176// 'km'}
177int Scuvcu1312::vcu_vehrng(const std::uint8_t* bytes, int32_t length) const {
178 Byte t0(bytes + 1);
179 int32_t x = t0.get_byte(0, 2);
180
181 Byte t1(bytes + 2);
182 int32_t t = t1.get_byte(0, 8);
183 x <<= 8;
184 x |= t;
185
186 int ret = x;
187 return ret;
188}
189
190// config detail: {'description': 'Actual acceleration pedal position',
191// 'offset': 0.0, 'precision': 0.392, 'len': 8, 'name': 'vcu_accpedpst',
192// 'is_signed_var': False, 'physical_range': '[0|99.96]', 'bit': 31, 'type':
193// 'double', 'order': 'motorola', 'physical_unit': '%'}
194double Scuvcu1312::vcu_accpedpst(const std::uint8_t* bytes,
195 int32_t length) const {
196 Byte t0(bytes + 3);
197 int32_t x = t0.get_byte(0, 8);
198
199 double ret = x * 0.392000;
200 return ret;
201}
202
203// config detail: {'description': 'HEV system ready status', 'enum': {0:
204// 'VCU_VEHRDYST_NOTREADY', 1: 'VCU_VEHRDYST_READY'}, 'precision': 1.0, 'len':
205// 1, 'name': 'vcu_vehrdyst', 'is_signed_var': False, 'offset': 0.0,
206// 'physical_range': '[0|1]', 'bit': 0, 'type': 'enum', 'order': 'motorola',
207// 'physical_unit': ''}
208Scu_vcu_1_312::Vcu_vehrdystType Scuvcu1312::vcu_vehrdyst(
209 const std::uint8_t* bytes, int32_t length) const {
210 Byte t0(bytes + 0);
211 int32_t x = t0.get_byte(0, 1);
212
214 static_cast<Scu_vcu_1_312::Vcu_vehrdystType>(x);
215 return ret;
216}
217
218// config detail: {'description': 'VCU fault status', 'enum': {0:
219// 'VCU_FAULTST_NORMAL', 1: 'VCU_FAULTST_DERATE', 2: 'VCU_FAULTST_RSV1', 3:
220// 'VCU_FAULTST_RSV2', 4: 'VCU_FAULTST_RSV3', 5: 'VCU_FAULTST_FAULT'},
221// 'precision': 1.0, 'len': 4, 'name': 'vcu_faultst', 'is_signed_var': False,
222// 'offset': 0.0, 'physical_range': '[0|0]', 'bit': 5, 'type': 'enum', 'order':
223// 'motorola', 'physical_unit': ''}
224Scu_vcu_1_312::Vcu_faultstType Scuvcu1312::vcu_faultst(
225 const std::uint8_t* bytes, int32_t length) const {
226 Byte t0(bytes + 0);
227 int32_t x = t0.get_byte(2, 4);
228
230 static_cast<Scu_vcu_1_312::Vcu_faultstType>(x);
231 return ret;
232}
233
234// config detail: {'description': 'VCU drive mode', 'enum': {0:
235// 'VCU_DRVMODE_INVALID', 1: 'VCU_DRVMODE_MANUAL', 2: 'VCU_DRVMODE_INTERRUPT',
236// 3: 'VCU_DRVMODE_AUTO'}, 'precision': 1.0, 'len': 2, 'name': 'vcu_drvmode',
237// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 7,
238// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
239Scu_vcu_1_312::Vcu_drvmodeType Scuvcu1312::vcu_drvmode(
240 const std::uint8_t* bytes, int32_t length) const {
241 Byte t0(bytes + 0);
242 int32_t x = t0.get_byte(6, 2);
243
245 static_cast<Scu_vcu_1_312::Vcu_drvmodeType>(x);
246 return ret;
247}
248
249// config detail: {'description': 'Gear lever position', 'enum': {0:
250// 'VCU_GEARPST_INVALID', 1: 'VCU_GEARPST_DRIVE', 2: 'VCU_GEARPST_NEUTRAL', 3:
251// 'VCU_GEARPST_REVERSE', 4: 'VCU_GEARPST_PARK'}, 'precision': 1.0, 'len': 3,
252// 'name': 'vcu_gearpst', 'is_signed_var': False, 'offset': 0.0,
253// 'physical_range': '[0|7]', 'bit': 12, 'type': 'enum', 'order': 'motorola',
254// 'physical_unit': ''}
255Scu_vcu_1_312::Vcu_gearpstType Scuvcu1312::vcu_gearpst(
256 const std::uint8_t* bytes, int32_t length) const {
257 Byte t0(bytes + 1);
258 int32_t x = t0.get_byte(2, 3);
259
261 static_cast<Scu_vcu_1_312::Vcu_gearpstType>(x);
262 return ret;
263}
264
265// config detail: {'description': 'Gear fault status', 'enum': {0:
266// 'VCU_GEARFAULTST_NORMAL', 1: 'VCU_GEARFAULTST_FAULT'}, 'precision': 1.0,
267// 'len': 1, 'name': 'vcu_gearfaultst', 'is_signed_var': False, 'offset': 0.0,
268// 'physical_range': '[0|0]', 'bit': 1, 'type': 'enum', 'order': 'motorola',
269// 'physical_unit': ''}
270Scu_vcu_1_312::Vcu_gearfaultstType Scuvcu1312::vcu_gearfaultst(
271 const std::uint8_t* bytes, int32_t length) const {
272 Byte t0(bytes + 0);
273 int32_t x = t0.get_byte(1, 1);
274
277 return ret;
278}
279
280// config detail: {'description': 'Actual gear', 'enum': {0:
281// 'VCU_GEARACT_INVALID', 1: 'VCU_GEARACT_DRIVE', 2: 'VCU_GEARACT_NEUTRAL', 3:
282// 'VCU_GEARACT_REVERSE', 4: 'VCU_GEARACT_PARK'}, 'precision': 1.0, 'len': 3,
283// 'name': 'vcu_gearact', 'is_signed_var': False, 'offset': 0.0,
284// 'physical_range': '[0|7]', 'bit': 15, 'type': 'enum', 'order': 'motorola',
285// 'physical_unit': ''}
286Scu_vcu_1_312::Vcu_gearactType Scuvcu1312::vcu_gearact(
287 const std::uint8_t* bytes, int32_t length) const {
288 Byte t0(bytes + 1);
289 int32_t x = t0.get_byte(5, 3);
290
292 static_cast<Scu_vcu_1_312::Vcu_gearactType>(x);
293 return ret;
294}
295} // namespace ge3
296} // namespace canbus
297} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Ge3 *chassis) const override
class register implement
Definition arena_queue.h:37