Apollo 10.0
自动驾驶开放平台
cluster_quality_info_702.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 ClusterQualityInfo702::ID = 0x702;
33
34void ClusterQualityInfo702::Parse(const std::uint8_t* bytes, int32_t length,
35 RacobitRadar* racobit_radar) const {
36 int id = target_id(bytes, length);
37 for (int i = 0; i < racobit_radar->contiobs_size(); ++i) {
38 if (racobit_radar->contiobs(i).obstacle_id() == id) {
39 auto racobit_obs = racobit_radar->mutable_contiobs(i);
40 racobit_obs->set_longitude_dist_rms(
41 LINEAR_RMS[longitude_dist_rms(bytes, length)]);
42 racobit_obs->set_lateral_dist_rms(
43 LINEAR_RMS[lateral_dist_rms(bytes, length)]);
44 racobit_obs->set_longitude_vel_rms(
45 LINEAR_RMS[longitude_vel_rms(bytes, length)]);
46 racobit_obs->set_lateral_vel_rms(
47 LINEAR_RMS[lateral_vel_rms(bytes, length)]);
48 racobit_obs->set_probexist(PROBOFEXIST[pdh0(bytes, length)]);
49 switch (invalid_state(bytes, length)) {
50 case 0x01:
51 case 0x02:
52 case 0x03:
53 case 0x06:
54 case 0x07:
55 case 0x0E:
56 racobit_obs->set_probexist(PROBOFEXIST[0]);
57 default:
58 break;
59 }
60 switch (ambig_state(bytes, length)) {
61 case 0x00:
62 case 0x01:
63 case 0x02:
64 racobit_obs->set_probexist(PROBOFEXIST[0]);
65 default:
66 break;
67 }
68 }
69 }
70}
71
72int ClusterQualityInfo702::target_id(const std::uint8_t* bytes,
73 int32_t length) const {
74 Byte t0(bytes);
75 int32_t x = t0.get_byte(0, 8);
76
77 int ret = x;
78 return ret;
79}
80
81int ClusterQualityInfo702::longitude_dist_rms(const std::uint8_t* bytes,
82 int32_t length) const {
83 Byte t0(bytes + 1);
84 int32_t x = t0.get_byte(3, 5);
85
86 int ret = x;
87 return ret;
88}
89
90int ClusterQualityInfo702::lateral_dist_rms(const std::uint8_t* bytes,
91 int32_t length) const {
92 Byte t0(bytes + 1);
93 int32_t x = t0.get_byte(0, 3);
94
95 Byte t1(bytes + 2);
96 int32_t t = t1.get_byte(6, 2);
97
98 x <<= 2;
99 x |= t;
100
101 int ret = x;
102 return ret;
103}
104
105int ClusterQualityInfo702::longitude_vel_rms(const std::uint8_t* bytes,
106 int32_t length) const {
107 Byte t0(bytes + 2);
108 int32_t x = t0.get_byte(1, 5);
109
110 int ret = x;
111 return ret;
112}
113
114int ClusterQualityInfo702::pdh0(const std::uint8_t* bytes,
115 int32_t length) const {
116 Byte t0(bytes + 3);
117 int32_t x = t0.get_byte(0, 3);
118
119 int ret = x;
120 return ret;
121}
122
123int ClusterQualityInfo702::ambig_state(const std::uint8_t* bytes,
124 int32_t length) const {
125 Byte t0(bytes + 4);
126 int32_t x = t0.get_byte(0, 3);
127
128 int ret = x;
129 return ret;
130}
131
132int ClusterQualityInfo702::invalid_state(const std::uint8_t* bytes,
133 int32_t length) const {
134 Byte t0(bytes + 4);
135 int32_t x = t0.get_byte(3, 5);
136
137 int ret = x;
138 return ret;
139}
140
141int ClusterQualityInfo702::lateral_vel_rms(const std::uint8_t* bytes,
142 int32_t length) const {
143 Byte t0(bytes + 2);
144 int32_t x = t0.get_byte(0, 1);
145
146 Byte t1(bytes + 3);
147 int32_t t = t1.get_byte(4, 4);
148
149 x <<= 4;
150 x |= t;
151
152 int ret = x;
153 return ret;
154}
155
156} // namespace racobit_radar
157} // namespace drivers
158} // 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