Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
dfad11dd
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,发现更多精彩内容 >>
提交
dfad11dd
编写于
9月 12, 2017
作者:
V
Vivian Lin
提交者:
siyangy
9月 12, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dreamview: refactored map element request (#1718)
上级
94082fb9
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
62 addition
and
22 deletion
+62
-22
modules/dreamview/backend/simulation_world/simulation_world_service.cc
...view/backend/simulation_world/simulation_world_service.cc
+14
-8
modules/dreamview/backend/simulation_world/simulation_world_service.h
...mview/backend/simulation_world/simulation_world_service.h
+8
-0
modules/dreamview/backend/simulation_world/simulation_world_updater.cc
...view/backend/simulation_world/simulation_world_updater.cc
+13
-3
modules/dreamview/frontend/dist/app.bundle.js
modules/dreamview/frontend/dist/app.bundle.js
+18
-4
modules/dreamview/frontend/dist/app.bundle.js.map
modules/dreamview/frontend/dist/app.bundle.js.map
+1
-1
modules/dreamview/frontend/src/renderer/map.js
modules/dreamview/frontend/src/renderer/map.js
+1
-2
modules/dreamview/frontend/src/store/websocket.js
modules/dreamview/frontend/src/store/websocket.js
+7
-4
未找到文件。
modules/dreamview/backend/simulation_world/simulation_world_service.cc
浏览文件 @
dfad11dd
...
...
@@ -326,6 +326,15 @@ Json SimulationWorldService::GetUpdateAsJson(double radius) const {
std
::
string
sim_world_json
;
::
google
::
protobuf
::
util
::
MessageToJsonString
(
world_
,
&
sim_world_json
);
Json
update
=
GetMapElements
(
radius
);
update
[
"type"
]
=
"sim_world_update"
;
update
[
"timestamp"
]
=
apollo
::
common
::
time
::
AsInt64
<
millis
>
(
Clock
::
Now
());
update
[
"world"
]
=
Json
::
parse
(
sim_world_json
);
return
update
;
}
Json
SimulationWorldService
::
GetMapElements
(
double
radius
)
const
{
// Gather required map element ids based on current location.
apollo
::
common
::
PointENU
point
;
point
.
set_x
(
world_
.
auto_driving_car
().
position_x
());
...
...
@@ -334,15 +343,12 @@ Json SimulationWorldService::GetUpdateAsJson(double radius) const {
MapElementIds
map_element_ids
=
map_service_
->
CollectMapElementIds
(
point
,
radius
);
Json
update
;
update
[
"type"
]
=
"sim_world_update"
;
update
[
"timestamp"
]
=
apollo
::
common
::
time
::
AsInt64
<
millis
>
(
Clock
::
Now
());
update
[
"world"
]
=
Json
::
parse
(
sim_world_json
);
update
[
"mapElementIds"
]
=
map_element_ids
.
Json
();
update
[
"mapHash"
]
=
map_element_ids
.
Hash
();
update
[
"radius"
]
=
radius
;
Json
map
;
map
[
"mapElementIds"
]
=
map_element_ids
.
Json
();
map
[
"mapHash"
]
=
map_element_ids
.
Hash
();
map
[
"mapRadius"
]
=
radius
;
return
update
;
return
map
;
}
template
<
>
...
...
modules/dreamview/backend/simulation_world/simulation_world_service.h
浏览文件 @
dfad11dd
...
...
@@ -79,6 +79,14 @@ class SimulationWorldService {
*/
nlohmann
::
json
GetUpdateAsJson
(
double
radius
)
const
;
/**
* @brief Returns the json representation of the map element Ids and hash
* within the given radious from the car.
* @param radius the search distance from the current car location
* @return Json object that contains mapElementIds and mapHash.
*/
nlohmann
::
json
GetMapElements
(
double
radius
)
const
;
/**
* @brief The function Update() is periodically called to check for updates
* from the adapters. All the updates will be written to the SimulationWorld
...
...
modules/dreamview/backend/simulation_world/simulation_world_updater.cc
浏览文件 @
dfad11dd
...
...
@@ -67,9 +67,11 @@ SimulationWorldUpdater::SimulationWorldUpdater(WebSocketHandler *websocket,
auto
radius
=
json
.
find
(
"radius"
);
if
(
radius
==
json
.
end
())
{
AERROR
<<
"Cannot retrieve map elements with unknown radius."
;
return
;
}
auto
response
=
sim_world_service_
.
GetUpdateAsJson
(
*
radius
);
Json
response
=
sim_world_service_
.
GetMapElements
(
*
radius
);
response
[
"type"
]
=
"MapElements"
;
websocket_
->
SendData
(
conn
,
response
.
dump
());
});
...
...
@@ -87,8 +89,8 @@ SimulationWorldUpdater::SimulationWorldUpdater(WebSocketHandler *websocket,
// Publish monitor message.
if
(
succeed
)
{
sim_world_service_
.
PublishMonitorMessage
(
MonitorMessageItem
::
INFO
,
"Routing Request Sent"
);
sim_world_service_
.
PublishMonitorMessage
(
MonitorMessageItem
::
INFO
,
"Routing Request Sent"
);
}
else
{
sim_world_service_
.
PublishMonitorMessage
(
MonitorMessageItem
::
ERROR
,
"Failed to send routing request"
);
...
...
@@ -117,6 +119,14 @@ SimulationWorldUpdater::SimulationWorldUpdater(WebSocketHandler *websocket,
bool
SimulationWorldUpdater
::
ConstructRoutingRequest
(
const
Json
&
json
,
RoutingRequest
*
routing_request
)
{
// Input validations
if
(
json
.
find
(
"start"
)
==
json
.
end
()
||
json
.
find
(
"end"
)
==
json
.
end
()
||
json
.
find
(
"sendDefaultRoute"
)
==
json
.
end
())
{
AERROR
<<
"Cannot prepare a routing request: input validation failed."
;
return
false
;
}
// Try to reload end point if it hasn't be loaded yet.
if
(
!
default_end_point_
.
has_id
()
&&
!
GetProtoFromASCIIFile
(
EndWayPointFile
(),
&
default_end_point_
))
{
...
...
modules/dreamview/frontend/dist/app.bundle.js
浏览文件 @
dfad11dd
此差异已折叠。
点击以展开。
modules/dreamview/frontend/dist/app.bundle.js.map
浏览文件 @
dfad11dd
此差异已折叠。
点击以展开。
modules/dreamview/frontend/src/renderer/map.js
浏览文件 @
dfad11dd
...
...
@@ -283,8 +283,6 @@ export default class Map {
// side. This also means that the server should maintain a state of
// (possibly) visible elements, presummably in the global store.
appendMapData
(
newData
,
coordinates
,
scene
)
{
const
overlapMap
=
extractOverlaps
(
newData
[
'
overlap
'
]);
for
(
const
kind
in
newData
)
{
if
(
!
this
.
data
[
kind
])
{
this
.
data
[
kind
]
=
[];
...
...
@@ -305,6 +303,7 @@ export default class Map {
}));
break
;
case
"
signal
"
:
const
overlapMap
=
extractOverlaps
(
newData
[
'
overlap
'
]);
this
.
data
[
kind
].
push
(
Object
.
assign
(
newData
[
kind
][
i
],
{
drewObjects
:
addTrafficLight
(
newData
[
kind
][
i
],
overlapMap
,
this
.
laneHeading
,
coordinates
,
scene
)
...
...
modules/dreamview/frontend/src/store/websocket.js
浏览文件 @
dfad11dd
...
...
@@ -37,16 +37,19 @@ class WebSocketEndpoint {
RENDERER
.
updateWorld
(
message
.
world
);
STORE
.
meters
.
update
(
message
.
world
);
STORE
.
monitor
.
update
(
message
.
world
);
if
((
message
.
mapHash
&&
(
this
.
counter
%
10
===
0
))
||
this
.
currMapRadius
!==
message
.
radius
)
{
if
(
message
.
mapHash
&&
(
this
.
counter
%
10
===
0
))
{
// NOTE: This is a hack to limit the rate of map updates.
this
.
counter
=
0
;
this
.
currMapRadius
=
message
.
r
adius
;
this
.
currMapRadius
=
message
.
mapR
adius
;
RENDERER
.
updateMapIndex
(
message
.
mapHash
,
message
.
mapElementIds
,
message
.
r
adius
);
message
.
mapElementIds
,
message
.
mapR
adius
);
}
this
.
counter
+=
1
;
break
;
case
"
MapElements
"
:
RENDERER
.
updateMapIndex
(
message
.
mapHash
,
message
.
mapElementIds
,
message
.
mapRadius
);
break
;
case
"
MapData
"
:
RENDERER
.
updateMap
(
message
.
data
);
STORE
.
setInitializationStatus
(
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录