Apollo 10.0
自动驾驶开放平台
scu_bcs_1_306.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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#include "glog/logging.h"
21
22namespace apollo {
23namespace canbus {
24namespace ge3 {
25
26using ::apollo::drivers::canbus::Byte;
27
29const int32_t Scubcs1306::ID = 0x306;
30
31void Scubcs1306::Parse(const std::uint8_t* bytes, int32_t length,
32 Ge3* chassis) const {
33 chassis->mutable_scu_bcs_1_306()->set_bcs_aebavailable(
34 bcs_aebavailable(bytes, length));
35 chassis->mutable_scu_bcs_1_306()->set_bcs_cddavailable(
36 bcs_cddavailable(bytes, length));
37 chassis->mutable_scu_bcs_1_306()->set_bcs_brkpedact(
38 bcs_brkpedact(bytes, length));
39 chassis->mutable_scu_bcs_1_306()->set_bcs_intidx(
40 bcs_intidx(bytes, length));
41 chassis->mutable_scu_bcs_1_306()->set_bcs_vdcfaultst(
42 bcs_vdcfaultst(bytes, length));
43 chassis->mutable_scu_bcs_1_306()->set_bcs_vdcactivest(
44 bcs_vdcactivest(bytes, length));
45 chassis->mutable_scu_bcs_1_306()->set_bcs_absfaultst(
46 bcs_absfaultst(bytes, length));
47 chassis->mutable_scu_bcs_1_306()->set_bcs_absactivest(
48 bcs_absactivest(bytes, length));
49 chassis->mutable_scu_bcs_1_306()->set_bcs_faultst(
50 bcs_faultst(bytes, length));
51 chassis->mutable_scu_bcs_1_306()->set_bcs_drvmode(
52 bcs_drvmode(bytes, length));
53}
54
55// config detail: {'description': 'VDC active status', 'enum': {0:
56// 'BCS_AEBAVAILABLE_UNAVAILABLE', 1: 'BCS_AEBAVAILABLE_AVAILABLE'},
57// 'precision': 1.0, 'len': 1, 'name': 'bcs_aebavailable', 'is_signed_var':
58// False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 17, 'type': 'enum',
59// 'order': 'motorola', 'physical_unit': ''}
60Scu_bcs_1_306::Bcs_aebavailableType Scubcs1306::bcs_aebavailable(
61 const std::uint8_t* bytes, int32_t length) const {
62 Byte t0(bytes + 2);
63 int32_t x = t0.get_byte(1, 1);
64
67 return ret;
68}
69
70// config detail: {'description': 'VDC active status', 'enum': {0:
71// 'BCS_CDDAVAILABLE_UNAVAILABLE', 1: 'BCS_CDDAVAILABLE_AVAILABLE'},
72// 'precision': 1.0, 'len': 1, 'name': 'bcs_cddavailable', 'is_signed_var':
73// False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 16, 'type': 'enum',
74// 'order': 'motorola', 'physical_unit': ''}
75Scu_bcs_1_306::Bcs_cddavailableType Scubcs1306::bcs_cddavailable(
76 const std::uint8_t* bytes, int32_t length) const {
77 Byte t0(bytes + 2);
78 int32_t x = t0.get_byte(0, 1);
79
82 return ret;
83}
84
85// config detail: {'description': 'Actual brake pedal position', 'offset': 0.0,
86// 'precision': 0.1, 'len': 10, 'name': 'bcs_brkpedact', 'is_signed_var': False,
87// 'physical_range': '[0|100]', 'bit': 15, 'type': 'double', 'order':
88// 'motorola', 'physical_unit': '%'}
89double Scubcs1306::bcs_brkpedact(const std::uint8_t* bytes,
90 int32_t length) const {
91 Byte t0(bytes + 1);
92 int32_t x = t0.get_byte(0, 8);
93
94 Byte t1(bytes + 2);
95 int32_t t = t1.get_byte(6, 2);
96 x <<= 2;
97 x |= t;
98
99 double ret = x * 0.100000;
100 return ret;
101}
102
103// config detail: {'description': 'BCS interrupt index', 'enum': {0:
104// 'BCS_INTIDX_NOINT', 1: 'BCS_INTIDX_OVERFLOW', 2: 'BCS_INTIDX_TIMEOUT', 3:
105// 'BCS_INTIDX_ACCPEDINT', 4: 'BCS_INTIDX_BRKPEDINT', 5: 'BCS_INTIDX_GEARINT'},
106// 'precision': 1.0, 'len': 3, 'name': 'bcs_intidx', 'is_signed_var': False,
107// 'offset': 0.0, 'physical_range': '[0|7]', 'bit': 21, 'type': 'enum', 'order':
108// 'motorola', 'physical_unit': ''}
109Scu_bcs_1_306::Bcs_intidxType Scubcs1306::bcs_intidx(const std::uint8_t* bytes,
110 int32_t length) const {
111 Byte t0(bytes + 2);
112 int32_t x = t0.get_byte(3, 3);
113
115 static_cast<Scu_bcs_1_306::Bcs_intidxType>(x);
116 return ret;
117}
118
119// config detail: {'description': 'VDC fault status', 'enum': {0:
120// 'BCS_VDCFAULTST_NORMAL', 1: 'BCS_VDCFAULTST_FAULT'}, 'precision': 1.0, 'len':
121// 1, 'name': 'bcs_vdcfaultst', 'is_signed_var': False, 'offset': 0.0,
122// 'physical_range': '[0|1]', 'bit': 1, 'type': 'enum', 'order': 'motorola',
123// 'physical_unit': ''}
124Scu_bcs_1_306::Bcs_vdcfaultstType Scubcs1306::bcs_vdcfaultst(
125 const std::uint8_t* bytes, int32_t length) const {
126 Byte t0(bytes + 0);
127 int32_t x = t0.get_byte(1, 1);
128
130 static_cast<Scu_bcs_1_306::Bcs_vdcfaultstType>(x);
131 return ret;
132}
133
134// config detail: {'description': 'VDC active status', 'enum': {0:
135// 'BCS_VDCACTIVEST_INACTIVE', 1: 'BCS_VDCACTIVEST_ACTIVE'}, 'precision': 1.0,
136// 'len': 1, 'name': 'bcs_vdcactivest', 'is_signed_var': False, 'offset': 0.0,
137// 'physical_range': '[0|1]', 'bit': 2, 'type': 'enum', 'order': 'motorola',
138// 'physical_unit': ''}
139Scu_bcs_1_306::Bcs_vdcactivestType Scubcs1306::bcs_vdcactivest(
140 const std::uint8_t* bytes, int32_t length) const {
141 Byte t0(bytes + 0);
142 int32_t x = t0.get_byte(2, 1);
143
146 return ret;
147}
148
149// config detail: {'description': 'ABS fault status', 'enum': {0:
150// 'BCS_ABSFAULTST_NORMAL', 1: 'BCS_ABSFAULTST_FAULT'}, 'precision': 1.0, 'len':
151// 1, 'name': 'bcs_absfaultst', 'is_signed_var': False, 'offset': 0.0,
152// 'physical_range': '[0|1]', 'bit': 3, 'type': 'enum', 'order': 'motorola',
153// 'physical_unit': ''}
154Scu_bcs_1_306::Bcs_absfaultstType Scubcs1306::bcs_absfaultst(
155 const std::uint8_t* bytes, int32_t length) const {
156 Byte t0(bytes + 0);
157 int32_t x = t0.get_byte(3, 1);
158
160 static_cast<Scu_bcs_1_306::Bcs_absfaultstType>(x);
161 return ret;
162}
163
164// config detail: {'description': 'ABS active status', 'enum': {0:
165// 'BCS_ABSACTIVEST_INACTIVE', 1: 'BCS_ABSACTIVEST_ACTIVE'}, 'precision': 1.0,
166// 'len': 1, 'name': 'bcs_absactivest', 'is_signed_var': False, 'offset': 0.0,
167// 'physical_range': '[0|1]', 'bit': 4, 'type': 'enum', 'order': 'motorola',
168// 'physical_unit': ''}
169Scu_bcs_1_306::Bcs_absactivestType Scubcs1306::bcs_absactivest(
170 const std::uint8_t* bytes, int32_t length) const {
171 Byte t0(bytes + 0);
172 int32_t x = t0.get_byte(4, 1);
173
176 return ret;
177}
178
179// config detail: {'description': 'BCS fault status', 'enum': {0:
180// 'BCS_FAULTST_NORMAL', 1: 'BCS_FAULTST_FAULT'}, 'precision': 1.0, 'len': 1,
181// 'name': 'bcs_faultst', 'is_signed_var': False, 'offset': 0.0,
182// 'physical_range': '[0|1]', 'bit': 5, 'type': 'enum', 'order': 'motorola',
183// 'physical_unit': ''}
184Scu_bcs_1_306::Bcs_faultstType Scubcs1306::bcs_faultst(
185 const std::uint8_t* bytes, int32_t length) const {
186 Byte t0(bytes + 0);
187 int32_t x = t0.get_byte(5, 1);
188
190 static_cast<Scu_bcs_1_306::Bcs_faultstType>(x);
191 return ret;
192}
193
194// config detail: {'description': 'BCS drive mode', 'enum': {0:
195// 'BCS_DRVMODE_INVALID', 1: 'BCS_DRVMODE_MANUAL', 2: 'BCS_DRVMODE_INTERRUPT',
196// 3: 'BCS_DRVMODE_AUTO'}, 'precision': 1.0, 'len': 2, 'name': 'bcs_drvmode',
197// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 7,
198// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
199Scu_bcs_1_306::Bcs_drvmodeType Scubcs1306::bcs_drvmode(
200 const std::uint8_t* bytes, int32_t length) const {
201 Byte t0(bytes + 0);
202 int32_t x = t0.get_byte(6, 2);
203
205 static_cast<Scu_bcs_1_306::Bcs_drvmodeType>(x);
206 return ret;
207}
208} // namespace ge3
209} // namespace canbus
210} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Ge3 *chassis) const override
class register implement
Definition arena_queue.h:37