Apollo 10.0
自动驾驶开放平台
turn_rpt_230.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 Turnrpt230::ID = 0x230;
32
33void Turnrpt230::Parse(const std::uint8_t* bytes, int32_t length,
34 Lexus* chassis) const {
35 chassis->mutable_turn_rpt_230()->set_vehicle_fault(
36 vehicle_fault(bytes, length));
37 chassis->mutable_turn_rpt_230()->set_pacmod_fault(
38 pacmod_fault(bytes, length));
39 chassis->mutable_turn_rpt_230()->set_override_active(
40 override_active(bytes, length));
41 chassis->mutable_turn_rpt_230()->set_output_reported_fault(
42 output_reported_fault(bytes, length));
43 chassis->mutable_turn_rpt_230()->set_input_output_fault(
44 input_output_fault(bytes, length));
45 chassis->mutable_turn_rpt_230()->set_enabled(
46 enabled(bytes, length));
47 chassis->mutable_turn_rpt_230()->set_command_output_fault(
48 command_output_fault(bytes, length));
49 chassis->mutable_turn_rpt_230()->set_manual_input(
50 manual_input(bytes, length));
51 chassis->mutable_turn_rpt_230()->set_commanded_value(
52 commanded_value(bytes, length));
53 chassis->mutable_turn_rpt_230()->set_output_value(
54 output_value(bytes, length));
55}
56
57// config detail: {'name': 'vehicle_fault', 'offset': 0.0, 'precision': 1.0,
58// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 6,
59// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
60bool Turnrpt230::vehicle_fault(const std::uint8_t* bytes,
61 int32_t length) const {
62 Byte t0(bytes + 0);
63 int32_t x = t0.get_byte(6, 1);
64
65 bool ret = x;
66 return ret;
67}
68
69// config detail: {'name': 'pacmod_fault', 'offset': 0.0, 'precision': 1.0,
70// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5,
71// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
72bool Turnrpt230::pacmod_fault(const std::uint8_t* bytes, int32_t length) const {
73 Byte t0(bytes + 0);
74 int32_t x = t0.get_byte(5, 1);
75
76 bool ret = x;
77 return ret;
78}
79
80// config detail: {'name': 'override_active', 'offset': 0.0, 'precision': 1.0,
81// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
82// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
83bool Turnrpt230::override_active(const std::uint8_t* bytes,
84 int32_t length) const {
85 Byte t0(bytes + 0);
86 int32_t x = t0.get_byte(1, 1);
87
88 bool ret = x;
89 return ret;
90}
91
92// config detail: {'name': 'output_reported_fault', 'offset': 0.0,
93// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
94// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
95bool Turnrpt230::output_reported_fault(const std::uint8_t* bytes,
96 int32_t length) const {
97 Byte t0(bytes + 0);
98 int32_t x = t0.get_byte(4, 1);
99
100 bool ret = x;
101 return ret;
102}
103
104// config detail: {'name': 'input_output_fault', 'offset': 0.0,
105// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
106// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
107bool Turnrpt230::input_output_fault(const std::uint8_t* bytes,
108 int32_t length) const {
109 Byte t0(bytes + 0);
110 int32_t x = t0.get_byte(3, 1);
111
112 bool ret = x;
113 return ret;
114}
115
116// config detail: {'name': 'enabled', 'offset': 0.0, 'precision': 1.0, 'len': 1,
117// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
118// 'order': 'motorola', 'physical_unit': ''}
119bool Turnrpt230::enabled(const std::uint8_t* bytes, int32_t length) const {
120 Byte t0(bytes + 0);
121 int32_t x = t0.get_byte(0, 1);
122
123 bool ret = x;
124 return ret;
125}
126
127// config detail: {'name': 'command_output_fault', 'offset': 0.0,
128// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
129// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
130bool Turnrpt230::command_output_fault(const std::uint8_t* bytes,
131 int32_t length) const {
132 Byte t0(bytes + 0);
133 int32_t x = t0.get_byte(2, 1);
134
135 bool ret = x;
136 return ret;
137}
138
139// config detail: {'name': 'manual_input', 'enum': {0: 'MANUAL_INPUT_RIGHT', 1:
140// 'MANUAL_INPUT_NONE', 2: 'MANUAL_INPUT_LEFT', 3: 'MANUAL_INPUT_HAZARD'},
141// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
142// 'physical_range': '[0|3]', 'bit': 15, 'type': 'enum', 'order': 'motorola',
143// 'physical_unit': ''}
144Turn_rpt_230::Manual_inputType Turnrpt230::manual_input(
145 const std::uint8_t* bytes, int32_t length) const {
146 Byte t0(bytes + 1);
147 int32_t x = t0.get_byte(0, 8);
148
150 static_cast<Turn_rpt_230::Manual_inputType>(x);
151 return ret;
152}
153
154// config detail: {'name': 'commanded_value', 'enum': {0:
155// 'COMMANDED_VALUE_RIGHT', 1: 'COMMANDED_VALUE_NONE', 2:
156// 'COMMANDED_VALUE_LEFT', 3: 'COMMANDED_VALUE_HAZARD'}, 'precision': 1.0,
157// 'len': 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]',
158// 'bit': 23, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
159Turn_rpt_230::Commanded_valueType Turnrpt230::commanded_value(
160 const std::uint8_t* bytes, int32_t length) const {
161 Byte t0(bytes + 2);
162 int32_t x = t0.get_byte(0, 8);
163
165 static_cast<Turn_rpt_230::Commanded_valueType>(x);
166 return ret;
167}
168
169// config detail: {'name': 'output_value', 'enum': {0: 'OUTPUT_VALUE_RIGHT', 1:
170// 'OUTPUT_VALUE_NONE', 2: 'OUTPUT_VALUE_LEFT', 3: 'OUTPUT_VALUE_HAZARD'},
171// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
172// 'physical_range': '[0|3]', 'bit': 31, 'type': 'enum', 'order': 'motorola',
173// 'physical_unit': ''}
174Turn_rpt_230::Output_valueType Turnrpt230::output_value(
175 const std::uint8_t* bytes, int32_t length) const {
176 Byte t0(bytes + 3);
177 int32_t x = t0.get_byte(0, 8);
178
180 static_cast<Turn_rpt_230::Output_valueType>(x);
181 return ret;
182}
183} // namespace lexus
184} // namespace canbus
185} // 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