Apollo 10.0
自动驾驶开放平台
llc_diag_fault_620.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 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 transit {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Llcdiagfault620::ID = 0x620;
32
33void Llcdiagfault620::Parse(const std::uint8_t* bytes, int32_t length,
34 Transit* chassis) const {
35 chassis->mutable_llc_diag_fault_620()->set_llc_disengagecounter_brake(
36 llc_disengagecounter_brake(bytes, length));
37 chassis->mutable_llc_diag_fault_620()->set_llc_disengagecounter_steer(
38 llc_disengagecounter_steer(bytes, length));
39 chassis->mutable_llc_diag_fault_620()->set_llc_disengagecounter_throttle(
40 llc_disengagecounter_throttle(bytes, length));
41 chassis->mutable_llc_diag_fault_620()->set_llc_fbk_faultcounter(
42 llc_fbk_faultcounter(bytes, length));
43 chassis->mutable_llc_diag_fault_620()->set_llc_disengagecounter_button(
44 llc_disengagecounter_button(bytes, length));
45 chassis->mutable_llc_diag_fault_620()->set_llc_fbk_version_year(
46 llc_fbk_version_year(bytes, length));
47 chassis->mutable_llc_diag_fault_620()->set_llc_fbk_version_month(
48 llc_fbk_version_month(bytes, length));
49 chassis->mutable_llc_diag_fault_620()->set_llc_fbk_version_day(
50 llc_fbk_version_day(bytes, length));
51 chassis->mutable_llc_diag_fault_620()->set_llc_fbk_version_hour(
52 llc_fbk_version_hour(bytes, length));
53}
54
55// config detail: {'description': 'Counts the number of times that the driver
56// has disengaged autonomy by applying the brakes since system reset..',
57// 'offset': 0.0, 'precision': 1.0, 'len': 8, 'name':
58// 'llc_disengagecounter_brake', 'is_signed_var': False, 'physical_range':
59// '[0|255]', 'bit': 32, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
60int Llcdiagfault620::llc_disengagecounter_brake(const std::uint8_t* bytes,
61 int32_t length) const {
62 Byte t0(bytes + 4);
63 int32_t x = t0.get_byte(0, 8);
64
65 int ret = x;
66 return ret;
67}
68
69// config detail: {'description': 'Counts the number of times that the driver
70// has disengaged autonomy by moving the steering wheel since system reset.',
71// 'offset': 0.0, 'precision': 1.0, 'len': 8, 'name':
72// 'llc_disengagecounter_steer', 'is_signed_var': False, 'physical_range':
73// '[0|255]', 'bit': 16, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
74int Llcdiagfault620::llc_disengagecounter_steer(const std::uint8_t* bytes,
75 int32_t length) const {
76 Byte t0(bytes + 2);
77 int32_t x = t0.get_byte(0, 8);
78
79 int ret = x;
80 return ret;
81}
82
83// config detail: {'description': 'Counts the number of times that the driver
84// has disengaged autonomy by applying throttle since system reset.', 'offset':
85// 0.0, 'precision': 1.0, 'len': 8, 'name': 'llc_disengagecounter_throttle',
86// 'is_signed_var': False, 'physical_range': '[0|255]', 'bit': 24, 'type':
87// 'int', 'order': 'intel', 'physical_unit': ''}
88int Llcdiagfault620::llc_disengagecounter_throttle(const std::uint8_t* bytes,
89 int32_t length) const {
90 Byte t0(bytes + 3);
91 int32_t x = t0.get_byte(0, 8);
92
93 int ret = x;
94 return ret;
95}
96
97// config detail: {'description': 'Counts the number of faults that have
98// occurred since system reset.', 'offset': 0.0, 'precision': 1.0, 'len': 8,
99// 'name': 'llc_fbk_faultcounter', 'is_signed_var': False, 'physical_range':
100// '[0|255]', 'bit': 0, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
101int Llcdiagfault620::llc_fbk_faultcounter(const std::uint8_t* bytes,
102 int32_t length) const {
103 Byte t0(bytes + 0);
104 int32_t x = t0.get_byte(0, 8);
105
106 int ret = x;
107 return ret;
108}
109
110// config detail: {'description': 'Counts the number of times that the driver
111// has disengaged autonomy by applying the brakes since system reset..',
112// 'offset': 0.0, 'precision': 1.0, 'len': 8, 'name':
113// 'llc_disengagecounter_button', 'is_signed_var': False, 'physical_range':
114// '[0|255]', 'bit': 8, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
115int Llcdiagfault620::llc_disengagecounter_button(const std::uint8_t* bytes,
116 int32_t length) const {
117 Byte t0(bytes + 1);
118 int32_t x = t0.get_byte(0, 8);
119
120 int ret = x;
121 return ret;
122}
123
124// config detail: {'description': 'Firmware version', 'offset': 2017.0,
125// 'precision': 1.0, 'len': 7, 'name': 'llc_fbk_version_year', 'is_signed_var':
126// False, 'physical_range': '[2017|2144]', 'bit': 40, 'type': 'int', 'order':
127// 'intel', 'physical_unit': 'g'}
128int Llcdiagfault620::llc_fbk_version_year(const std::uint8_t* bytes,
129 int32_t length) const {
130 Byte t0(bytes + 5);
131 int32_t x = t0.get_byte(0, 7);
132
133 int ret = static_cast<int>(x + 2017.000000);
134 return ret;
135}
136
137// config detail: {'description': 'Firmware version', 'offset': 0.0,
138// 'precision': 1.0, 'len': 4, 'name': 'llc_fbk_version_month', 'is_signed_var':
139// False, 'physical_range': '[0|15]', 'bit': 47, 'type': 'int', 'order':
140// 'intel', 'physical_unit': 'Month'}
141int Llcdiagfault620::llc_fbk_version_month(const std::uint8_t* bytes,
142 int32_t length) const {
143 Byte t0(bytes + 6);
144 int32_t x = t0.get_byte(0, 3);
145
146 Byte t1(bytes + 5);
147 int32_t t = t1.get_byte(7, 1);
148 x <<= 1;
149 x |= t;
150
151 int ret = x;
152 return ret;
153}
154
155// config detail: {'description': 'Firmware version', 'offset': 0.0,
156// 'precision': 1.0, 'len': 5, 'name': 'llc_fbk_version_day', 'is_signed_var':
157// False, 'physical_range': '[0|31]', 'bit': 51, 'type': 'int', 'order':
158// 'intel', 'physical_unit': 'Day'}
159int Llcdiagfault620::llc_fbk_version_day(const std::uint8_t* bytes,
160 int32_t length) const {
161 Byte t0(bytes + 6);
162 int32_t x = t0.get_byte(3, 5);
163
164 int ret = x;
165 return ret;
166}
167
168// config detail: {'description': 'Firmware version', 'offset': 0.0,
169// 'precision': 1.0, 'len': 5, 'name': 'llc_fbk_version_hour', 'is_signed_var':
170// False, 'physical_range': '[0|31]', 'bit': 56, 'type': 'int', 'order':
171// 'intel', 'physical_unit': 'Hour'}
172int Llcdiagfault620::llc_fbk_version_hour(const std::uint8_t* bytes,
173 int32_t length) const {
174 Byte t0(bytes + 7);
175 int32_t x = t0.get_byte(0, 5);
176
177 int ret = x;
178 return ret;
179}
180} // namespace transit
181} // namespace canbus
182} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Transit *chassis) const override
class register implement
Definition arena_queue.h:37