Apollo 10.0
自动驾驶开放平台
vcu_report_505.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 devkit {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Vcureport505::ID = 0x505;
32
33void Vcureport505::Parse(const std::uint8_t* bytes, int32_t length,
34 Devkit* chassis) const {
35 chassis->mutable_vcu_report_505()->set_steer_mode_sts(
36 steer_mode_sts(bytes, length));
37 chassis->mutable_vcu_report_505()->set_brake_light_actual(
38 brake_light_actual(bytes, length));
39 chassis->mutable_vcu_report_505()->set_acc(
40 acc(bytes, length));
41 chassis->mutable_vcu_report_505()->set_speed(
42 speed(bytes, length));
43 chassis->mutable_vcu_report_505()->set_aeb_brake_state(
44 aeb_brake_state(bytes, length));
45 chassis->mutable_vcu_report_505()->set_frontcrash_state(
46 frontcrash_state(bytes, length));
47 chassis->mutable_vcu_report_505()->set_backcrash_state(
48 backcrash_state(bytes, length));
49 chassis->mutable_vcu_report_505()->set_vehicle_mode_state(
50 vehicle_mode_state(bytes, length));
51 chassis->mutable_vcu_report_505()->set_drive_mode_sts(
52 drive_mode_sts(bytes, length));
53 chassis->mutable_vcu_report_505()->set_chassis_errcode(
54 chassis_errcode(bytes, length));
55 chassis->mutable_vcu_report_505()->set_turn_light_actual(
56 turn_light_actual(bytes, length));
57 chassis->mutable_vcu_report_505()->set_aeb_mode(
58 aeb_mode(bytes, length));
59}
60
61// config detail: {'bit': 10, 'enum': {0: 'STEER_MODE_STS_STANDARD_STEER_MODE',
62// 1: 'STEER_MODE_STS_NON_DIRECTION_STEER_MODE', 2:
63// 'STEER_MODE_STS_SYNC_DIRECTION_STEER_MODE'}, 'is_signed_var': False, 'len':
64// 3, 'name': 'steer_mode_sts', 'offset': 0.0, 'order': 'motorola',
65// 'physical_range': '[0|7]', 'physical_unit': '', 'precision': 1.0, 'type':
66// 'enum'}
67Vcu_report_505::Steer_mode_stsType Vcureport505::steer_mode_sts(
68 const std::uint8_t* bytes, int32_t length) const {
69 Byte t0(bytes + 1);
70 int32_t x = t0.get_byte(0, 3);
71
74 return ret;
75}
76
77// config detail: {'bit': 11, 'enum': {0: 'BRAKE_LIGHT_ACTUAL_BRAKELIGHT_OFF',
78// 1: 'BRAKE_LIGHT_ACTUAL_BRAKELIGHT_ON'}, 'is_signed_var': False, 'len': 1,
79// 'name': 'brake_light_actual', 'offset': 0.0, 'order': 'motorola',
80// 'physical_range': '[0|1]', 'physical_unit': '', 'precision': 1.0, 'type':
81// 'enum'}
82Vcu_report_505::Brake_light_actualType Vcureport505::brake_light_actual(
83 const std::uint8_t* bytes, int32_t length) const {
84 Byte t0(bytes + 1);
85 int32_t x = t0.get_byte(3, 1);
86
89 return ret;
90}
91
92// config detail: {'bit': 7, 'is_signed_var': True, 'len': 12, 'name': 'acc',
93// 'offset': 0.0, 'order': 'motorola', 'physical_range': '[-10|10]',
94// 'physical_unit': 'm/s^2', 'precision': 0.01, 'type': 'double'}
95double Vcureport505::acc(const std::uint8_t* bytes, int32_t length) const {
96 Byte t0(bytes + 0);
97 int32_t x = t0.get_byte(0, 8);
98
99 Byte t1(bytes + 1);
100 int32_t t = t1.get_byte(4, 4);
101 x <<= 4;
102 x |= t;
103
104 x <<= 20;
105 x >>= 20;
106
107 double ret = x * 0.010000;
108 return ret;
109}
110
111// config detail: {'bit': 23, 'is_signed_var': True, 'len': 16, 'name': 'speed',
112// 'offset': 0.0, 'order': 'motorola', 'physical_range': '[-32.768|32.767]',
113// 'physical_unit': 'm/s', 'precision': 0.001, 'type': 'double'}
114double Vcureport505::speed(const std::uint8_t* bytes, int32_t length) const {
115 Byte t0(bytes + 2);
116 int32_t x = t0.get_byte(0, 8);
117
118 Byte t1(bytes + 3);
119 int32_t t = t1.get_byte(0, 8);
120 x <<= 8;
121 x |= t;
122
123 x <<= 16;
124 x >>= 16;
125
126 double ret = x * 0.001000;
127 return ret;
128}
129
130// config detail: {'bit': 32, 'description': 'describle the vehicle AEB mode
131// whether was set', 'enum': {0: 'AEB_BRAKE_STATE_INACTIVE', 1:
132// 'AEB_BRAKE_STATE_ACTIVE'}, 'is_signed_var': False, 'len': 1, 'name':
133// 'aeb_brake_state', 'offset': 0.0, 'order': 'motorola', 'physical_range':
134// '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
135Vcu_report_505::Aeb_brake_stateType Vcureport505::aeb_brake_state(
136 const std::uint8_t* bytes, int32_t length) const {
137 Byte t0(bytes + 4);
138 int32_t x = t0.get_byte(0, 1);
139
142 return ret;
143}
144
145// config detail: {'bit': 33, 'enum': {0: 'FRONTCRASH_STATE_NO_EVENT', 1:
146// 'FRONTCRASH_STATE_CRASH_EVENT'}, 'is_signed_var': False, 'len': 1, 'name':
147// 'frontcrash_state', 'offset': 0.0, 'order': 'motorola', 'physical_range':
148// '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
149Vcu_report_505::Frontcrash_stateType Vcureport505::frontcrash_state(
150 const std::uint8_t* bytes, int32_t length) const {
151 Byte t0(bytes + 4);
152 int32_t x = t0.get_byte(1, 1);
153
156 return ret;
157}
158
159// config detail: {'bit': 34, 'enum': {0: 'BACKCRASH_STATE_NO_EVENT', 1:
160// 'BACKCRASH_STATE_CRASH_EVENT'}, 'is_signed_var': False, 'len': 1, 'name':
161// 'backcrash_state', 'offset': 0.0, 'order': 'motorola', 'physical_range':
162// '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
163Vcu_report_505::Backcrash_stateType Vcureport505::backcrash_state(
164 const std::uint8_t* bytes, int32_t length) const {
165 Byte t0(bytes + 4);
166 int32_t x = t0.get_byte(2, 1);
167
170 return ret;
171}
172
173// config detail: {'bit': 36, 'enum': {0:
174// 'VEHICLE_MODE_STATE_MANUAL_REMOTE_MODE', 1: 'VEHICLE_MODE_STATE_AUTO_MODE',
175// 2: 'VEHICLE_MODE_STATE_EMERGENCY_MODE', 3:
176// 'VEHICLE_MODE_STATE_STANDBY_MODE'}, 'is_signed_var': False, 'len': 2, 'name':
177// 'vehicle_mode_state', 'offset': 0.0, 'order': 'motorola', 'physical_range':
178// '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
179Vcu_report_505::Vehicle_mode_stateType Vcureport505::vehicle_mode_state(
180 const std::uint8_t* bytes, int32_t length) const {
181 Byte t0(bytes + 4);
182 int32_t x = t0.get_byte(3, 2);
183
186 return ret;
187}
188
189// config detail: {'bit': 39, 'enum': {0:
190// 'DRIVE_MODE_STS_THROTTLE_PADDLE_DRIVE_MODE', 1:
191// 'DRIVE_MODE_STS_SPEED_DRIVE_MODE'}, 'is_signed_var': False, 'len': 3, 'name':
192// 'drive_mode_sts', 'offset': 0.0, 'order': 'motorola', 'physical_range':
193// '[0|7]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
194Vcu_report_505::Drive_mode_stsType Vcureport505::drive_mode_sts(
195 const std::uint8_t* bytes, int32_t length) const {
196 Byte t0(bytes + 4);
197 int32_t x = t0.get_byte(5, 3);
198
201 return ret;
202}
203
204// config detail: {'bit': 47, 'is_signed_var': False, 'len': 8, 'name':
205// 'chassis_errcode', 'offset': 0.0, 'order': 'motorola', 'physical_range':
206// '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
207int Vcureport505::chassis_errcode(const std::uint8_t* bytes,
208 int32_t length) const {
209 Byte t0(bytes + 5);
210 int32_t x = t0.get_byte(0, 8);
211
212 int ret = x;
213 return ret;
214}
215
216// config detail: {'bit': 57, 'enum': {0: 'TURN_LIGHT_ACTUAL_TURNLAMPSTS_OFF',
217// 1: 'TURN_LIGHT_ACTUAL_LEFT_TURNLAMPSTS_ON', 2:
218// 'TURN_LIGHT_ACTUAL_RIGHT_TURNLAMPSTS_ON', 3:
219// 'TURN_LIGHT_ACTUAL_HAZARD_WARNING_LAMPSTS_ON'}, 'is_signed_var': False,
220// 'len': 2, 'name': 'turn_light_actual', 'offset': 0.0, 'order': 'motorola',
221// 'physical_range': '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type':
222// 'enum'}
223Vcu_report_505::Turn_light_actualType Vcureport505::turn_light_actual(
224 const std::uint8_t* bytes, int32_t length) const {
225 Byte t0(bytes + 7);
226 int32_t x = t0.get_byte(0, 2);
227
230 return ret;
231}
232
233// config detail: {'bit': 58, 'description': 'describe the vehicle e-brake
234// command whether was triggered by AEB', 'enum': {0: 'AEB_MODE_DISABLE', 1:
235// 'AEB_MODE_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name': 'aeb_mode',
236// 'offset': 0.0, 'order': 'motorola', 'physical_range': '[0|1]',
237// 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
238Vcu_report_505::Aeb_modeType Vcureport505::aeb_mode(const std::uint8_t* bytes,
239 int32_t length) const {
240 Byte t0(bytes + 7);
241 int32_t x = t0.get_byte(2, 1);
242
244 static_cast<Vcu_report_505::Aeb_modeType>(x);
245 return ret;
246}
247} // namespace devkit
248} // namespace canbus
249} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Devkit *chassis) const override
class register implement
Definition arena_queue.h:37