Apollo 10.0
自动驾驶开放平台
vcu_brake_report_47.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 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 neolix_edu {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Vcubrakereport47::ID = 0x47;
32
33void Vcubrakereport47::Parse(const std::uint8_t* bytes, int32_t length,
34 Neolix_edu* chassis) const {
35 chassis->mutable_vcu_brake_report_47()->set_brake_enable_resp(
36 brake_enable_resp(bytes, length));
37 chassis->mutable_vcu_brake_report_47()->set_control_mode_resp(
38 control_mode_resp(bytes, length));
39 chassis->mutable_vcu_brake_report_47()->set_vcu_real_brake_valid(
40 vcu_real_brake_valid(bytes, length));
41 chassis->mutable_vcu_brake_report_47()->set_vcu_real_brake(
42 vcu_real_brake(bytes, length));
43 chassis->mutable_vcu_brake_report_47()->set_vcu_real_parking_status(
44 vcu_real_parking_status(bytes, length));
45 chassis->mutable_vcu_brake_report_47()->set_vcu_real_parking_valid(
46 vcu_real_parking_valid(bytes, length));
47 chassis->mutable_vcu_brake_report_47()->set_rampauxiliaryindication(
48 rampauxiliaryindication(bytes, length));
49 chassis->mutable_vcu_brake_report_47()->set_vehicleslope(
50 vehicleslope(bytes, length));
51 chassis->mutable_vcu_brake_report_47()->set_vcu_brakerept_alivecounter(
52 vcu_brakerept_alivecounter(bytes, length));
53 chassis->mutable_vcu_brake_report_47()->set_vcu_brakerept_checksum(
54 vcu_brakerept_checksum(bytes, length));
55 chassis->mutable_vcu_brake_report_47()->set_vcu_ehb_brake_state(
56 vcu_ehb_brake_state(bytes, length));
57
58 chassis->mutable_brake()->set_brake_pedal_position(
59 vcu_real_brake(bytes, length));
60 if (vcu_real_parking_status(bytes, length) == 1)
61 chassis->mutable_epb()->set_parking_brake_status(Epb::PBRAKE_ON);
62 if (vcu_real_parking_status(bytes, length) == 0)
63 chassis->mutable_epb()->set_parking_brake_status(Epb::PBRAKE_OFF);
64}
65
66// config detail: {'description': '0x0:disable;0x1:enable', 'offset': 0.0,
67// 'precision': 1.0, 'len': 1, 'name': 'brake_enable_resp', 'is_signed_var':
68// False, 'physical_range': '[0|0]', 'bit': 0, 'type': 'bool', 'order':
69// 'motorola', 'physical_unit': ''}
70bool Vcubrakereport47::brake_enable_resp(const std::uint8_t* bytes,
71 int32_t length) const {
72 Byte t0(bytes + 0);
73 int32_t x = t0.get_byte(0, 1);
74
75 bool ret = x;
76 return ret;
77}
78
79// config detail: {'description': '0x0:Standby;0x1:auto drive;0x2:net
80// drive;0x3:remote control;0x4:emergency brake;0x5~0x7:Reserved', 'enum': {0:
81// 'CONTROL_MODE_RESP_STANDBY', 1: 'CONTROL_MODE_RESP_AUTO_DRIVE', 2:
82// 'CONTROL_MODE_RESP_NET_DRIVE', 3: 'CONTROL_MODE_RESP_REMOTE_CONTROL', 4:
83// 'CONTROL_MODE_RESP_EMERGENCY_BRAKE'}, 'precision': 1.0, 'len': 3, 'name':
84// 'control_mode_resp', 'is_signed_var': False, 'offset': 0.0, 'physical_range':
85// '[0|7]', 'bit': 6, 'type': 'enum', 'order': 'motorola', 'physical_unit':
86// 'bit'}
87Vcu_brake_report_47::Control_mode_respType Vcubrakereport47::control_mode_resp(
88 const std::uint8_t* bytes, int32_t length) const {
89 Byte t0(bytes + 0);
90 int32_t x = t0.get_byte(4, 3);
91
94 return ret;
95}
96
97// config detail: {'description': '0x0:disable;0x1:enable', 'offset': 0.0,
98// 'precision': 1.0, 'len': 1, 'name': 'vcu_real_brake_valid', 'is_signed_var':
99// False, 'physical_range': '[0|0]', 'bit': 7, 'type': 'bool', 'order':
100// 'motorola', 'physical_unit': ''}
101bool Vcubrakereport47::vcu_real_brake_valid(const std::uint8_t* bytes,
102 int32_t length) const {
103 Byte t0(bytes + 0);
104 int32_t x = t0.get_byte(7, 1);
105
106 bool ret = x;
107 return ret;
108}
109
110// config detail: {'name': 'vcu_real_brake', 'offset': 0.0, 'precision': 1.0,
111// 'len': 8, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 15,
112// 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
113int Vcubrakereport47::vcu_real_brake(const std::uint8_t* bytes,
114 int32_t length) const {
115 Byte t0(bytes + 1);
116 int32_t x = t0.get_byte(0, 8);
117
118 int ret = x;
119 return ret;
120}
121
122// config detail: {'description':
123// '0x0:EPB_Released;0x1:EPB_Applied;0x2:EPB_Releasing;0x3:EPB_Fault;0x4:EPB_Applying',
124// 'offset': 0.0, 'precision': 1.0, 'len': 3, 'name': 'vcu_real_parking_status',
125// 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 18, 'type': 'int',
126// 'order': 'motorola', 'physical_unit': ''}
127int Vcubrakereport47::vcu_real_parking_status(const std::uint8_t* bytes,
128 int32_t length) const {
129 Byte t0(bytes + 2);
130 int32_t x = t0.get_byte(0, 3);
131
132 int ret = x;
133 return ret;
134}
135
136// config detail: {'description': '0x0:disable;0x1:enable', 'offset': 0.0,
137// 'precision': 1.0, 'len': 1, 'name': 'vcu_real_parking_valid',
138// 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 19, 'type': 'bool',
139// 'order': 'motorola', 'physical_unit': ''}
140bool Vcubrakereport47::vcu_real_parking_valid(const std::uint8_t* bytes,
141 int32_t length) const {
142 Byte t0(bytes + 2);
143 int32_t x = t0.get_byte(3, 1);
144
145 bool ret = x;
146 return ret;
147}
148
149// config detail: {'description': '0x0:off;0x1:on', 'offset': 0.0,
150// 'precision': 1.0, 'len': 1, 'name': 'rampauxiliaryindication',
151// 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 20, 'type': 'bool',
152// 'order': 'motorola', 'physical_unit': ''}
153bool Vcubrakereport47::rampauxiliaryindication(const std::uint8_t* bytes,
154 int32_t length) const {
155 Byte t0(bytes + 2);
156 int32_t x = t0.get_byte(4, 1);
157
158 bool ret = x;
159 return ret;
160}
161
162// config detail: {'name': 'vehicleslope', 'offset': 0.0, 'precision':
163// 0.1758125, 'len': 8, 'is_signed_var': False, 'physical_range': '[0|45]',
164// 'bit': 31, 'type': 'double', 'order': 'motorola', 'physical_unit':
165// '\xc2\xb0'}
166double Vcubrakereport47::vehicleslope(const std::uint8_t* bytes,
167 int32_t length) const {
168 Byte t0(bytes + 3);
169 int32_t x = t0.get_byte(0, 8);
170
171 double ret = x * 0.175813;
172 return ret;
173}
174
175// config detail: {'bit': 32, 'description': 'the vcu brake was caused reason',
176// 'enum': {0: 'VCU_EHB_NORMAL_BRAKE', 1: 'VCU_EHB_BACKUP_REMOTE_BRAKE',
177// 2: 'VCU_EHB_EMERGENCY_BUTTON_BRAKE', 3: 'VCU_EHB_ULTR_BRAKE', 4:
178// 'VCU_EHB_BUMPER_BRAKE'}, 'is_signed_var': False, 'len': 3, 'name':
179// 'vcu_ehb_brake_state', 'offset': 0.0, 'order': 'motorola', 'physical_range':
180// '[0|4]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
181Vcu_brake_report_47::Vcu_ehb_brakeType Vcubrakereport47::vcu_ehb_brake_state(
182 const std::uint8_t* bytes, int32_t length) const {
183 Byte t0(bytes + 4);
184 int32_t x = t0.get_byte(0, 3);
185
188 return ret;
189}
190
191// config detail: {'name': 'vcu_brakerept_alivecounter', 'offset': 0.0,
192// 'precision': 1.0, 'len': 4, 'is_signed_var': False, 'physical_range':
193// '[0|0]', 'bit': 51, 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
194int Vcubrakereport47::vcu_brakerept_alivecounter(const std::uint8_t* bytes,
195 int32_t length) const {
196 Byte t0(bytes + 6);
197 int32_t x = t0.get_byte(0, 4);
198
199 int ret = x;
200 return ret;
201}
202
203// config detail: {'name': 'vcu_brakerept_checksum', 'offset': 0.0,
204// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'physical_range':
205// '[0|0]', 'bit': 63, 'type': 'int', 'order': 'motorola', 'physical_unit': ''}
206int Vcubrakereport47::vcu_brakerept_checksum(const std::uint8_t* bytes,
207 int32_t length) const {
208 Byte t0(bytes + 7);
209 int32_t x = t0.get_byte(0, 8);
210
211 int ret = x;
212 return ret;
213}
214} // namespace neolix_edu
215} // namespace canbus
216} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Neolix_edu *chassis) const override
class register implement
Definition arena_queue.h:37