Apollo 10.0
自动驾驶开放平台
fbs1_243.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 Fbs1243::ID = 0x243;
32
33void Fbs1243::Parse(const std::uint8_t* bytes, int32_t length,
34 Wey* chassis) const {
35 chassis->mutable_fbs1_243()->set_longitudeacce(
36 longitudeacce(bytes, length));
37 chassis->mutable_fbs1_243()->set_lateralacce(
38 lateralacce(bytes, length));
39 chassis->mutable_fbs1_243()->set_vehdynyawrate(
40 vehdynyawrate(bytes, length));
41 chassis->mutable_fbs1_243()->set_flwheelspd(
42 flwheelspd(bytes, length));
43 chassis->mutable_fbs1_243()->set_frwheeldirection(
44 frwheeldirection(bytes, length));
45}
46
47// config detail: {'description': 'Longitude acceleration', 'offset': -21.592,
48// 'precision': 0.00098, 'len': 16, 'name': 'longitudeacce', 'is_signed_var':
49// False, 'physical_range': '[-21.592|21.592]', 'bit': 7, 'type': 'double',
50// 'order': 'motorola', 'physical_unit': 'm/s^2'}
51double Fbs1243::longitudeacce(const std::uint8_t* bytes, int32_t length) const {
52 Byte t0(bytes + 0);
53 int32_t x = t0.get_byte(0, 8);
54
55 Byte t1(bytes + 1);
56 int32_t t = t1.get_byte(0, 8);
57 x <<= 8;
58 x |= t;
59
60 double ret = x * 0.000980 + -21.592000;
61 return ret;
62}
63
64// config detail: {'description': 'Indicates Lateral Acceleration', 'offset':
65// -21.592, 'precision': 0.00098, 'len': 16, 'name': 'lateralacce',
66// 'is_signed_var': False, 'physical_range': '[-21.592|21.592]', 'bit': 23,
67// 'type': 'double', 'order': 'motorola', 'physical_unit': 'm/s^2'}
68double Fbs1243::lateralacce(const std::uint8_t* bytes, int32_t length) const {
69 Byte t0(bytes + 2);
70 int32_t x = t0.get_byte(0, 8);
71
72 Byte t1(bytes + 3);
73 int32_t t = t1.get_byte(0, 8);
74 x <<= 8;
75 x |= t;
76
77 double ret = x * 0.000980 + -21.592000;
78 return ret;
79}
80
81// config detail: {'description': 'Vehicle yaw rate', 'offset': -2.093,
82// 'precision': 0.00024, 'len': 16, 'name': 'vehdynyawrate', 'is_signed_var':
83// False, 'physical_range': '[-2.093|2.093]', 'bit': 39, 'type': 'double',
84// 'order': 'motorola', 'physical_unit': 'rad/s'}
85double Fbs1243::vehdynyawrate(const std::uint8_t* bytes, int32_t length) const {
86 Byte t0(bytes + 4);
87 int32_t x = t0.get_byte(0, 8);
88
89 Byte t1(bytes + 5);
90 int32_t t = t1.get_byte(0, 8);
91 x <<= 8;
92 x |= t;
93
94 double ret = x * 0.000240 + -2.093000;
95 return ret;
96}
97
98// config detail: {'description': 'Front left wheel speed', 'offset': 0.0,
99// 'precision': 0.05625, 'len': 13, 'name': 'flwheelspd', 'is_signed_var':
100// False, 'physical_range': '[0|299.98125]', 'bit': 55, 'type': 'double',
101// 'order': 'motorola', 'physical_unit': 'Km/h'}
102double Fbs1243::flwheelspd(const std::uint8_t* bytes, int32_t length) const {
103 Byte t0(bytes + 6);
104 int32_t x = t0.get_byte(0, 8);
105
106 Byte t1(bytes + 7);
107 int32_t t = t1.get_byte(3, 5);
108 x <<= 5;
109 x |= t;
110
111 double ret = x * 0.056250;
112 return ret;
113}
114
115// config detail: {'description': 'Front right wheel Moving direction',
116// 'enum': {0: 'FRWHEELDIRECTION_INVALID', 1: 'FRWHEELDIRECTION_FORWARD',
117// 2: 'FRWHEELDIRECTION_BACKWARD', 3: 'FRWHEELDIRECTION_STOP'}, 'precision':
118// 1.0, 'len': 2, 'name': 'frwheeldirection', 'is_signed_var': False,
119// 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 57, 'type': 'enum',
120// 'order': 'motorola', 'physical_unit': ''}
121Fbs1_243::FrwheeldirectionType Fbs1243::frwheeldirection(
122 const std::uint8_t* bytes, int32_t length) const {
123 Byte t0(bytes + 7);
124 int32_t x = t0.get_byte(0, 2);
125
127 static_cast<Fbs1_243::FrwheeldirectionType>(x);
128 return ret;
129}
130} // namespace wey
131} // namespace canbus
132} // namespace apollo
Defines the Byte class.
static const int32_t ID
Definition fbs1_243.h:29
void Parse(const std::uint8_t *bytes, int32_t length, Wey *chassis) const override
Definition fbs1_243.cc:33
class register implement
Definition arena_queue.h:37