Apollo 10.0
自动驾驶开放平台
radar_state_201.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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 drivers {
26namespace conti_radar {
27
29
31const uint32_t RadarState201::ID = 0x201;
32
33void RadarState201::Parse(const std::uint8_t* bytes, int32_t length,
34 ContiRadar* conti_radar) const {
35 auto state = conti_radar->mutable_radar_state();
36 state->set_max_distance(max_dist(bytes, length));
37 state->set_output_type(output_type(bytes, length));
38 state->set_rcs_threshold(rcs_threshold(bytes, length));
39 state->set_radar_power(radar_power(bytes, length));
40 state->set_send_quality(send_quality(bytes, length));
41 state->set_send_ext_info(send_ext_info(bytes, length));
42}
43
44int RadarState201::max_dist(const std::uint8_t* bytes, int32_t length) const {
45 Byte t0(bytes + 1);
46 uint32_t x = t0.get_byte(0, 8);
47
48 Byte t1(bytes + 2);
49 uint32_t t = t1.get_byte(6, 2);
50 x <<= 2;
51 x |= t;
52
53 int ret = x * 2;
54 return ret;
55}
56
57int RadarState201::radar_power(const std::uint8_t* bytes,
58 int32_t length) const {
59 Byte t0(bytes + 3);
60 uint32_t x = t0.get_byte(0, 2);
61
62 Byte t1(bytes + 4);
63 uint32_t t = t1.get_byte(7, 1);
64 x <<= 1;
65 x |= t;
66
67 int ret = x;
68 return ret;
69}
70
71RadarState_201::OutputType RadarState201::output_type(const std::uint8_t* bytes,
72 int32_t length) const {
73 Byte t0(bytes + 5);
74 uint32_t x = t0.get_byte(2, 2);
75
76 switch (x) {
77 case 0x0:
79 case 0x1:
81 case 0x2:
83 default:
85 }
86}
87
88RadarState_201::RcsThreshold RadarState201::rcs_threshold(
89 const std::uint8_t* bytes, int32_t length) const {
90 Byte t0(bytes + 7);
91 uint32_t x = t0.get_byte(2, 3);
92
93 switch (x) {
94 case 0x0:
96 case 0x1:
98 default:
100 }
101}
102
103bool RadarState201::send_quality(const std::uint8_t* bytes,
104 int32_t length) const {
105 Byte t0(bytes + 5);
106 uint32_t x = t0.get_byte(4, 1);
107
108 bool ret = (x == 0x1);
109 return ret;
110}
111
112bool RadarState201::send_ext_info(const std::uint8_t* bytes,
113 int32_t length) const {
114 Byte t0(bytes + 5);
115 uint32_t x = t0.get_byte(5, 1);
116
117 bool ret = (x == 0x1);
118 return ret;
119}
120
121} // namespace conti_radar
122} // namespace drivers
123} // 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, ContiRadar *conti_radar) const override
class register implement
Definition arena_queue.h:37