Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
8a75dbac
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,发现更多精彩内容 >>
提交
8a75dbac
编写于
5月 11, 2018
作者:
G
gchen-apollo
提交者:
GitHub
5月 11, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine 3d motion and plot trajecktory (#4150)
上级
b92894bf
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
20 deletion
+41
-20
modules/perception/conf/dag_camera_obstacle_lane_motion_vis.config
...erception/conf/dag_camera_obstacle_lane_motion_vis.config
+2
-2
modules/perception/obstacle/camera/visualizer/glfw_fusion_viewer.cc
...rception/obstacle/camera/visualizer/glfw_fusion_viewer.cc
+33
-13
modules/perception/obstacle/camera/visualizer/glfw_fusion_viewer.h
...erception/obstacle/camera/visualizer/glfw_fusion_viewer.h
+4
-3
modules/perception/obstacle/onboard/motion_service.cc
modules/perception/obstacle/onboard/motion_service.cc
+2
-2
未找到文件。
modules/perception/conf/dag_camera_obstacle_lane_motion_vis.config
浏览文件 @
8a75dbac
...
...
@@ -30,8 +30,8 @@ subnode_config {
subnodes
{
id
:
41
name
:
"VisualizationSubnode"
reserve
:
"vis_driven_event_id:1012;camera_event_id:1008;lane_event_id:1012"
#
reserve: "vis_driven_event_id:1012;camera_event_id:1008;motion_event_id:1020;lane_event_id:1012"
#
reserve: "vis_driven_event_id:1012;camera_event_id:1008;lane_event_id:1012"
reserve
:
"vis_driven_event_id:1012;camera_event_id:1008;motion_event_id:1020;lane_event_id:1012"
type
:
SUBNODE_OUT
}
}
...
...
modules/perception/obstacle/camera/visualizer/glfw_fusion_viewer.cc
浏览文件 @
8a75dbac
...
...
@@ -585,6 +585,11 @@ void GLFWFusionViewer::render() {
lane_objects_
=
std
::
make_shared
<
LaneObjects
>
(
frame_content_
->
get_lane_objects
());
if
(
draw_lane_objects_
)
{
const
MotionBuffer
&
motion_buffer
=
frame_content_
->
get_motion_buffer
();
int
n
=
motion_buffer
.
size
();
if
(
n
>
0
)
{
motion_matrix_
=
motion_buffer
[
n
-
1
].
motion
;
}
draw_lane_objects_ground
();
}
}
...
...
@@ -1023,6 +1028,7 @@ void GLFWFusionViewer::draw_lane_objects_ground() {
// }
while
(
lane_history_
->
size
()
<
lane_objects_
->
size
())
{
lane_history_
->
push_back
(
LaneObject
());
z_history_
.
push_back
(
std
::
vector
<
float
>
());
}
}
for
(
size_t
k
=
0
;
k
<
lane_objects_
->
size
();
++
k
)
{
...
...
@@ -1033,19 +1039,24 @@ void GLFWFusionViewer::draw_lane_objects_ground() {
if
(
FLAGS_show_motion_track
)
{
auto
&
lane_history_pos
=
lane_history_
->
at
(
k
).
pos
;
auto
&
lane_z_history
=
z_history_
.
at
(
k
);
// update lane history by projecting motion
for
(
auto
&
p
:
lane_history_pos
)
{
// for (auto& p : lane_history_pos) {
for
(
int
i
=
0
;
i
<
lane_history_pos
.
size
();
i
++
)
{
auto
&
p
=
lane_history_pos
[
i
];
auto
&
z
=
lane_z_history
[
i
];
Eigen
::
VectorXf
point_h
=
Eigen
::
VectorXf
::
Zero
(
motion_matrix_
.
cols
());
point_h
[
0
]
=
p
[
0
];
point_h
[
1
]
=
p
[
1
];
point_h
[
2
]
=
z
;
point_h
[
motion_matrix_
.
cols
()
-
1
]
=
1.0
;
Eigen
::
Vector2f
proj_h
;
project_point
(
point_h
,
&
proj_h
,
motion_matrix_
);
p
[
0
]
=
proj_h
[
0
];
p
[
1
]
=
proj_h
[
1
];
z
=
project_point
(
point_h
,
&
proj_h
,
motion_matrix_
);
p
=
proj_h
;
}
AINFO
<<
"lane_history_pos.size(): "
<<
lane_history_pos
.
size
();
// add new point
for
(
auto
p
=
lane_objects_
->
at
(
k
).
pos
.
begin
();
p
!=
lane_objects_
->
at
(
k
).
pos
.
end
();
++
p
)
{
...
...
@@ -1053,17 +1064,22 @@ void GLFWFusionViewer::draw_lane_objects_ground() {
point_poly
[
1
]
=
GetPolyValue
(
a
,
b
,
c
,
d
,
point_poly
[
0
]);
lane_history_pos
.
push_back
(
point_poly
);
lane_z_history
.
push_back
(
0
);
if
(
lane_history_pos
.
size
()
>
lane_history_buffer_size_
)
{
lane_history_pos
.
erase
(
lane_history_pos
.
begin
());
lane_z_history
.
erase
(
lane_z_history
.
begin
());
}
}
glColor3f
(
1.0
f
,
0.0
f
,
0.0
f
);
// red
//
glColor3f(1.0f, 0.0f, 0.0f); // red
glLineWidth
(
1
);
glBegin
(
GL_LINE_STRIP
);
for
(
auto
p
:
lane_history_pos
)
{
for
(
int
i
=
0
;
i
<
lane_history_pos
.
size
();
i
++
)
{
auto
&
p
=
lane_history_pos
[
i
];
auto
&
z
=
lane_z_history
[
i
];
// glVertex2f(p[0], p[1]);
drawHollowCircle
(
p
[
0
],
p
[
1
],
0.2
);
drawHollowCircle
(
p
[
0
],
p
[
1
],
0.2
,
z
);
// AINFO << "("<<p[0] << ", "<< p[1] << "), ";
}
glEnd
();
glFlush
();
...
...
@@ -1855,7 +1871,8 @@ void drawHollowCircle(GLfloat x, GLfloat y, GLfloat radius) {
}
*/
void
GLFWFusionViewer
::
drawHollowCircle
(
GLfloat
x
,
GLfloat
y
,
GLfloat
radius
)
{
void
GLFWFusionViewer
::
drawHollowCircle
(
GLfloat
x
,
GLfloat
y
,
GLfloat
radius
,
GLfloat
z
)
{
// number of triangles used to draw circle
GLfloat
lineAmount
=
100.0
f
;
...
...
@@ -1863,19 +1880,21 @@ void GLFWFusionViewer::drawHollowCircle(GLfloat x, GLfloat y, GLfloat radius) {
glBegin
(
GL_LINE_LOOP
);
for
(
GLfloat
i
=
0.0
f
;
i
<=
lineAmount
;
i
++
)
{
glVertex2f
(
x
+
(
radius
*
cos
(
i
*
twicePi
/
lineAmount
)),
y
+
(
radius
*
sin
(
i
*
twicePi
/
lineAmount
)));
glVertex3f
(
x
+
(
radius
*
cos
(
i
*
twicePi
/
lineAmount
)),
y
+
(
radius
*
sin
(
i
*
twicePi
/
lineAmount
)),
z
);
}
glEnd
();
}
void
GLFWFusionViewer
::
project_point
(
const
Eigen
::
VectorXf
&
in
,
float
GLFWFusionViewer
::
project_point
(
const
Eigen
::
VectorXf
&
in
,
Eigen
::
Vector2f
*
out
,
const
MotionType
&
motion_matrix
)
{
CHECK
(
in
.
rows
()
==
motion_matrix
.
cols
());
CHECK_GT
(
in
.
rows
(),
2
);
Eigen
::
VectorXf
proj
=
motion_matrix
*
in
;
*
out
<<
proj
[
0
],
proj
[
1
];
return
proj
[
2
];
}
void
GLFWFusionViewer
::
draw_car_trajectory
(
FrameContent
*
content
)
{
...
...
@@ -1890,8 +1909,9 @@ void GLFWFusionViewer::draw_car_trajectory(FrameContent* content) {
// Eigen::Matrix3f tmp = motion_buffer[i].motion;
// point = tmp * center;
Eigen
::
Vector2f
point
;
project_point
(
center
,
&
point
,
motion_buffer
[
i
].
motion
);
drawHollowCircle
(
point
(
0
),
point
(
1
),
0.2
);
float
z
=
project_point
(
center
,
&
point
,
motion_buffer
[
i
].
motion
);
drawHollowCircle
(
point
(
0
),
point
(
1
),
0.2
,
z
*
10
);
// AINFO << "Z value is: "<< z;
glFlush
();
}
}
...
...
modules/perception/obstacle/camera/visualizer/glfw_fusion_viewer.h
浏览文件 @
8a75dbac
...
...
@@ -137,7 +137,7 @@ class GLFWFusionViewer {
void
render
();
void
project_point
(
const
Eigen
::
VectorXf
&
in
,
Eigen
::
Vector2f
*
out
,
float
project_point
(
const
Eigen
::
VectorXf
&
in
,
Eigen
::
Vector2f
*
out
,
const
MotionType
&
motion_matrix
);
protected:
...
...
@@ -149,7 +149,7 @@ class GLFWFusionViewer {
void
draw_car_trajectory
(
FrameContent
*
content
);
void
draw_trajectories
(
FrameContent
*
content
);
void
drawHollowCircle
(
GLfloat
x
,
GLfloat
y
,
GLfloat
radius
);
void
drawHollowCircle
(
GLfloat
x
,
GLfloat
y
,
GLfloat
radius
,
GLfloat
z
=
0
);
// for drawing camera 2d results
protected:
...
...
@@ -313,8 +313,9 @@ class GLFWFusionViewer {
float
lane_map_scale_
;
LaneObjectsPtr
lane_history_
;
std
::
vector
<
std
::
vector
<
float
>>
z_history_
;
// std::vector<LaneObjects> Lane_history_buffer_;
const
std
::
size_t
lane_history_buffer_size_
=
400
;
const
std
::
size_t
lane_history_buffer_size_
=
400
00
;
const
std
::
size_t
object_history_size_
=
5
;
MotionType
motion_matrix_
;
// pin-hole camera model with distortion
...
...
modules/perception/obstacle/onboard/motion_service.cc
浏览文件 @
8a75dbac
...
...
@@ -94,8 +94,8 @@ void MotionService::OnLocalization(
vehicle_status
.
time_ts
=
0
;
}
else
{
vehicle_status
.
roll_rate
=
localization
.
pose
().
angular_velocity_vrf
().
x
();
vehicle_status
.
pitch_rate
=
localization
.
pose
().
angular_velocity_vrf
().
y
();
vehicle_status
.
roll_rate
=
localization
.
pose
().
angular_velocity_vrf
().
y
();
vehicle_status
.
pitch_rate
=
-
localization
.
pose
().
angular_velocity_vrf
().
x
();
vehicle_status
.
yaw_rate
=
localization
.
pose
().
angular_velocity_vrf
().
z
();
timestamp_diff
=
localization
.
measurement_time
()
-
pre_timestamp_
;
vehicle_status
.
time_d
=
timestamp_diff
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录