Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
94f110ee
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,发现更多精彩内容 >>
提交
94f110ee
编写于
11月 16, 2017
作者:
J
jiangyifei
提交者:
Jiangtao Hu
11月 16, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tools: added routing display in mobileye viewer.
上级
010cb6da
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
80 addition
and
3 deletion
+80
-3
modules/tools/mobileye_viewer/plot_mobileye.py
modules/tools/mobileye_viewer/plot_mobileye.py
+5
-2
modules/tools/mobileye_viewer/routing_data.py
modules/tools/mobileye_viewer/routing_data.py
+44
-0
modules/tools/mobileye_viewer/view_subplot.py
modules/tools/mobileye_viewer/view_subplot.py
+31
-1
未找到文件。
modules/tools/mobileye_viewer/plot_mobileye.py
浏览文件 @
94f110ee
...
...
@@ -17,6 +17,7 @@
###############################################################################
import
rospy
import
json
import
argparse
import
matplotlib.pyplot
as
plt
import
matplotlib.animation
as
animation
...
...
@@ -25,6 +26,7 @@ from modules.drivers.proto import mobileye_pb2
from
mobileye_data
import
MobileyeData
from
localization_data
import
LocalizationData
from
planning_data
import
PlanningData
from
routing_data
import
RoutingData
from
chassis_data
import
ChassisData
from
view_subplot
import
ViewSubplot
from
subplot_s_speed
import
SubplotSSpeed
...
...
@@ -39,10 +41,11 @@ mobileye = MobileyeData()
localization
=
LocalizationData
()
planning
=
PlanningData
()
chassis
=
ChassisData
()
routing_data
=
RoutingData
()
def
update
(
frame_number
):
view_subplot
.
show
(
mobileye
,
localization
,
planning
,
chassis
)
view_subplot
.
show
(
mobileye
,
localization
,
planning
,
chassis
,
routing_data
)
s_speed_subplot
.
show
(
planning
)
s_theta_subplot
.
show
(
planning
)
s_time_subplot
.
show
(
planning
)
...
...
@@ -70,7 +73,7 @@ def chassis_callback(chassis_pb):
def
routing_callback
(
routing_str
):
pass
routing_data
.
update
(
routing_str
)
def
add_listener
():
...
...
modules/tools/mobileye_viewer/routing_data.py
0 → 100644
浏览文件 @
94f110ee
#!/usr/bin/env python
###############################################################################
# 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.
###############################################################################
import
threading
import
json
class
RoutingData
:
def
__init__
(
self
,
routing_str
=
None
):
self
.
routing_str
=
routing_str
self
.
routing_data_lock
=
threading
.
Lock
()
self
.
routing_x
=
[]
self
.
routing_y
=
[]
def
update
(
self
,
routing_str
):
self
.
routing_str
=
routing_str
routing_json
=
json
.
loads
(
routing_str
.
data
)
routing_x
=
[]
routing_y
=
[]
for
step
in
routing_json
:
points
=
step
[
'polyline'
][
'points'
]
for
point
in
points
:
routing_x
.
append
(
point
[
0
])
routing_y
.
append
(
point
[
1
])
self
.
routing_data_lock
.
acquire
()
self
.
routing_x
=
routing_x
self
.
routing_y
=
routing_y
self
.
routing_data_lock
.
release
()
modules/tools/mobileye_viewer/view_subplot.py
浏览文件 @
94f110ee
...
...
@@ -33,6 +33,8 @@ class ViewSubplot:
self
.
vehicle
=
ax
.
plot
(
[
-
1.055
,
1.055
,
1.055
,
-
1.055
,
-
1.055
],
[
0
,
0
,
-
4.933
,
-
4.933
,
0
],
'r-'
,
lw
=
1
)
self
.
routing
,
=
ax
.
plot
(
[
0
],
[
0
],
'r--'
,
lw
=
3
,
alpha
=
0.8
)
self
.
speed_line
,
=
ax
.
plot
([
0
],
[
0
],
'r-'
,
lw
=
3
,
alpha
=
0.4
)
self
.
acc_line
,
=
ax
.
plot
([
0
],
[
0
],
'y-'
,
lw
=
3
,
alpha
=
1
)
...
...
@@ -51,7 +53,7 @@ class ViewSubplot:
self
.
ref_lane
.
set_visible
(
False
)
def
show
(
self
,
mobileye_data
,
localization_data
,
planning_data
,
chassis_data
):
chassis_data
,
routing_data
):
self
.
left_lane
.
set_visible
(
True
)
self
.
right_lane
.
set_visible
(
True
)
self
.
ref_lane
.
set_visible
(
True
)
...
...
@@ -89,6 +91,34 @@ class ViewSubplot:
if
localization_data
.
localization_pb
is
None
:
return
vx
=
localization_data
.
localization_pb
.
pose
.
position
.
x
vy
=
localization_data
.
localization_pb
.
pose
.
position
.
y
routing_data
.
routing_data_lock
.
acquire
()
path_x
=
[
x
-
vx
for
x
in
routing_data
.
routing_x
]
path_y
=
[
y
-
vy
for
y
in
routing_data
.
routing_y
]
routing_data
.
routing_data_lock
.
release
()
heading
=
localization_data
.
localization_pb
.
pose
.
heading
npath_x
=
[]
npath_y
=
[]
for
i
in
range
(
len
(
path_x
)):
x
=
path_x
[
i
]
y
=
path_y
[
i
]
# newx = x * math.cos(heading) - y * math.sin(heading)
# newy = y * math.cos(heading) + x * math.sin(heading)
newx
=
x
*
math
.
cos
(
-
heading
+
1.570796
)
-
y
*
math
.
sin
(
-
heading
+
1.570796
)
newy
=
y
*
math
.
cos
(
-
heading
+
1.570796
)
+
x
*
math
.
sin
(
-
heading
+
1.570796
)
npath_x
.
append
(
newx
)
npath_y
.
append
(
newy
)
self
.
routing
.
set_xdata
(
npath_x
)
self
.
routing
.
set_ydata
(
npath_y
)
speed_x
=
localization_data
.
localization_pb
.
pose
.
linear_velocity
.
x
speed_y
=
localization_data
.
localization_pb
.
pose
.
linear_velocity
.
y
acc_x
=
localization_data
.
localization_pb
.
pose
.
linear_acceleration
.
x
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录