Apollo 10.0
自动驾驶开放平台
wheel_speed_rpt_7a.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 gem {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Wheelspeedrpt7a::ID = 0x7A;
32
33void Wheelspeedrpt7a::Parse(const std::uint8_t* bytes, int32_t length,
34 Gem* chassis) const {
35 chassis->mutable_wheel_speed_rpt_7a()->set_wheel_spd_rear_right(
36 wheel_spd_rear_right(bytes, length));
37 chassis->mutable_wheel_speed_rpt_7a()->set_wheel_spd_rear_left(
38 wheel_spd_rear_left(bytes, length));
39 chassis->mutable_wheel_speed_rpt_7a()->set_wheel_spd_front_right(
40 wheel_spd_front_right(bytes, length));
41 chassis->mutable_wheel_speed_rpt_7a()->set_wheel_spd_front_left(
42 wheel_spd_front_left(bytes, length));
43}
44
45// config detail: {'name': 'wheel_spd_rear_right', 'offset': 0.0,
46// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
47// '[-32768|32767]', 'bit': 55, 'type': 'int', 'order': 'motorola',
48// 'physical_unit': 'rad/s'}
49int Wheelspeedrpt7a::wheel_spd_rear_right(const std::uint8_t* bytes,
50 int32_t length) const {
51 Byte t0(bytes + 6);
52 int32_t x = t0.get_byte(0, 8);
53
54 Byte t1(bytes + 7);
55 int32_t t = t1.get_byte(0, 8);
56 x <<= 8;
57 x |= t;
58
59 x <<= 16;
60 x >>= 16;
61
62 int ret = x;
63 return ret;
64}
65
66// config detail: {'name': 'wheel_spd_rear_left', 'offset': 0.0,
67// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
68// '[-32768|32767]', 'bit': 39, 'type': 'int', 'order': 'motorola',
69// 'physical_unit': 'rad/s'}
70int Wheelspeedrpt7a::wheel_spd_rear_left(const std::uint8_t* bytes,
71 int32_t length) const {
72 Byte t0(bytes + 4);
73 int32_t x = t0.get_byte(0, 8);
74
75 Byte t1(bytes + 5);
76 int32_t t = t1.get_byte(0, 8);
77 x <<= 8;
78 x |= t;
79
80 x <<= 16;
81 x >>= 16;
82
83 int ret = x;
84 return ret;
85}
86
87// config detail: {'name': 'wheel_spd_front_right', 'offset': 0.0,
88// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
89// '[-32768|32767]', 'bit': 23, 'type': 'int', 'order': 'motorola',
90// 'physical_unit': 'rad/s'}
91int Wheelspeedrpt7a::wheel_spd_front_right(const std::uint8_t* bytes,
92 int32_t length) const {
93 Byte t0(bytes + 2);
94 int32_t x = t0.get_byte(0, 8);
95
96 Byte t1(bytes + 3);
97 int32_t t = t1.get_byte(0, 8);
98 x <<= 8;
99 x |= t;
100
101 x <<= 16;
102 x >>= 16;
103
104 int ret = x;
105 return ret;
106}
107
108// config detail: {'name': 'wheel_spd_front_left', 'offset': 0.0,
109// 'precision': 1.0, 'len': 16, 'is_signed_var': True, 'physical_range':
110// '[-32768|32767]', 'bit': 7, 'type': 'int', 'order': 'motorola',
111// 'physical_unit': 'rad/s'}
112int Wheelspeedrpt7a::wheel_spd_front_left(const std::uint8_t* bytes,
113 int32_t length) const {
114 Byte t0(bytes + 0);
115 int32_t x = t0.get_byte(0, 8);
116
117 Byte t1(bytes + 1);
118 int32_t t = t1.get_byte(0, 8);
119 x <<= 8;
120 x |= t;
121
122 x <<= 16;
123 x >>= 16;
124
125 int ret = x;
126 return ret;
127}
128} // namespace gem
129} // namespace canbus
130} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Gem *chassis) const override
class register implement
Definition arena_queue.h:37