Apollo 10.0
自动驾驶开放平台
object_quality_info_60c.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
19
20#include "glog/logging.h"
21
24
25namespace apollo {
26namespace drivers {
27namespace racobit_radar {
28
30
32const uint32_t ObjectQualityInfo60C::ID = 0x60C;
33
34void ObjectQualityInfo60C::Parse(const std::uint8_t* bytes, int32_t length,
35 RacobitRadar* racobit_radar) const {
36 int obj_id = object_id(bytes, length);
37
38 for (int i = 0; i < racobit_radar->contiobs_size(); ++i) {
39 if (racobit_radar->contiobs(i).obstacle_id() == obj_id) {
40 auto obs = racobit_radar->mutable_contiobs(i);
41 obs->set_longitude_dist_rms(
42 LINEAR_RMS[longitude_dist_rms(bytes, length)]);
43 obs->set_lateral_dist_rms(LINEAR_RMS[lateral_dist_rms(bytes, length)]);
44 obs->set_longitude_vel_rms(LINEAR_RMS[longitude_vel_rms(bytes, length)]);
45 obs->set_lateral_vel_rms(LINEAR_RMS[lateral_vel_rms(bytes, length)]);
46 obs->set_longitude_accel_rms(
47 LINEAR_RMS[longitude_accel_rms(bytes, length)]);
48 obs->set_lateral_accel_rms(LINEAR_RMS[lateral_accel_rms(bytes, length)]);
49 obs->set_oritation_angle_rms(
50 ANGLE_RMS[oritation_angle_rms(bytes, length)]);
51 obs->set_probexist(PROBOFEXIST[probexist(bytes, length)]);
52 obs->set_meas_state(meas_state(bytes, length));
53 break;
54 }
55 }
56}
57
58int ObjectQualityInfo60C::object_id(const std::uint8_t* bytes,
59 int32_t length) const {
60 Byte t0(bytes);
61 int32_t x = t0.get_byte(0, 8);
62
63 int ret = x;
64 return ret;
65}
66
67int ObjectQualityInfo60C::longitude_dist_rms(const std::uint8_t* bytes,
68 int32_t length) const {
69 Byte t0(bytes + 1);
70 int32_t x = t0.get_byte(3, 5);
71
72 int ret = x;
73 return ret;
74}
75
76int ObjectQualityInfo60C::lateral_dist_rms(const std::uint8_t* bytes,
77 int32_t length) const {
78 Byte t0(bytes + 1);
79 int32_t x = t0.get_byte(0, 3);
80
81 Byte t1(bytes + 2);
82 int32_t t = t1.get_byte(6, 2);
83
84 x <<= 2;
85 x |= t;
86
87 int ret = x;
88 return ret;
89}
90
91int ObjectQualityInfo60C::longitude_vel_rms(const std::uint8_t* bytes,
92 int32_t length) const {
93 Byte t0(bytes + 2);
94 int32_t x = t0.get_byte(1, 5);
95
96 int ret = x;
97 return ret;
98}
99
100int ObjectQualityInfo60C::lateral_vel_rms(const std::uint8_t* bytes,
101 int32_t length) const {
102 Byte t0(bytes + 2);
103 int32_t x = t0.get_byte(0, 1);
104
105 Byte t1(bytes + 3);
106 int32_t t = t1.get_byte(4, 4);
107
108 x <<= 4;
109 x |= t;
110
111 int ret = x;
112 return ret;
113}
114
115int ObjectQualityInfo60C::longitude_accel_rms(const std::uint8_t* bytes,
116 int32_t length) const {
117 Byte t0(bytes + 3);
118 int32_t x = t0.get_byte(0, 4);
119
120 Byte t1(bytes + 4);
121 int32_t t = t1.get_byte(7, 1);
122
123 x <<= 1;
124 x |= t;
125
126 int ret = x;
127 return ret;
128}
129
130int ObjectQualityInfo60C::lateral_accel_rms(const std::uint8_t* bytes,
131 int32_t length) const {
132 Byte t0(bytes + 4);
133 int32_t x = t0.get_byte(2, 5);
134
135 int ret = x;
136 return ret;
137}
138
139int ObjectQualityInfo60C::oritation_angle_rms(const std::uint8_t* bytes,
140 int32_t length) const {
141 Byte t0(bytes + 4);
142 int32_t x = t0.get_byte(0, 2);
143
144 Byte t1(bytes + 5);
145 int32_t t = t1.get_byte(5, 3);
146
147 x <<= 3;
148 x |= t;
149
150 int ret = x;
151 return ret;
152}
153
154int ObjectQualityInfo60C::probexist(const std::uint8_t* bytes,
155 int32_t length) const {
156 Byte t0(bytes + 6);
157 int32_t x = t0.get_byte(5, 3);
158
159 int ret = x;
160 return ret;
161}
162
163int ObjectQualityInfo60C::meas_state(const std::uint8_t* bytes,
164 int32_t length) const {
165 Byte t0(bytes + 6);
166 int32_t x = t0.get_byte(2, 3);
167
168 int ret = x;
169 return ret;
170}
171
172} // namespace racobit_radar
173} // namespace drivers
174} // namespace apollo
Defines the Byte class.
The class of one byte, which is 8 bits.
Definition byte.h:39
void Parse(const std::uint8_t *bytes, int32_t length, RacobitRadar *racobit_radar) const override
const double LINEAR_RMS[32]
Definition const_vars.h:40
class register implement
Definition arena_queue.h:37
repeated RacobitRadarObs contiobs