Apollo
11.0
自动驾驶开放平台
filter.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
21
#include "
modules/third_party_perception/tools/filter.h
"
22
23
#include "
modules/third_party_perception/common/third_party_perception_gflags.h
"
24
#include "
modules/third_party_perception/common/third_party_perception_util.h
"
25
30
namespace
apollo
{
31
namespace
third_party_perception {
32
namespace
filter {
33
34
bool
IsPreserved
(
const
RadarObstacle
& radar_obstacle) {
35
if
(!radar_obstacle.
movable
()) {
36
return
false
;
37
}
38
double
nearest_l =
39
GetLateralDistanceToNearestLane
(radar_obstacle.
absolute_position
());
40
if
(std::abs(nearest_l) > FLAGS_filter_y_distance) {
41
return
false
;
42
}
43
if
(radar_obstacle.
count
() < FLAGS_keep_radar_frames) {
44
return
false
;
45
}
46
return
true
;
47
}
48
49
RadarObstacles
FilterRadarObstacles
(
const
RadarObstacles
& radar_obstacles) {
50
RadarObstacles
filtered_radar_obstacles;
51
for
(
const
auto
& iter : radar_obstacles.
radar_obstacle
()) {
52
if
(
IsPreserved
(iter.second)) {
53
filtered_radar_obstacles.mutable_radar_obstacle()->insert(iter);
54
}
55
}
56
filtered_radar_obstacles.mutable_header()->CopyFrom(radar_obstacles.
header
());
57
return
filtered_radar_obstacles;
58
}
59
60
}
// namespace filter
61
}
// namespace third_party_perception
62
}
// namespace apollo
apollo::third_party_perception::filter::IsPreserved
bool IsPreserved(const RadarObstacle &radar_obstacle)
Definition
filter.cc:34
apollo::third_party_perception::filter::FilterRadarObstacles
RadarObstacles FilterRadarObstacles(const RadarObstacles &radar_obstacles)
Definition
filter.cc:49
apollo::third_party_perception::GetLateralDistanceToNearestLane
double GetLateralDistanceToNearestLane(const Point &point)
Definition
third_party_perception_util.cc:197
apollo
class register implement
Definition
arena_queue.h:37
apollo::third_party_perception::RadarObstacle
Definition
radar_obstacle.proto:10
apollo::third_party_perception::RadarObstacle::absolute_position
optional apollo::common::Point3D absolute_position
Definition
radar_obstacle.proto:20
apollo::third_party_perception::RadarObstacle::count
optional int32 count
Definition
radar_obstacle.proto:22
apollo::third_party_perception::RadarObstacle::movable
optional bool movable
Definition
radar_obstacle.proto:15
apollo::third_party_perception::RadarObstacles
Definition
radar_obstacle.proto:26
apollo::third_party_perception::RadarObstacles::header
optional apollo::common::Header header
Definition
radar_obstacle.proto:28
apollo::third_party_perception::RadarObstacles::radar_obstacle
map< int32, RadarObstacle > radar_obstacle
Definition
radar_obstacle.proto:27
filter.h
third_party_perception_gflags.h
third_party_perception_util.h
modules
third_party_perception
tools
filter.cc