Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
ab42a281
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,体验更适合开发者的 AI 搜索 >>
提交
ab42a281
编写于
9月 26, 2019
作者:
J
jmtao
提交者:
Xiangquan Xiao
9月 26, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
planning: pull_over_emergency scenario
上级
e66c06fa
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
188 addition
and
0 deletion
+188
-0
modules/planning/scenarios/park/pull_over_emergency/BUILD
modules/planning/scenarios/park/pull_over_emergency/BUILD
+29
-0
modules/planning/scenarios/park/pull_over_emergency/pull_over_emergency_scenario.cc
.../park/pull_over_emergency/pull_over_emergency_scenario.cc
+91
-0
modules/planning/scenarios/park/pull_over_emergency/pull_over_emergency_scenario.h
...s/park/pull_over_emergency/pull_over_emergency_scenario.h
+68
-0
未找到文件。
modules/planning/scenarios/park/pull_over_emergency/BUILD
0 → 100644
浏览文件 @
ab42a281
load
(
"//tools:cpplint.bzl"
,
"cpplint"
)
package
(
default_visibility
=
[
"//visibility:public"
])
cc_library
(
name
=
"pull_over_emergency_scenario"
,
srcs
=
[
"pull_over_emergency_scenario.cc"
,
],
hdrs
=
[
"pull_over_emergency_scenario.h"
,
],
copts
=
[
"-DMODULE_NAME=
\\\"
planning
\\\"
"
],
deps
=
[
"//cyber/common:log"
,
"//external:gflags"
,
"//modules/common/util:factory"
,
"//modules/common/vehicle_state:vehicle_state_provider"
,
"//modules/planning/common:planning_common"
,
"//modules/planning/common/util:common_lib"
,
"//modules/planning/common/util:util_lib"
,
"//modules/planning/proto:planning_proto"
,
"//modules/planning/scenarios:scenario"
,
"//modules/planning/scenarios/util:scenario_util_lib"
,
"@eigen"
,
],
)
cpplint
()
modules/planning/scenarios/park/pull_over_emergency/pull_over_emergency_scenario.cc
0 → 100644
浏览文件 @
ab42a281
/******************************************************************************
* Copyright 2019 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/scenarios/park/pull_over_emergency/pull_over_emergency_scenario.h"
#include "cyber/common/log.h"
namespace
apollo
{
namespace
planning
{
namespace
scenario
{
namespace
pull_over_emergency
{
apollo
::
common
::
util
::
Factory
<
ScenarioConfig
::
StageType
,
Stage
,
Stage
*
(
*
)(
const
ScenarioConfig
::
StageConfig
&
stage_config
)
>
PullOverEmergencyScenario
::
s_stage_factory_
;
void
PullOverEmergencyScenario
::
Init
()
{
if
(
init_
)
{
return
;
}
Scenario
::
Init
();
if
(
!
GetScenarioConfig
())
{
AERROR
<<
"fail to get scenario specific config"
;
return
;
}
init_
=
true
;
}
void
PullOverEmergencyScenario
::
RegisterStages
()
{
if
(
!
s_stage_factory_
.
Empty
())
{
s_stage_factory_
.
Clear
();
}
/*
s_stage_factory_.Register(
ScenarioConfig::PULL_OVER_APPROACH,
[](const ScenarioConfig::StageConfig& config) -> Stage* {
return new PullOverEmergencyStageApproach(config);
});
*/
}
std
::
unique_ptr
<
Stage
>
PullOverEmergencyScenario
::
CreateStage
(
const
ScenarioConfig
::
StageConfig
&
stage_config
)
{
if
(
s_stage_factory_
.
Empty
())
{
RegisterStages
();
}
auto
ptr
=
s_stage_factory_
.
CreateObjectOrNull
(
stage_config
.
stage_type
(),
stage_config
);
if
(
ptr
)
{
ptr
->
SetContext
(
&
context_
);
}
return
ptr
;
}
/*
* read scenario specific configs and set in context_ for stages to read
*/
bool
PullOverEmergencyScenario
::
GetScenarioConfig
()
{
if
(
!
config_
.
has_pull_over_emergency_config
())
{
AERROR
<<
"miss scenario specific config"
;
return
false
;
}
context_
.
scenario_config
.
CopyFrom
(
config_
.
pull_over_emergency_config
());
return
true
;
}
}
// namespace pull_over_emergency
}
// namespace scenario
}
// namespace planning
}
// namespace apollo
modules/planning/scenarios/park/pull_over_emergency/pull_over_emergency_scenario.h
0 → 100644
浏览文件 @
ab42a281
/******************************************************************************
* Copyright 2019 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
**/
#pragma once
#include <memory>
#include "modules/common/util/factory.h"
#include "modules/planning/common/frame.h"
#include "modules/planning/scenarios/scenario.h"
namespace
apollo
{
namespace
planning
{
namespace
scenario
{
namespace
pull_over_emergency
{
// stage context
struct
PullOverEmergencyContext
{
ScenarioPullOverEmergencyConfig
scenario_config
;
};
class
PullOverEmergencyScenario
:
public
Scenario
{
public:
PullOverEmergencyScenario
(
const
ScenarioConfig
&
config
,
const
ScenarioContext
*
context
)
:
Scenario
(
config
,
context
)
{}
void
Init
()
override
;
std
::
unique_ptr
<
Stage
>
CreateStage
(
const
ScenarioConfig
::
StageConfig
&
stage_config
);
PullOverEmergencyContext
*
GetContext
()
{
return
&
context_
;
}
private:
static
void
RegisterStages
();
bool
GetScenarioConfig
();
private:
static
apollo
::
common
::
util
::
Factory
<
ScenarioConfig
::
StageType
,
Stage
,
Stage
*
(
*
)(
const
ScenarioConfig
::
StageConfig
&
stage_config
)
>
s_stage_factory_
;
bool
init_
=
false
;
PullOverEmergencyContext
context_
;
};
}
// namespace pull_over_emergency
}
// namespace scenario
}
// namespace planning
}
// namespace apollo
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录