Apollo 10.0
自动驾驶开放平台
fbs3_237.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
19#include "glog/logging.h"
20
23
24namespace apollo {
25namespace canbus {
26namespace wey {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Fbs3237::ID = 0x237;
32
33void Fbs3237::Parse(const std::uint8_t* bytes, int32_t length,
34 Wey* chassis) const {
35 chassis->mutable_fbs3_237()->set_engspd(engspd(bytes, length));
36 chassis->mutable_fbs3_237()->set_accpedalpos(
37 accpedalpos(bytes, length));
38 chassis->mutable_fbs3_237()->set_epbswtichposition(
39 epbswtichposition(bytes, length));
40 chassis->mutable_fbs3_237()->set_currentgear(
41 currentgear(bytes, length));
42 chassis->mutable_fbs3_237()->set_eps_streeingmode(
43 eps_streeingmode(bytes, length));
44 chassis->mutable_fbs3_237()->set_epsdrvinputtrqvalue(
45 epsdrvinputtrqvalue(bytes, length));
46 chassis->mutable_fbs3_237()->set_epsconsumedcurrvalue(
47 epsconsumedcurrvalue(bytes, length));
48 chassis->mutable_fbs3_237()->set_epscurrmod(
49 epscurrmod(bytes, length));
50}
51
52// config detail: {'description': 'Engine speed', 'offset': 0.0,
53// 'precision': 0.125, 'len': 16, 'name': 'engspd', 'is_signed_var': False,
54// 'physical_range': '[0|8198.875]', 'bit': 7, 'type': 'double',
55// 'order': 'motorola', 'physical_unit': 'rpm'}
56double Fbs3237::engspd(const std::uint8_t* bytes, int32_t length) const {
57 Byte t0(bytes + 0);
58 int32_t x = t0.get_byte(0, 8);
59
60 Byte t1(bytes + 1);
61 int32_t t = t1.get_byte(0, 8);
62 x <<= 8;
63 x |= t;
64
65 double ret = x * 0.125000;
66 return ret;
67}
68
69// config detail: {'description': 'Acceleration Pedal Position', 'offset': 0.0,
70// 'precision': 0.3937, 'len': 8, 'name': 'accpedalpos', 'is_signed_var':False,
71// 'physical_range': '[0|100.3935]', 'bit': 23, 'type': 'double',
72// 'order': 'motorola', 'physical_unit': '%'}
73double Fbs3237::accpedalpos(const std::uint8_t* bytes, int32_t length) const {
74 Byte t0(bytes + 2);
75 int32_t x = t0.get_byte(0, 8);
76
77 double ret = x * 0.393700;
78 return ret;
79}
80
81// config detail: {'description': 'EPB Switch position information', 'enum':
82// {0: 'EPBSWTICHPOSITION_NEUTRAL', 1: 'EPBSWTICHPOSITION_RELEASE',
83// 2: 'EPBSWTICHPOSITION_APPLY', 3: 'EPBSWTICHPOSITION_RESERVED1'},
84// 'precision': 1.0, 'len': 2, 'name': 'epbswtichposition', 'is_signed_var':
85// False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 31, 'type':
86// 'enum', 'order': 'motorola', 'physical_unit': ''}
87Fbs3_237::EpbswtichpositionType Fbs3237::epbswtichposition(
88 const std::uint8_t* bytes, int32_t length) const {
89 Byte t0(bytes + 3);
90 int32_t x = t0.get_byte(6, 2);
91
93 static_cast<Fbs3_237::EpbswtichpositionType>(x);
94 return ret;
95}
96
97// config detail: {'description': 'To indicate which gear the DCT is in now ',
98// 'enum': {0: 'CURRENTGEAR_P', 1: 'CURRENTGEAR_R', 2: 'CURRENTGEAR_N',
99// 3: 'CURRENTGEAR_D'}, 'precision': 1.0, 'len': 2, 'name': 'currentgear',
100// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 39,
101// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
102Fbs3_237::CurrentgearType Fbs3237::currentgear(const std::uint8_t* bytes,
103 int32_t length) const {
104 Byte t0(bytes + 4);
105 int32_t x = t0.get_byte(6, 2);
106
108 return ret;
109}
110
111// config detail: {'description': 'Driver Steering Interference Detected',
112// 'enum': {0: 'EPS_STREEINGMODE_MANUAL', 1:'EPS_STREEINGMODE_AUTOMATIC_AVAIL',
113// 2: 'EPS_STREEINGMODE_MANUAL_FROM_DRVNTERFERENCE',
114// 3: 'EPS_STREEINGMODE_MANUAL_FROM_EPS_FAILED_DETECTED',
115// 4: 'EPS_STREEINGMODE_TEMPORARY_INHIBITED', 5: 'EPS_STREEINGMODE_RESERVED1',
116// 6: 'EPS_STREEINGMODE_RESERVED2', 7: 'EPS_STREEINGMODE_RESERVED3'},
117// 'precision': 1.0, 'len': 3, 'name':'eps_streeingmode','is_signed_var':False,
118// 'offset': 0.0, 'physical_range': '[0|7]', 'bit': 34, 'type': 'enum',
119// 'order': 'motorola', 'physical_unit': ''}
120Fbs3_237::Eps_streeingmodeType Fbs3237::eps_streeingmode(
121 const std::uint8_t* bytes, int32_t length) const {
122 Byte t0(bytes + 4);
123 int32_t x = t0.get_byte(0, 3);
124
126 static_cast<Fbs3_237::Eps_streeingmodeType>(x);
127 return ret;
128}
129
130// config detail: {'description': 'Value of driver input torque',
131// 'offset': -22.78,'precision': 0.1794,'len': 8, 'name':'epsdrvinputtrqvalue',
132// 'is_signed_var': False, 'physical_range': '[-22.78|22.96]', 'bit': 47,
133// 'type': 'double', 'order': 'motorola', 'physical_unit': 'Nm'}
134double Fbs3237::epsdrvinputtrqvalue(const std::uint8_t* bytes,
135 int32_t length) const {
136 Byte t0(bytes + 5);
137 int32_t x = t0.get_byte(0, 8);
138
139 double ret = x * 0.179400 + -22.780000;
140 return ret;
141}
142
143// config detail: {'description': 'Value of consumed current by EPS',
144// 'offset': 0.0, 'precision': 0.5, 'len': 8, 'name': 'epsconsumedcurrvalue',
145// 'is_signed_var': False, 'physical_range': '[127|127]', 'bit': 55,
146// 'type': 'double', 'order': 'motorola', 'physical_unit': 'A'}
147double Fbs3237::epsconsumedcurrvalue(const std::uint8_t* bytes,
148 int32_t length) const {
149 Byte t0(bytes + 6);
150 int32_t x = t0.get_byte(0, 8);
151
152 double ret = x * 0.500000;
153 return ret;
154}
155
156// config detail: {'description': 'Applied steering mode currently', 'enum':
157// {0: 'EPSCURRMOD_NORMAL_MODE', 1: 'EPSCURRMOD_SPORT_MODE',
158// 2: 'EPSCURRMOD_COMFORT_MODE', 3: 'EPSCURRMOD_MODESELECTIONNOTPOSSIBLE',
159// 4: 'EPSCURRMOD_NO_DISPLAY', 5: 'EPSCURRMOD_CONDITIONNOTMEET',
160// 6: 'EPSCURRMOD_RESERVED1'}, 'precision': 1.0, 'len': 3, 'name':'epscurrmod',
161// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|7]', 'bit': 61,
162// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
163Fbs3_237::EpscurrmodType Fbs3237::epscurrmod(const std::uint8_t* bytes,
164 int32_t length) const {
165 Byte t0(bytes + 7);
166 int32_t x = t0.get_byte(3, 3);
167
169 return ret;
170}
171} // namespace wey
172} // namespace canbus
173} // namespace apollo
Defines the Byte class.
static const int32_t ID
Definition fbs3_237.h:29
void Parse(const std::uint8_t *bytes, int32_t length, Wey *chassis) const override
Definition fbs3_237.cc:33
class register implement
Definition arena_queue.h:37