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