Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
7ec7edcd
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,发现更多精彩内容 >>
提交
7ec7edcd
编写于
9月 27, 2017
作者:
C
Calvin Miao
提交者:
Dong Li
9月 27, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prediction: enabled replay mode by timestamp gap (#454)
上级
3adba6a4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
10 deletion
+39
-10
modules/prediction/common/prediction_gflags.cc
modules/prediction/common/prediction_gflags.cc
+5
-1
modules/prediction/common/prediction_gflags.h
modules/prediction/common/prediction_gflags.h
+4
-1
modules/prediction/container/obstacles/obstacles_container.cc
...les/prediction/container/obstacles/obstacles_container.cc
+14
-7
modules/prediction/container/obstacles/obstacles_container.h
modules/prediction/container/obstacles/obstacles_container.h
+6
-1
modules/prediction/container/obstacles/obstacles_container_test.cc
...rediction/container/obstacles/obstacles_container_test.cc
+10
-0
未找到文件。
modules/prediction/common/prediction_gflags.cc
浏览文件 @
7ec7edcd
...
...
@@ -34,6 +34,10 @@ DEFINE_double(double_precision, 1e-6, "precision of double");
DEFINE_double
(
min_prediction_length
,
5.0
,
"Minimal length of prediction trajectory"
);
// Bag replay timestamp gap
DEFINE_double
(
replay_timestamp_gap
,
10.0
,
"Max timestamp gap for rosbag replay"
);
// Map
DEFINE_double
(
search_radius
,
3.0
,
"Search radius for a candidate lane"
);
...
...
@@ -72,7 +76,7 @@ DEFINE_double(still_speed, 0.01, "speed considered to be still");
DEFINE_string
(
vehicle_model_file
,
"modules/prediction/data/mlp_vehicle_model.bin"
,
"Vehicle model file"
);
DEFINE_int32
(
max_num_obstacles
_stored
,
100
,
DEFINE_int32
(
max_num_obstacles
,
100
,
"maximal number of obstacles stored in obstacles container."
);
// Obstacle trajectory
...
...
modules/prediction/common/prediction_gflags.h
浏览文件 @
7ec7edcd
...
...
@@ -29,6 +29,9 @@ DECLARE_double(prediction_freq);
DECLARE_double
(
double_precision
);
DECLARE_double
(
min_prediction_length
);
// Bag replay timestamp gap
DECLARE_double
(
replay_timestamp_gap
);
// Map
DECLARE_double
(
search_radius
);
...
...
@@ -57,7 +60,7 @@ DECLARE_double(prediction_pedestrian_total_time);
DECLARE_int32
(
num_trajectory_still_pedestrian
);
DECLARE_double
(
still_speed
);
DECLARE_string
(
vehicle_model_file
);
DECLARE_int32
(
max_num_obstacles
_stored
);
DECLARE_int32
(
max_num_obstacles
);
// Obstacle trajectory
DECLARE_double
(
lane_sequence_threshold
);
...
...
modules/prediction/container/obstacles/obstacles_container.cc
浏览文件 @
7ec7edcd
...
...
@@ -30,19 +30,21 @@ using apollo::perception::PerceptionObstacles;
std
::
mutex
ObstaclesContainer
::
g_mutex_
;
ObstaclesContainer
::
ObstaclesContainer
()
:
obstacles_
(
FLAGS_max_num_obstacles
_stored
)
{}
:
obstacles_
(
FLAGS_max_num_obstacles
)
{}
void
ObstaclesContainer
::
Insert
(
const
::
google
::
protobuf
::
Message
&
message
)
{
ADEBUG
<<
"message: "
<<
message
.
ShortDebugString
();
const
PerceptionObstacles
&
perception_obstacles
=
dynamic_cast
<
const
PerceptionObstacles
&>
(
message
);
ADEBUG
<<
"perception obstacles: "
<<
perception_obstacles
.
ShortDebugString
();
double
timestamp
=
0.0
;
if
(
perception_obstacles
.
has_header
()
&&
perception_obstacles
.
header
().
has_timestamp_sec
())
{
timestamp
=
perception_obstacles
.
header
().
timestamp_sec
();
}
if
(
timestamp
<
timestamp_
)
{
if
(
timestamp
<=
timestamp_
-
FLAGS_replay_timestamp_gap
)
{
obstacles_
.
Clear
();
ADEBUG
<<
"Replay mode is enabled."
;
}
else
if
(
timestamp
<=
timestamp_
)
{
AERROR
<<
"Invalid timestamp curr ["
<<
timestamp
<<
"] v.s. prev ["
<<
timestamp_
<<
"]."
;
return
;
...
...
@@ -52,11 +54,11 @@ void ObstaclesContainer::Insert(const ::google::protobuf::Message& message) {
ADEBUG
<<
"Current timestamp is ["
<<
timestamp_
<<
"]"
;
for
(
const
PerceptionObstacle
&
perception_obstacle
:
perception_obstacles
.
perception_obstacle
())
{
ADEBUG
<<
"Perception obstacle ["
<<
perception_obstacle
.
id
()
<<
"]"
<<
"
was detected"
;
ADEBUG
<<
"Perception obstacle ["
<<
perception_obstacle
.
id
()
<<
"]
"
<<
"was detected"
;
InsertPerceptionObstacle
(
perception_obstacle
,
timestamp_
);
ADEBUG
<<
"Perception obstacle ["
<<
perception_obstacle
.
id
()
<<
"]"
<<
"
was inserted"
;
ADEBUG
<<
"Perception obstacle ["
<<
perception_obstacle
.
id
()
<<
"]
"
<<
"was inserted"
;
}
}
...
...
@@ -64,6 +66,11 @@ Obstacle* ObstaclesContainer::GetObstacle(const int id) {
return
obstacles_
.
GetSilently
(
id
);
}
void
ObstaclesContainer
::
Clear
()
{
obstacles_
.
Clear
();
timestamp_
=
-
1.0
;
}
void
ObstaclesContainer
::
InsertPerceptionObstacle
(
const
PerceptionObstacle
&
perception_obstacle
,
const
double
timestamp
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
g_mutex_
);
...
...
modules/prediction/container/obstacles/obstacles_container.h
浏览文件 @
7ec7edcd
...
...
@@ -66,6 +66,11 @@ class ObstaclesContainer : public Container {
*/
Obstacle
*
GetObstacle
(
const
int
id
);
/**
* @brief Clear obstacle container
*/
void
Clear
();
private:
/**
* @brief Check if an obstacle is predictable
...
...
@@ -75,7 +80,7 @@ class ObstaclesContainer : public Container {
bool
IsPredictable
(
const
perception
::
PerceptionObstacle
&
perception_obstacle
);
private:
double
timestamp_
=
0
.0
;
double
timestamp_
=
-
1
.0
;
common
::
util
::
LRUCache
<
int
,
Obstacle
>
obstacles_
;
static
std
::
mutex
g_mutex_
;
};
...
...
modules/prediction/container/obstacles/obstacles_container_test.cc
浏览文件 @
7ec7edcd
...
...
@@ -81,5 +81,15 @@ TEST_F(ObstaclesContainerTest, Pedestrian) {
EXPECT_TRUE
(
obstacle_ptr103
==
nullptr
);
}
TEST_F
(
ObstaclesContainerTest
,
ClearAll
)
{
container_
.
Clear
();
EXPECT_TRUE
(
container_
.
GetObstacle
(
0
)
==
nullptr
);
EXPECT_TRUE
(
container_
.
GetObstacle
(
1
)
==
nullptr
);
EXPECT_TRUE
(
container_
.
GetObstacle
(
2
)
==
nullptr
);
EXPECT_TRUE
(
container_
.
GetObstacle
(
3
)
==
nullptr
);
EXPECT_TRUE
(
container_
.
GetObstacle
(
101
)
==
nullptr
);
EXPECT_TRUE
(
container_
.
GetObstacle
(
102
)
==
nullptr
);
}
}
// namespace prediction
}
// namespace apollo
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录