Apollo 10.0
自动驾驶开放平台
steering_rpt_22c.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 Steeringrpt22c::ID = 0x22C;
32
33void Steeringrpt22c::Parse(const std::uint8_t* bytes, int32_t length,
34 Lexus* chassis) const {
35 chassis->mutable_steering_rpt_22c()->set_vehicle_fault(
36 vehicle_fault(bytes, length));
37 chassis->mutable_steering_rpt_22c()->set_pacmod_fault(
38 pacmod_fault(bytes, length));
39 chassis->mutable_steering_rpt_22c()->set_override_active(
40 override_active(bytes, length));
41 chassis->mutable_steering_rpt_22c()->set_output_reported_fault(
42 output_reported_fault(bytes, length));
43 chassis->mutable_steering_rpt_22c()->set_input_output_fault(
44 input_output_fault(bytes, length));
45 chassis->mutable_steering_rpt_22c()->set_enabled(
46 enabled(bytes, length));
47 chassis->mutable_steering_rpt_22c()->set_command_output_fault(
48 command_output_fault(bytes, length));
49 chassis->mutable_steering_rpt_22c()->set_manual_input(
50 manual_input(bytes, length));
51 chassis->mutable_steering_rpt_22c()->set_commanded_value(
52 commanded_value(bytes, length));
53 chassis->mutable_steering_rpt_22c()->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 Steeringrpt22c::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 Steeringrpt22c::pacmod_fault(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': 'override_active', 'offset': 0.0, 'precision': 1.0,
82// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
83// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
84bool Steeringrpt22c::override_active(const std::uint8_t* bytes,
85 int32_t length) const {
86 Byte t0(bytes + 0);
87 int32_t x = t0.get_byte(1, 1);
88
89 bool ret = x;
90 return ret;
91}
92
93// config detail: {'name': 'output_reported_fault', 'offset': 0.0,
94// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
95// '[0|1]', 'bit': 4, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
96bool Steeringrpt22c::output_reported_fault(const std::uint8_t* bytes,
97 int32_t length) const {
98 Byte t0(bytes + 0);
99 int32_t x = t0.get_byte(4, 1);
100
101 bool ret = x;
102 return ret;
103}
104
105// config detail: {'name': 'input_output_fault', 'offset': 0.0,
106// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
107// '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
108bool Steeringrpt22c::input_output_fault(const std::uint8_t* bytes,
109 int32_t length) const {
110 Byte t0(bytes + 0);
111 int32_t x = t0.get_byte(3, 1);
112
113 bool ret = x;
114 return ret;
115}
116
117// config detail: {'name': 'enabled', 'offset': 0.0, 'precision': 1.0, 'len': 1,
118// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
119// 'order': 'motorola', 'physical_unit': ''}
120bool Steeringrpt22c::enabled(const std::uint8_t* bytes, int32_t length) const {
121 Byte t0(bytes + 0);
122 int32_t x = t0.get_byte(0, 1);
123
124 bool ret = x;
125 return ret;
126}
127
128// config detail: {'name': 'command_output_fault', 'offset': 0.0,
129// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
130// '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
131bool Steeringrpt22c::command_output_fault(const std::uint8_t* bytes,
132 int32_t length) const {
133 Byte t0(bytes + 0);
134 int32_t x = t0.get_byte(2, 1);
135
136 bool ret = x;
137 return ret;
138}
139
140// config detail: {'name': 'manual_input', 'offset': 0.0, 'precision': 0.001,
141// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
142// 'bit': 15, 'type': 'double', 'order': 'motorola', 'physical_unit': 'rad'}
143double Steeringrpt22c::manual_input(const std::uint8_t* bytes,
144 int32_t length) const {
145 Byte t0(bytes + 1);
146 int32_t x = t0.get_byte(0, 8);
147
148 Byte t1(bytes + 2);
149 int32_t t = t1.get_byte(0, 8);
150 x <<= 8;
151 x |= t;
152
153 x <<= 16;
154 x >>= 16;
155
156 double ret = x * 0.001000;
157 return ret;
158}
159
160// config detail: {'name': 'commanded_value', 'offset': 0.0, 'precision': 0.001,
161// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
162// 'bit': 31, 'type': 'double', 'order': 'motorola', 'physical_unit': 'rad'}
163double Steeringrpt22c::commanded_value(const std::uint8_t* bytes,
164 int32_t length) const {
165 Byte t0(bytes + 3);
166 int32_t x = t0.get_byte(0, 8);
167
168 Byte t1(bytes + 4);
169 int32_t t = t1.get_byte(0, 8);
170 x <<= 8;
171 x |= t;
172
173 x <<= 16;
174 x >>= 16;
175
176 double ret = x * 0.001000;
177 return ret;
178}
179
180// config detail: {'name': 'output_value', 'offset': 0.0, 'precision': 0.001,
181// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
182// 'bit': 47, 'type': 'double', 'order': 'motorola', 'physical_unit': 'rad'}
183double Steeringrpt22c::output_value(const std::uint8_t* bytes,
184 int32_t length) const {
185 Byte t0(bytes + 5);
186 int32_t x = t0.get_byte(0, 8);
187
188 Byte t1(bytes + 6);
189 int32_t t = t1.get_byte(0, 8);
190 x <<= 8;
191 x |= t;
192
193 x <<= 16;
194 x >>= 16;
195
196 double ret = x * 0.001000;
197 return ret;
198}
199} // namespace lexus
200} // namespace canbus
201} // 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