Apollo 10.0
自动驾驶开放平台
llc_motionfeedback1_20.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 transit {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Llcmotionfeedback120::ID = 0x20;
32
33void Llcmotionfeedback120::Parse(const std::uint8_t* bytes, int32_t length,
34 Transit* chassis) const {
35 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_gear(
36 llc_fbk_gear(bytes, length));
37 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_parkingbrake(
38 llc_fbk_parkingbrake(bytes, length));
39 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_throttleposition(
40 llc_fbk_throttleposition(bytes, length));
41 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_brakepercentrear(
42 llc_fbk_brakepercentrear(bytes, length));
43 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_brakepercentfront(
44 llc_fbk_brakepercentfront(bytes, length));
45 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_steeringcontrolmode(
46 llc_fbk_steeringcontrolmode(bytes, length));
47 chassis->mutable_llc_motionfeedback1_20()->set_llc_motionfeedback1_counter(
48 llc_motionfeedback1_counter(bytes, length));
49 chassis->mutable_llc_motionfeedback1_20()->set_llc_motionfeedback1_checksum(
50 llc_motionfeedback1_checksum(bytes, length));
51 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_commandaligned(
52 llc_fbk_commandaligned(bytes, length));
53 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_estoppressed(
54 llc_fbk_estoppressed(bytes, length));
55 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_adcrequestautonomy(
56 llc_fbk_adcrequestautonomy(bytes, length));
57 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_allowautonomy(
58 llc_fbk_allowautonomy(bytes, length));
59 chassis->mutable_llc_motionfeedback1_20()
60 ->set_llc_fbk_longitudinalcontrolmode(
61 llc_fbk_longitudinalcontrolmode(bytes, length));
62 chassis->mutable_llc_motionfeedback1_20()->set_llc_fbk_state(
63 llc_fbk_state(bytes, length));
64}
65
66// config detail: {'description': 'Current gear', 'enum': {0:
67// 'LLC_FBK_GEAR_P_PARK', 1: 'LLC_FBK_GEAR_D_DRIVE', 2:
68// 'LLC_FBK_GEAR_N_NEUTRAL', 3: 'LLC_FBK_GEAR_R_REVERSE'}, 'precision': 1.0,
69// 'len': 3, 'name': 'llc_fbk_gear', 'is_signed_var': False, 'offset': 0.0,
70// 'physical_range': '[0|3]', 'bit': 50, 'type': 'enum', 'order': 'intel',
71// 'physical_unit': ''}
72Llc_motionfeedback1_20::Llc_fbk_gearType Llcmotionfeedback120::llc_fbk_gear(
73 const std::uint8_t* bytes, int32_t length) const {
74 Byte t0(bytes + 6);
75 int32_t x = t0.get_byte(2, 3);
76
79 return ret;
80}
81
82// config detail: {'description': 'Parking brake applied', 'offset': 0.0,
83// 'precision': 1.0, 'len': 1, 'name': 'llc_fbk_parkingbrake', 'is_signed_var':
84// False, 'physical_range': '[0|1]', 'bit': 53, 'type': 'bool', 'order':
85// 'intel', 'physical_unit': 'T/F'}
86bool Llcmotionfeedback120::llc_fbk_parkingbrake(const std::uint8_t* bytes,
87 int32_t length) const {
88 Byte t0(bytes + 6);
89 int32_t x = t0.get_byte(5, 1);
90
91 bool ret = x;
92 return ret;
93}
94
95// config detail: {'description': 'Throttle position feedback', 'offset': 0.0,
96// 'precision': 0.1, 'len': 10, 'name': 'llc_fbk_throttleposition',
97// 'is_signed_var': False, 'physical_range': '[0|102.3]', 'bit': 38, 'type':
98// 'double', 'order': 'intel', 'physical_unit': '%'}
99double Llcmotionfeedback120::llc_fbk_throttleposition(const std::uint8_t* bytes,
100 int32_t length) const {
101 Byte t0(bytes + 5);
102 int32_t x = t0.get_byte(0, 8);
103
104 Byte t1(bytes + 4);
105 int32_t t = t1.get_byte(6, 2);
106 x <<= 2;
107 x |= t;
108
109 double ret = x * 0.100000;
110 return ret;
111}
112
113// config detail: {'description': 'Rear brake pressure feedback', 'offset': 0.0,
114// 'precision': 0.0556, 'len': 11, 'name': 'llc_fbk_brakepercentrear',
115// 'is_signed_var': False, 'physical_range': '[0|113.8132]', 'bit': 27, 'type':
116// 'double', 'order': 'intel', 'physical_unit': '%'}
117double Llcmotionfeedback120::llc_fbk_brakepercentrear(const std::uint8_t* bytes,
118 int32_t length) const {
119 Byte t0(bytes + 4);
120 int32_t x = t0.get_byte(0, 6);
121
122 Byte t1(bytes + 3);
123 int32_t t = t1.get_byte(3, 5);
124 x <<= 5;
125 x |= t;
126
127 double ret = x * 0.055600;
128 return ret;
129}
130
131// config detail: {'description': 'Front brake pressure feedback', 'offset':
132// 0.0, 'precision': 0.0556, 'len': 11, 'name': 'llc_fbk_brakepercentfront',
133// 'is_signed_var': False, 'physical_range': '[0|113.8132]', 'bit': 16, 'type':
134// 'double', 'order': 'intel', 'physical_unit': '%'}
135double Llcmotionfeedback120::llc_fbk_brakepercentfront(
136 const std::uint8_t* bytes, int32_t length) const {
137 Byte t0(bytes + 3);
138 int32_t x = t0.get_byte(0, 3);
139
140 Byte t1(bytes + 2);
141 int32_t t = t1.get_byte(0, 8);
142 x <<= 8;
143 x |= t;
144
145 double ret = x * 0.055600;
146 return ret;
147}
148
149// config detail: {'description': 'Current steering control mode', 'enum': {0:
150// 'LLC_FBK_STEERINGCONTROLMODE_NONE', 1: 'LLC_FBK_STEERINGCONTROLMODE_ANGLE',
151// 2: 'LLC_FBK_STEERINGCONTROLMODE_RESERVED_CURVATURE', 3:
152// 'LLC_FBK_STEERINGCONTROLMODE_RESERVED'}, 'precision': 1.0, 'len': 2, 'name':
153// 'llc_fbk_steeringcontrolmode', 'is_signed_var': False, 'offset': 0.0,
154// 'physical_range': '[0|3]', 'bit': 6, 'type': 'enum', 'order': 'intel',
155// 'physical_unit': ''}
157Llcmotionfeedback120::llc_fbk_steeringcontrolmode(const std::uint8_t* bytes,
158 int32_t length) const {
159 Byte t0(bytes + 0);
160 int32_t x = t0.get_byte(6, 2);
161
164 return ret;
165}
166
167// config detail: {'description': 'Motion feedback 1 heartbeat counter',
168// 'offset': 0.0, 'precision': 1.0, 'len': 2, 'name':
169// 'llc_motionfeedback1_counter', 'is_signed_var': False, 'physical_range':
170// '[0|3]', 'bit': 54, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
171int Llcmotionfeedback120::llc_motionfeedback1_counter(const std::uint8_t* bytes,
172 int32_t length) const {
173 Byte t0(bytes + 6);
174 int32_t x = t0.get_byte(6, 2);
175
176 int ret = x;
177 return ret;
178}
179
180// config detail: {'description': 'Motion feedback 1 checksum', 'offset': 0.0,
181// 'precision': 1.0, 'len': 8, 'name': 'llc_motionfeedback1_checksum',
182// 'is_signed_var': False, 'physical_range': '[0|255]', 'bit': 56, 'type':
183// 'int', 'order': 'intel', 'physical_unit': ''}
184int Llcmotionfeedback120::llc_motionfeedback1_checksum(
185 const std::uint8_t* bytes, int32_t length) const {
186 Byte t0(bytes + 7);
187 int32_t x = t0.get_byte(0, 8);
188
189 int ret = x;
190 return ret;
191}
192
193// config detail: {'description': 'Autonomy command aligned with vehicle state
194// according to calibration limits', 'offset': 0.0, 'precision': 1.0, 'len': 1,
195// 'name': 'llc_fbk_commandaligned', 'is_signed_var': False, 'physical_range':
196// '[0|1]', 'bit': 11, 'type': 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
197bool Llcmotionfeedback120::llc_fbk_commandaligned(const std::uint8_t* bytes,
198 int32_t length) const {
199 Byte t0(bytes + 1);
200 int32_t x = t0.get_byte(3, 1);
201
202 bool ret = x;
203 return ret;
204}
205
206// config detail: {'description': 'Estop is pressed', 'offset': 0.0,
207// 'precision': 1.0, 'len': 1, 'name': 'llc_fbk_estoppressed', 'is_signed_var':
208// False, 'physical_range': '[0|1]', 'bit': 10, 'type': 'bool', 'order':
209// 'intel', 'physical_unit': 'T/F'}
210bool Llcmotionfeedback120::llc_fbk_estoppressed(const std::uint8_t* bytes,
211 int32_t length) const {
212 Byte t0(bytes + 1);
213 int32_t x = t0.get_byte(2, 1);
214
215 bool ret = x;
216 return ret;
217}
218
219// config detail: {'description': 'Indicates that ADC is requesting autonomy
220// mode', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name':
221// 'llc_fbk_adcrequestautonomy', 'is_signed_var': False, 'physical_range':
222// '[0|1]', 'bit': 9, 'type': 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
223bool Llcmotionfeedback120::llc_fbk_adcrequestautonomy(const std::uint8_t* bytes,
224 int32_t length) const {
225 Byte t0(bytes + 1);
226 int32_t x = t0.get_byte(1, 1);
227
228 bool ret = x;
229 return ret;
230}
231
232// config detail: {'description': 'Indicates that LLC is ready to allow autonomy
233// mode', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name':
234// 'llc_fbk_allowautonomy', 'is_signed_var': False, 'physical_range': '[0|1]',
235// 'bit': 8, 'type': 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
236bool Llcmotionfeedback120::llc_fbk_allowautonomy(const std::uint8_t* bytes,
237 int32_t length) const {
238 Byte t0(bytes + 1);
239 int32_t x = t0.get_byte(0, 1);
240
241 bool ret = x;
242 return ret;
243}
244
245// config detail: {'description': 'Report current longitudinal control mode',
246// 'enum': {0: 'LLC_FBK_LONGITUDINALCONTROLMODE_NONE', 1:
247// 'LLC_FBK_LONGITUDINALCONTROLMODE_RESERVED_VELOCITY_AND_ACCELERATION', 2:
248// 'LLC_FBK_LONGITUDINALCONTROLMODE_RESERVED_FORCE', 3:
249// 'LLC_FBK_LONGITUDINALCONTROLMODE_DIRECT_THROTTLE_BRAKE'}, 'precision': 1.0,
250// 'len': 2, 'name': 'llc_fbk_longitudinalcontrolmode', 'is_signed_var': False,
251// 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 4, 'type': 'enum', 'order':
252// 'intel', 'physical_unit': ''}
254Llcmotionfeedback120::llc_fbk_longitudinalcontrolmode(const std::uint8_t* bytes,
255 int32_t length) const {
256 Byte t0(bytes + 0);
257 int32_t x = t0.get_byte(4, 2);
258
261 x);
262 return ret;
263}
264
265// config detail: {'description': 'Current Autonomy State', 'enum': {0:
266// 'LLC_FBK_STATE_RESERVED0', 1: 'LLC_FBK_STATE_AUTONOMY_NOT_ALLOWED', 2:
267// 'LLC_FBK_STATE_AUTONOMY_ALLOWED', 3: 'LLC_FBK_STATE_AUTONOMY_REQUESTED', 4:
268// 'LLC_FBK_STATE_AUTONOMY', 5: 'LLC_FBK_STATE_RESERVED1', 6:
269// 'LLC_FBK_STATE_RESERVED2', 7: 'LLC_FBK_STATE_RESERVED3', 8:
270// 'LLC_FBK_STATE_RESERVED4', 9: 'LLC_FBK_STATE_RESERVED5', 10:
271// 'LLC_FBK_STATE_RESERVED6', 11: 'LLC_FBK_STATE_RESERVED7', 12:
272// 'LLC_FBK_STATE_RESERVED8', 13: 'LLC_FBK_STATE_DISENGAGE_REQUESTED', 14:
273// 'LLC_FBK_STATE_DISENGAGED', 15: 'LLC_FBK_STATE_FAULT'}, 'precision': 1.0,
274// 'len': 4, 'name': 'llc_fbk_state', 'is_signed_var': False, 'offset': 0.0,
275// 'physical_range': '[0|15]', 'bit': 0, 'type': 'enum', 'order': 'intel',
276// 'physical_unit': ''}
277Llc_motionfeedback1_20::Llc_fbk_stateType Llcmotionfeedback120::llc_fbk_state(
278 const std::uint8_t* bytes, int32_t length) const {
279 Byte t0(bytes + 0);
280 int32_t x = t0.get_byte(0, 4);
281
284 return ret;
285}
286} // namespace transit
287} // namespace canbus
288} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Transit *chassis) const override
class register implement
Definition arena_queue.h:37