Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
3bc3da33
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3bc3da33
编写于
9月 30, 2017
作者:
D
Dong Li
提交者:
Liangliang Zhang
10月 01, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
planning: add clear zone traffic rule.
上级
e3d045d8
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
181 addition
and
0 deletion
+181
-0
modules/planning/common/path_obstacle.cc
modules/planning/common/path_obstacle.cc
+4
-0
modules/planning/common/path_obstacle.h
modules/planning/common/path_obstacle.h
+2
-0
modules/planning/common/planning_gflags.cc
modules/planning/common/planning_gflags.cc
+3
-0
modules/planning/common/planning_gflags.h
modules/planning/common/planning_gflags.h
+2
-0
modules/planning/common/speed/st_boundary.h
modules/planning/common/speed/st_boundary.h
+1
-0
modules/planning/proto/planning_config.proto
modules/planning/proto/planning_config.proto
+1
-0
modules/planning/proto/planning_internal.proto
modules/planning/proto/planning_internal.proto
+1
-0
modules/planning/tasks/speed_optimizer.cc
modules/planning/tasks/speed_optimizer.cc
+4
-0
modules/planning/tasks/traffic_decider/BUILD
modules/planning/tasks/traffic_decider/BUILD
+2
-0
modules/planning/tasks/traffic_decider/clear_zone.cc
modules/planning/tasks/traffic_decider/clear_zone.cc
+107
-0
modules/planning/tasks/traffic_decider/clear_zone.h
modules/planning/tasks/traffic_decider/clear_zone.h
+54
-0
未找到文件。
modules/planning/common/path_obstacle.cc
浏览文件 @
3bc3da33
...
...
@@ -391,5 +391,9 @@ void PathObstacle::SetStBoundary(const StBoundary& boundary) {
st_boundary_
=
boundary
;
}
void
PathObstacle
::
SetStBoundaryType
(
const
StBoundary
::
BoundaryType
type
)
{
st_boundary_
.
SetBoundaryType
(
type
);
}
}
// namespace planning
}
// namespace apollo
modules/planning/common/path_obstacle.h
浏览文件 @
3bc3da33
...
...
@@ -98,6 +98,8 @@ class PathObstacle {
void
SetStBoundary
(
const
StBoundary
&
boundary
);
void
SetStBoundaryType
(
const
StBoundary
::
BoundaryType
type
);
void
EraseStBoundary
();
bool
HasLongitudinalDecision
()
const
;
...
...
modules/planning/common/planning_gflags.cc
浏览文件 @
3bc3da33
...
...
@@ -136,6 +136,9 @@ DEFINE_double(stop_max_distance_buffer, 4.0,
"distance buffer of passing stop line"
);
DEFINE_double
(
stop_min_speed
,
0.1
,
"min speed for computing stop"
);
DEFINE_double
(
stop_max_deceleration
,
6.0
,
"max deceleration"
);
/// Clear Zone
DEFINE_string
(
clear_zone_virtual_object_id_prefix
,
"CZ_"
,
"prefix for converting clear zone id to virtual object id"
);
/// traffic light
DEFINE_string
(
signal_light_virtual_object_id_prefix
,
"SL_"
,
"prefix for converting signal id to virtual object id"
);
...
...
modules/planning/common/planning_gflags.h
浏览文件 @
3bc3da33
...
...
@@ -101,6 +101,8 @@ DECLARE_bool(enable_follow_accel_constraint);
DECLARE_double
(
stop_max_distance_buffer
);
DECLARE_double
(
stop_min_speed
);
DECLARE_double
(
stop_max_deceleration
);
/// Clear Zone
DECLARE_string
(
clear_zone_virtual_object_id_prefix
);
/// triffic light
DECLARE_string
(
signal_light_virtual_object_id_prefix
);
DECLARE_double
(
max_deacceleration_for_yellow_light_stop
);
...
...
modules/planning/common/speed/st_boundary.h
浏览文件 @
3bc3da33
...
...
@@ -59,6 +59,7 @@ class StBoundary : public common::math::Polygon2d {
FOLLOW
,
YIELD
,
OVERTAKE
,
KEEP_CLEAR
,
};
bool
IsEmpty
()
const
{
return
lower_points_
.
empty
();
}
...
...
modules/planning/proto/planning_config.proto
浏览文件 @
3bc3da33
...
...
@@ -23,6 +23,7 @@ message RuleConfig {
BACKSIDE_VEHICLE
=
1
;
SIGNAL_LIGHT
=
2
;
CROSSWALK
=
3
;
CLEAR_ZONE
=
4
;
}
optional
RuleId
rule_id
=
1
;
}
...
...
modules/planning/proto/planning_internal.proto
浏览文件 @
3bc3da33
...
...
@@ -25,6 +25,7 @@ message StGraphBoundaryDebug {
ST_BOUNDARY_TYPE_FOLLOW
=
3
;
ST_BOUNDARY_TYPE_YIELD
=
4
;
ST_BOUNDARY_TYPE_OVERTAKE
=
5
;
ST_BOUNDARY_TYPE_KEEP_CLEAR
=
6
;
}
optional
string
name
=
1
;
repeated
apollo.common.SpeedPoint
point
=
2
;
...
...
modules/planning/tasks/speed_optimizer.cc
浏览文件 @
3bc3da33
...
...
@@ -130,6 +130,10 @@ void SpeedOptimizer::RecordSTGraphDebug(const StGraphData& st_graph_data,
case
StBoundary
::
BoundaryType
::
YIELD
:
boundary_debug
->
set_type
(
StGraphBoundaryDebug
::
ST_BOUNDARY_TYPE_YIELD
);
break
;
case
StBoundary
::
BoundaryType
::
KEEP_CLEAR
:
boundary_debug
->
set_type
(
StGraphBoundaryDebug
::
ST_BOUNDARY_TYPE_KEEP_CLEAR
);
break
;
}
for
(
const
auto
&
point
:
boundary
->
points
())
{
...
...
modules/planning/tasks/traffic_decider/BUILD
浏览文件 @
3bc3da33
...
...
@@ -6,11 +6,13 @@ cc_library(
name
=
"traffic_rules"
,
srcs
=
[
"backside_vehicle.cc"
,
"clear_zone.cc"
,
"crosswalk.cc"
,
"signal_light.cc"
,
],
hdrs
=
[
"backside_vehicle.h"
,
"clear_zone.h"
,
"crosswalk.h"
,
"signal_light.h"
,
"traffic_rule.h"
,
...
...
modules/planning/tasks/traffic_decider/clear_zone.cc
0 → 100644
浏览文件 @
3bc3da33
/******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
/**
* @file
**/
#include "modules/planning/tasks/traffic_decider/clear_zone.h"
#include <limits>
#include <vector>
#include "modules/common/proto/pnc_point.pb.h"
#include "modules/common/adapters/adapter_manager.h"
#include "modules/common/vehicle_state/vehicle_state.h"
#include "modules/planning/common/planning_gflags.h"
namespace
apollo
{
namespace
planning
{
using
apollo
::
common
::
adapter
::
AdapterManager
;
using
apollo
::
perception
::
TrafficLight
;
using
apollo
::
perception
::
TrafficLightDetection
;
ClearZone
::
ClearZone
(
const
RuleConfig
&
config
)
:
TrafficRule
(
config
)
{}
bool
ClearZone
::
ApplyRule
(
Frame
*
frame
,
ReferenceLineInfo
*
const
reference_line_info
)
{
frame_
=
frame
;
reference_line_info_
=
reference_line_info
;
const
auto
&
map_path
=
reference_line_info_
->
reference_line
().
map_path
();
const
auto
&
clear_zones
=
map_path
.
junction_overlaps
();
for
(
const
auto
&
clear_zone
:
clear_zones
)
{
if
(
!
BuildClearZoneObstacle
(
clear_zone
))
{
AERROR
<<
"Failed to build clear zone : "
<<
clear_zone
.
object_id
;
return
false
;
}
}
return
true
;
}
bool
ClearZone
::
BuildClearZoneObstacle
(
const
hdmap
::
PathOverlap
&
clear_zone_overlap
)
{
const
double
front_edge_s
=
reference_line_info_
->
AdcSlBoundary
().
end_s
();
if
(
clear_zone_overlap
.
start_s
<
front_edge_s
)
{
ADEBUG
<<
"adc is already inside clear zone "
<<
clear_zone_overlap
.
object_id
<<
", skip this clear zone"
;
return
true
;
}
common
::
SLPoint
sl_point
;
sl_point
.
set_s
(
clear_zone_overlap
.
start_s
);
sl_point
.
set_l
(
0.0
);
common
::
math
::
Vec2d
start_xy
;
const
auto
&
reference_line
=
reference_line_info_
->
reference_line
();
if
(
!
reference_line
.
SLToXY
(
sl_point
,
&
start_xy
))
{
AERROR
<<
"Failed to get xy from sl: "
<<
sl_point
.
DebugString
();
return
false
;
}
double
left_lane_width
=
0.0
;
double
right_lane_width
=
0.0
;
if
(
!
reference_line
.
GetLaneWidth
(
clear_zone_overlap
.
start_s
,
&
left_lane_width
,
&
right_lane_width
))
{
AERROR
<<
"Failed to get lane width at s = "
<<
clear_zone_overlap
.
start_s
;
return
false
;
}
common
::
math
::
Vec2d
end_xy
;
sl_point
.
set_s
(
clear_zone_overlap
.
end_s
);
if
(
!
reference_line_info_
->
reference_line
().
SLToXY
(
sl_point
,
&
end_xy
))
{
AERROR
<<
"Failed to get xy from sl: "
<<
sl_point
.
DebugString
();
return
false
;
}
common
::
math
::
Box2d
clear_zone_box
{
common
::
math
::
LineSegment2d
(
start_xy
,
end_xy
),
left_lane_width
+
right_lane_width
};
const
auto
obstacle_id
=
FLAGS_clear_zone_virtual_object_id_prefix
+
clear_zone_overlap
.
object_id
;
auto
*
obstacle
=
frame_
->
AddStaticVirtualObstacle
(
obstacle_id
,
clear_zone_box
);
if
(
!
obstacle
)
{
AERROR
<<
"Failed to create obstacle "
<<
obstacle_id
<<
" in frame"
;
return
false
;
}
auto
*
path_obstacle
=
reference_line_info_
->
AddObstacle
(
obstacle
);
if
(
!
path_obstacle
)
{
AERROR
<<
"Failed to create path_obstacle for "
<<
obstacle_id
;
return
false
;
}
path_obstacle
->
SetStBoundaryType
(
StBoundary
::
BoundaryType
::
KEEP_CLEAR
);
return
true
;
}
}
// namespace planning
}
// namespace apollo
modules/planning/tasks/traffic_decider/clear_zone.h
0 → 100644
浏览文件 @
3bc3da33
/******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
/**
* @file
**/
#ifndef MODULES_PLANNING_TASKS_TRAFFIC_DECIDER_CLEAR_ZONE_H_
#define MODULES_PLANNING_TASKS_TRAFFIC_DECIDER_CLEAR_ZONE_H_
#include <string>
#include <unordered_map>
#include <vector>
#include "modules/perception/proto/traffic_light_detection.pb.h"
#include "modules/planning/tasks/traffic_decider/traffic_rule.h"
namespace
apollo
{
namespace
planning
{
/**
* This class creates a virtual obstacle for each keep clear region.
*/
class
ClearZone
:
public
TrafficRule
{
public:
explicit
ClearZone
(
const
RuleConfig
&
config
);
virtual
~
ClearZone
()
=
default
;
bool
ApplyRule
(
Frame
*
frame
,
ReferenceLineInfo
*
const
reference_line_info
);
private:
bool
BuildClearZoneObstacle
(
const
hdmap
::
PathOverlap
&
clear_zone_overlap
);
ReferenceLineInfo
*
reference_line_info_
;
Frame
*
frame_
;
};
}
// namespace planning
}
// namespace apollo
#endif // MODULES_PLANNING_TASKS_TRAFFIC_DECIDER_CLEAR_ZONE_H_
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录