Apollo 11.0
自动驾驶开放平台
wheelspeed_report_51e.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 ch {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Wheelspeedreport51e::ID = 0x51E;
32
33void Wheelspeedreport51e::Parse(const std::uint8_t* bytes, int32_t length,
34 Ch* chassis) const {
35 chassis->mutable_wheelspeed_report_51e()->set_rr(
36 rr(bytes, length));
37 chassis->mutable_wheelspeed_report_51e()->set_rl(
38 rl(bytes, length));
39 chassis->mutable_wheelspeed_report_51e()->set_fr(
40 fr(bytes, length));
41 chassis->mutable_wheelspeed_report_51e()->set_fl(
42 fl(bytes, length));
43}
44
45// config detail: {'bit': 48, 'description': 'wheel speed rear right',
46// 'is_signed_var': True, 'len': 16, 'name': 'rr', 'offset': 0.0, 'order':
47// 'intel', 'physical_range': '[-327.68|327.67]', 'physical_unit': 'm/s',
48// 'precision': 0.01, 'type': 'double'}
49double Wheelspeedreport51e::rr(const std::uint8_t* bytes,
50 int32_t length) const {
51 Byte t0(bytes + 7);
52 int32_t x = t0.get_byte(0, 8);
53
54 Byte t1(bytes + 6);
55 int32_t t = t1.get_byte(0, 8);
56 x <<= 8;
57 x |= t;
58
59 x <<= 16;
60 x >>= 16;
61
62 double ret = x * 0.010000;
63 return ret;
64}
65
66// config detail: {'bit': 32, 'description': 'wheel speed rear left',
67// 'is_signed_var': True, 'len': 16, 'name': 'rl', 'offset': 0.0, 'order':
68// 'intel', 'physical_range': '[-327.68|327.67]', 'physical_unit': 'm/s',
69// 'precision': 0.01, 'type': 'double'}
70double Wheelspeedreport51e::rl(const std::uint8_t* bytes,
71 int32_t length) const {
72 Byte t0(bytes + 5);
73 int32_t x = t0.get_byte(0, 8);
74
75 Byte t1(bytes + 4);
76 int32_t t = t1.get_byte(0, 8);
77 x <<= 8;
78 x |= t;
79
80 x <<= 16;
81 x >>= 16;
82
83 double ret = x * 0.010000;
84 return ret;
85}
86
87// config detail: {'bit': 16, 'description': 'wheel speed front right',
88// 'is_signed_var': True, 'len': 16, 'name': 'fr', 'offset': 0.0, 'order':
89// 'intel', 'physical_range': '[-327.68|327.67]', 'physical_unit': 'm/s',
90// 'precision': 0.01, 'type': 'double'}
91double Wheelspeedreport51e::fr(const std::uint8_t* bytes,
92 int32_t length) const {
93 Byte t0(bytes + 3);
94 int32_t x = t0.get_byte(0, 8);
95
96 Byte t1(bytes + 2);
97 int32_t t = t1.get_byte(0, 8);
98 x <<= 8;
99 x |= t;
100
101 x <<= 16;
102 x >>= 16;
103
104 double ret = x * 0.010000;
105 return ret;
106}
107
108// config detail: {'bit': 0, 'description': 'wheel speed front left',
109// 'is_signed_var': True, 'len': 16, 'name': 'fl', 'offset': 0.0, 'order':
110// 'intel', 'physical_range': '[-327.68|327.67]', 'physical_unit': 'm/s',
111// 'precision': 0.01, 'type': 'double'}
112double Wheelspeedreport51e::fl(const std::uint8_t* bytes,
113 int32_t length) const {
114 Byte t0(bytes + 1);
115 int32_t x = t0.get_byte(0, 8);
116
117 Byte t1(bytes + 0);
118 int32_t t = t1.get_byte(0, 8);
119 x <<= 8;
120 x |= t;
121
122 x <<= 16;
123 x >>= 16;
124
125 double ret = x * 0.010000;
126 return ret;
127}
128} // namespace ch
129} // namespace canbus
130} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Ch *chassis) const override
class register implement
Definition arena_queue.h:37