Apollo 10.0
自动驾驶开放平台
radar_util.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 *****************************************************************************/
17
18namespace apollo {
19namespace perception {
20namespace radar {
21
23 double theta = object->theta;
24 const auto& center = object->center;
25 double length = object->size(0);
26 double width = object->size(1);
27
28 Eigen::Matrix2d rotation;
29 rotation << cos(theta), -sin(theta), sin(theta), cos(theta);
30
31 Eigen::Vector2d local_poly(0, 0);
32 Eigen::Vector2d world_poly;
33
34 object->polygon.resize(4);
35
36 // - -
37 local_poly(0) = -0.5 * length;
38 local_poly(1) = -0.5 * width;
39 world_poly = rotation * local_poly;
40 object->polygon[0].x = center(0) + world_poly(0);
41 object->polygon[0].y = center(1) + world_poly(1);
42 object->polygon[0].z = center(2);
43
44 // - +
45 local_poly(1) = +0.5 * width;
46 world_poly = rotation * local_poly;
47 object->polygon[1].x = center(0) + world_poly(0);
48 object->polygon[1].y = center(1) + world_poly(1);
49 object->polygon[1].z = center(2);
50
51 // + +
52 local_poly(0) = +0.5 * length;
53 world_poly = rotation * local_poly;
54 object->polygon[2].x = center(0) + world_poly(0);
55 object->polygon[2].y = center(1) + world_poly(1);
56 object->polygon[2].z = center(2);
57
58 // + -
59 local_poly(1) = -0.5 * width;
60 world_poly = rotation * local_poly;
61 object->polygon[3].x = center(0) + world_poly(0);
62 object->polygon[3].y = center(1) + world_poly(1);
63 object->polygon[3].z = center(2);
64}
65
66} // namespace radar
67} // namespace perception
68} // namespace apollo
std::shared_ptr< Object > ObjectPtr
Definition object.h:127
void MockRadarPolygon(base::ObjectPtr object)
Construct object bounding box from center point and object size.
Definition radar_util.cc:22
class register implement
Definition arena_queue.h:37