Apollo 10.0
自动驾驶开放平台
lat_lon_heading_rpt_82.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 Latlonheadingrpt82::ID = 0x82;
32
33void Latlonheadingrpt82::Parse(const std::uint8_t* bytes, int32_t length,
34 Gem* chassis) const {
35 chassis->mutable_lat_lon_heading_rpt_82()->set_heading(
36 heading(bytes, length));
37 chassis->mutable_lat_lon_heading_rpt_82()->set_longitude_seconds(
38 longitude_seconds(bytes, length));
39 chassis->mutable_lat_lon_heading_rpt_82()->set_longitude_minutes(
40 longitude_minutes(bytes, length));
41 chassis->mutable_lat_lon_heading_rpt_82()->set_longitude_degrees(
42 longitude_degrees(bytes, length));
43 chassis->mutable_lat_lon_heading_rpt_82()->set_latitude_seconds(
44 latitude_seconds(bytes, length));
45 chassis->mutable_lat_lon_heading_rpt_82()->set_latitude_minutes(
46 latitude_minutes(bytes, length));
47 chassis->mutable_lat_lon_heading_rpt_82()->set_latitude_degrees(
48 latitude_degrees(bytes, length));
49}
50
51// config detail: {'name': 'heading', 'offset': 0.0, 'precision': 0.01, 'len':
52// 16, 'is_signed_var': True, 'physical_range': '[-327.68|327.67]', 'bit': 55,
53// 'type': 'double', 'order': 'motorola', 'physical_unit': 'deg'}
54double Latlonheadingrpt82::heading(const std::uint8_t* bytes,
55 int32_t length) const {
56 Byte t0(bytes + 6);
57 int32_t x = t0.get_byte(0, 8);
58
59 Byte t1(bytes + 7);
60 int32_t t = t1.get_byte(0, 8);
61 x <<= 8;
62 x |= t;
63
64 x <<= 16;
65 x >>= 16;
66
67 double ret = x * 0.010000;
68 return ret;
69}
70
71// config detail: {'name': 'longitude_seconds', 'offset': 0.0, 'precision': 1.0,
72// 'len': 8, 'is_signed_var': True, 'physical_range': '[-128|127]', 'bit': 47,
73// 'type': 'int', 'order': 'motorola', 'physical_unit': 'sec'}
74int Latlonheadingrpt82::longitude_seconds(const std::uint8_t* bytes,
75 int32_t length) const {
76 Byte t0(bytes + 5);
77 int32_t x = t0.get_byte(0, 8);
78
79 x <<= 24;
80 x >>= 24;
81
82 int ret = x;
83 return ret;
84}
85
86// config detail: {'name': 'longitude_minutes', 'offset': 0.0, 'precision': 1.0,
87// 'len': 8, 'is_signed_var': True, 'physical_range': '[-128|127]', 'bit': 39,
88// 'type': 'int', 'order': 'motorola', 'physical_unit': 'min'}
89int Latlonheadingrpt82::longitude_minutes(const std::uint8_t* bytes,
90 int32_t length) const {
91 Byte t0(bytes + 4);
92 int32_t x = t0.get_byte(0, 8);
93
94 x <<= 24;
95 x >>= 24;
96
97 int ret = x;
98 return ret;
99}
100
101// config detail: {'name': 'longitude_degrees', 'offset': 0.0, 'precision': 1.0,
102// 'len': 8, 'is_signed_var': True, 'physical_range': '[-128|127]', 'bit': 31,
103// 'type': 'int', 'order': 'motorola', 'physical_unit': 'deg'}
104int Latlonheadingrpt82::longitude_degrees(const std::uint8_t* bytes,
105 int32_t length) const {
106 Byte t0(bytes + 3);
107 int32_t x = t0.get_byte(0, 8);
108
109 x <<= 24;
110 x >>= 24;
111
112 int ret = x;
113 return ret;
114}
115
116// config detail: {'name': 'latitude_seconds', 'offset': 0.0, 'precision': 1.0,
117// 'len': 8, 'is_signed_var': True, 'physical_range': '[-128|127]', 'bit': 23,
118// 'type': 'int', 'order': 'motorola', 'physical_unit': 'sec'}
119int Latlonheadingrpt82::latitude_seconds(const std::uint8_t* bytes,
120 int32_t length) const {
121 Byte t0(bytes + 2);
122 int32_t x = t0.get_byte(0, 8);
123
124 x <<= 24;
125 x >>= 24;
126
127 int ret = x;
128 return ret;
129}
130
131// config detail: {'name': 'latitude_minutes', 'offset': 0.0, 'precision': 1.0,
132// 'len': 8, 'is_signed_var': True, 'physical_range': '[-128|127]', 'bit': 15,
133// 'type': 'int', 'order': 'motorola', 'physical_unit': 'min'}
134int Latlonheadingrpt82::latitude_minutes(const std::uint8_t* bytes,
135 int32_t length) const {
136 Byte t0(bytes + 1);
137 int32_t x = t0.get_byte(0, 8);
138
139 x <<= 24;
140 x >>= 24;
141
142 int ret = x;
143 return ret;
144}
145
146// config detail: {'name': 'latitude_degrees', 'offset': 0.0, 'precision': 1.0,
147// 'len': 8, 'is_signed_var': True, 'physical_range': '[-128|127]', 'bit': 7,
148// 'type': 'int', 'order': 'motorola', 'physical_unit': 'deg'}
149int Latlonheadingrpt82::latitude_degrees(const std::uint8_t* bytes,
150 int32_t length) const {
151 Byte t0(bytes + 0);
152 int32_t x = t0.get_byte(0, 8);
153
154 x <<= 24;
155 x >>= 24;
156
157 int ret = x;
158 return ret;
159}
160} // namespace gem
161} // namespace canbus
162} // 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