Apollo 10.0
自动驾驶开放平台
global_rpt_10.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 lexus {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Globalrpt10::ID = 0x10;
32
33void Globalrpt10::Parse(const std::uint8_t* bytes, int32_t length,
34 Lexus* chassis) const {
35 chassis->mutable_global_rpt_10()->set_config_fault_active(
36 config_fault_active(bytes, length));
37 chassis->mutable_global_rpt_10()->set_pacmod_subsystem_timeout(
38 pacmod_subsystem_timeout(bytes, length));
39 chassis->mutable_global_rpt_10()->set_pacmod_system_enabled(
40 pacmod_system_enabled(bytes, length));
41 chassis->mutable_global_rpt_10()->set_pacmod_system_override_active(
42 pacmod_system_override_active(bytes, length));
43 chassis->mutable_global_rpt_10()->set_pacmod_system_fault_active(
44 pacmod_system_fault_active(bytes, length));
45 chassis->mutable_global_rpt_10()->set_veh_can_timeout(
46 veh_can_timeout(bytes, length));
47 chassis->mutable_global_rpt_10()->set_str_can_timeout(
48 str_can_timeout(bytes, length));
49 chassis->mutable_global_rpt_10()->set_brk_can_timeout(
50 brk_can_timeout(bytes, length));
51 chassis->mutable_global_rpt_10()->set_usr_can_timeout(
52 usr_can_timeout(bytes, length));
53 chassis->mutable_global_rpt_10()->set_usr_can_read_errors(
54 usr_can_read_errors(bytes, length));
55}
56
57// config detail: {'name': 'config_fault_active', 'offset': 0.0,
58// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
59// '[0|1]', 'bit': 15, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
60bool Globalrpt10::config_fault_active(const std::uint8_t* bytes,
61 int32_t length) const {
62 Byte t0(bytes + 1);
63 int32_t x = t0.get_byte(7, 1);
64
65 bool ret = x;
66 return ret;
67}
68
69// config detail: {'name': 'pacmod_subsystem_timeout', 'offset': 0.0,
70// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
71// '[0|1]', 'bit': 5, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
72bool Globalrpt10::pacmod_subsystem_timeout(const std::uint8_t* bytes,
73 int32_t length) const {
74 Byte t0(bytes + 0);
75 int32_t x = t0.get_byte(5, 1);
76
77 bool ret = x;
78 return ret;
79}
80
81// config detail: {'name': 'pacmod_system_enabled', 'enum': {0:
82// 'PACMOD_SYSTEM_ENABLED_CONTROL_DISABLED', 1:
83// 'PACMOD_SYSTEM_ENABLED_CONTROL_ENABLED'}, 'precision': 1.0, 'len': 1,
84// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 0,
85// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
86Global_rpt_10::Pacmod_system_enabledType Globalrpt10::pacmod_system_enabled(
87 const std::uint8_t* bytes, int32_t length) const {
88 Byte t0(bytes + 0);
89 int32_t x = t0.get_byte(0, 1);
90
93 return ret;
94}
95
96// config detail: {'name': 'pacmod_system_override_active', 'enum': {0:
97// 'PACMOD_SYSTEM_OVERRIDE_ACTIVE_NOT_OVERRIDDEN', 1:
98// 'PACMOD_SYSTEM_OVERRIDE_ACTIVE_OVERRIDDEN'}, 'precision': 1.0, 'len': 1,
99// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 1,
100// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
102Globalrpt10::pacmod_system_override_active(const std::uint8_t* bytes,
103 int32_t length) const {
104 Byte t0(bytes + 0);
105 int32_t x = t0.get_byte(1, 1);
106
109 return ret;
110}
111
112// config detail: {'name': 'pacmod_system_fault_active', 'offset': 0.0,
113// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
114// '[0|1]', 'bit': 7, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
115bool Globalrpt10::pacmod_system_fault_active(const std::uint8_t* bytes,
116 int32_t length) const {
117 Byte t0(bytes + 0);
118 int32_t x = t0.get_byte(7, 1);
119
120 bool ret = x;
121 return ret;
122}
123
124// config detail: {'name': 'veh_can_timeout', 'offset': 0.0, 'precision': 1.0,
125// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
126// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
127bool Globalrpt10::veh_can_timeout(const std::uint8_t* bytes,
128 int32_t length) const {
129 Byte t0(bytes + 0);
130 int32_t x = t0.get_byte(6, 1);
131
132 bool ret = x;
133 return ret;
134}
135
136// config detail: {'name': 'str_can_timeout', 'offset': 0.0, 'precision': 1.0,
137// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
138// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
139bool Globalrpt10::str_can_timeout(const std::uint8_t* bytes,
140 int32_t length) const {
141 Byte t0(bytes + 0);
142 int32_t x = t0.get_byte(3, 1);
143
144 bool ret = x;
145 return ret;
146}
147
148// config detail: {'name': 'brk_can_timeout', 'enum': {0:
149// 'BRK_CAN_TIMEOUT_NO_ACTIVE_CAN_TIMEOUT', 1:
150// 'BRK_CAN_TIMEOUT_ACTIVE_CAN_TIMEOUT'}, 'precision': 1.0, 'len': 1,
151// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 4,
152// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
153Global_rpt_10::Brk_can_timeoutType Globalrpt10::brk_can_timeout(
154 const std::uint8_t* bytes, int32_t length) const {
155 Byte t0(bytes + 0);
156 int32_t x = t0.get_byte(4, 1);
157
160 return ret;
161}
162
163// config detail: {'name': 'usr_can_timeout', 'offset': 0.0, 'precision': 1.0,
164// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
165// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
166bool Globalrpt10::usr_can_timeout(const std::uint8_t* bytes,
167 int32_t length) const {
168 Byte t0(bytes + 0);
169 int32_t x = t0.get_byte(2, 1);
170
171 bool ret = x;
172 return ret;
173}
174
175// config detail: {'name': 'usr_can_read_errors', 'offset': 0.0,
176// 'precision': 1.0, 'len': 16, 'is_signed_var': False, 'physical_range':
177// '[0|65535]', 'bit': 55, 'type': 'int', 'order': 'motorola', 'physical_unit':
178// ''}
179int Globalrpt10::usr_can_read_errors(const std::uint8_t* bytes,
180 int32_t length) const {
181 Byte t0(bytes + 6);
182 int32_t x = t0.get_byte(0, 8);
183
184 Byte t1(bytes + 7);
185 int32_t t = t1.get_byte(0, 8);
186 x <<= 8;
187 x |= t;
188
189 int ret = x;
190 return ret;
191}
192} // namespace lexus
193} // namespace canbus
194} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Lexus *chassis) const override
class register implement
Definition arena_queue.h:37