Apollo 10.0
自动驾驶开放平台
brake_aux_rpt_304.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 Brakeauxrpt304::ID = 0x304;
32
33void Brakeauxrpt304::Parse(const std::uint8_t* bytes, int32_t length,
34 Lexus* chassis) const {
35 chassis->mutable_brake_aux_rpt_304()
36 ->set_brake_on_off_is_valid(brake_on_off_is_valid(bytes, length));
37 chassis->mutable_brake_aux_rpt_304()->set_brake_on_off(
38 brake_on_off(bytes, length));
39 chassis->mutable_brake_aux_rpt_304()->set_user_interaction_is_valid(
40 user_interaction_is_valid(bytes, length));
41 chassis->mutable_brake_aux_rpt_304()->set_user_interaction(
42 user_interaction(bytes, length));
43 chassis->mutable_brake_aux_rpt_304()->set_raw_brake_pressure_is_valid(
44 raw_brake_pressure_is_valid(bytes, length));
45 chassis->mutable_brake_aux_rpt_304()->set_raw_brake_pressure(
46 raw_brake_pressure(bytes, length));
47 chassis->mutable_brake_aux_rpt_304()->set_raw_pedal_force_is_valid(
48 raw_pedal_force_is_valid(bytes, length));
49 chassis->mutable_brake_aux_rpt_304()->set_raw_pedal_force(
50 raw_pedal_force(bytes, length));
51 chassis->mutable_brake_aux_rpt_304()->set_raw_pedal_pos_is_valid(
52 raw_pedal_pos_is_valid(bytes, length));
53 chassis->mutable_brake_aux_rpt_304()->set_raw_pedal_pos(
54 raw_pedal_pos(bytes, length));
55}
56
57// config detail: {'name': 'brake_on_off_is_valid', 'offset': 0.0,
58// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
59// '[0|1]', 'bit': 60, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
60bool Brakeauxrpt304::brake_on_off_is_valid(const std::uint8_t* bytes,
61 int32_t length) const {
62 Byte t0(bytes + 7);
63 int32_t x = t0.get_byte(4, 1);
64
65 bool ret = x;
66 return ret;
67}
68
69// config detail: {'name': 'brake_on_off', 'offset': 0.0, 'precision': 1.0,
70// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 49,
71// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
72bool Brakeauxrpt304::brake_on_off(const std::uint8_t* bytes,
73 int32_t length) const {
74 Byte t0(bytes + 6);
75 int32_t x = t0.get_byte(1, 1);
76
77 bool ret = x;
78 return ret;
79}
80
81// config detail: {'name': 'user_interaction_is_valid', 'offset': 0.0,
82// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
83// '[0|1]', 'bit': 59, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
84bool Brakeauxrpt304::user_interaction_is_valid(const std::uint8_t* bytes,
85 int32_t length) const {
86 Byte t0(bytes + 7);
87 int32_t x = t0.get_byte(3, 1);
88
89 bool ret = x;
90 return ret;
91}
92
93// config detail: {'name': 'user_interaction', 'offset': 0.0, 'precision': 1.0,
94// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 48,
95// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
96bool Brakeauxrpt304::user_interaction(const std::uint8_t* bytes,
97 int32_t length) const {
98 Byte t0(bytes + 6);
99 int32_t x = t0.get_byte(0, 1);
100
101 bool ret = x;
102 return ret;
103}
104
105// config detail: {'name': 'raw_brake_pressure_is_valid', 'offset': 0.0,
106// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
107// '[0|1]', 'bit': 58, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
108bool Brakeauxrpt304::raw_brake_pressure_is_valid(const std::uint8_t* bytes,
109 int32_t length) const {
110 Byte t0(bytes + 7);
111 int32_t x = t0.get_byte(2, 1);
112
113 bool ret = x;
114 return ret;
115}
116
117// config detail: {'name': 'raw_brake_pressure', 'offset': 0.0,
118// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
119// '[-32.768|32.767]', 'bit': 39, 'type': 'double', 'order': 'motorola',
120// 'physical_unit': ''}
121double Brakeauxrpt304::raw_brake_pressure(const std::uint8_t* bytes,
122 int32_t length) const {
123 Byte t0(bytes + 4);
124 int32_t x = t0.get_byte(0, 8);
125
126 Byte t1(bytes + 5);
127 int32_t t = t1.get_byte(0, 8);
128 x <<= 8;
129 x |= t;
130
131 x <<= 16;
132 x >>= 16;
133
134 double ret = x;
135 return ret;
136}
137
138// config detail: {'name': 'raw_pedal_force_is_valid', 'offset': 0.0,
139// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
140// '[0|1]', 'bit': 57, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
141bool Brakeauxrpt304::raw_pedal_force_is_valid(const std::uint8_t* bytes,
142 int32_t length) const {
143 Byte t0(bytes + 7);
144 int32_t x = t0.get_byte(1, 1);
145
146 bool ret = x;
147 return ret;
148}
149
150// config detail: {'name': 'raw_pedal_force', 'offset': 0.0, 'precision': 1.0,
151// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
152// 'bit': 23, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
153double Brakeauxrpt304::raw_pedal_force(const std::uint8_t* bytes,
154 int32_t length) const {
155 Byte t0(bytes + 2);
156 int32_t x = t0.get_byte(0, 8);
157
158 Byte t1(bytes + 3);
159 int32_t t = t1.get_byte(0, 8);
160 x <<= 8;
161 x |= t;
162
163 x <<= 16;
164 x >>= 16;
165
166 double ret = x;
167 return ret;
168}
169
170// config detail: {'name': 'raw_pedal_pos_is_valid', 'offset': 0.0,
171// 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'physical_range':
172// '[0|1]', 'bit': 56, 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
173bool Brakeauxrpt304::raw_pedal_pos_is_valid(const std::uint8_t* bytes,
174 int32_t length) const {
175 Byte t0(bytes + 7);
176 int32_t x = t0.get_byte(0, 1);
177
178 bool ret = x;
179 return ret;
180}
181
182// config detail: {'name': 'raw_pedal_pos', 'offset': 0.0, 'precision': 1.0,
183// 'len': 16, 'is_signed_var': True, 'physical_range': '[-32.768|32.767]',
184// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
185double Brakeauxrpt304::raw_pedal_pos(const std::uint8_t* bytes,
186 int32_t length) const {
187 Byte t0(bytes + 0);
188 int32_t x = t0.get_byte(0, 8);
189
190 Byte t1(bytes + 1);
191 int32_t t = t1.get_byte(0, 8);
192 x <<= 8;
193 x |= t;
194
195 x <<= 16;
196 x >>= 16;
197
198 double ret = x;
199 return ret;
200}
201} // namespace lexus
202} // namespace canbus
203} // 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