Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
7a706633
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,发现更多精彩内容 >>
提交
7a706633
编写于
2月 08, 2018
作者:
S
siyangy
提交者:
Jiangtao Hu
2月 08, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
send route_path separately
上级
d5736eb4
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
85 addition
and
21 deletion
+85
-21
modules/dreamview/backend/common/dreamview_gflags.cc
modules/dreamview/backend/common/dreamview_gflags.cc
+6
-1
modules/dreamview/backend/common/dreamview_gflags.h
modules/dreamview/backend/common/dreamview_gflags.h
+4
-0
modules/dreamview/backend/handlers/websocket.cc
modules/dreamview/backend/handlers/websocket.cc
+1
-0
modules/dreamview/backend/simulation_world/simulation_world_service.cc
...view/backend/simulation_world/simulation_world_service.cc
+31
-5
modules/dreamview/backend/simulation_world/simulation_world_service.h
...mview/backend/simulation_world/simulation_world_service.h
+6
-1
modules/dreamview/backend/simulation_world/simulation_world_updater.cc
...view/backend/simulation_world/simulation_world_updater.cc
+9
-1
modules/dreamview/frontend/dist/app.bundle.js
modules/dreamview/frontend/dist/app.bundle.js
+2
-2
modules/dreamview/frontend/dist/app.bundle.js.map
modules/dreamview/frontend/dist/app.bundle.js.map
+1
-1
modules/dreamview/frontend/src/renderer/index.js
modules/dreamview/frontend/src/renderer/index.js
+5
-1
modules/dreamview/frontend/src/renderer/map.js
modules/dreamview/frontend/src/renderer/map.js
+1
-1
modules/dreamview/frontend/src/renderer/routing.js
modules/dreamview/frontend/src/renderer/routing.js
+4
-8
modules/dreamview/frontend/src/store/websocket/websocket_realtime.js
...amview/frontend/src/store/websocket/websocket_realtime.js
+15
-0
未找到文件。
modules/dreamview/backend/common/dreamview_gflags.cc
浏览文件 @
7a706633
...
@@ -65,7 +65,12 @@ DEFINE_double(sim_map_radius, 300.0,
...
@@ -65,7 +65,12 @@ DEFINE_double(sim_map_radius, 300.0,
"elements around the car."
);
"elements around the car."
);
DEFINE_int32
(
dreamview_worker_num
,
3
,
"number of dreamview thread workers"
);
DEFINE_int32
(
dreamview_worker_num
,
3
,
"number of dreamview thread workers"
);
DEFINE_bool
(
enable_update_size_check
,
true
,
DEFINE_bool
(
enable_update_size_check
,
true
,
"True to check if the update byte number is less than threshold"
);
"True to check if the update byte number is less than threshold"
);
DEFINE_uint32
(
max_update_size
,
1000000
,
DEFINE_uint32
(
max_update_size
,
1000000
,
"number of max update bytes allowed to push to dreamview FE"
);
"Number of max update bytes allowed to push to dreamview FE"
);
DEFINE_bool
(
sim_world_with_routing_path
,
false
,
"Whether the routing_path is included in sim_world proto."
);
modules/dreamview/backend/common/dreamview_gflags.h
浏览文件 @
7a706633
...
@@ -44,7 +44,11 @@ DECLARE_string(ssl_certificate);
...
@@ -44,7 +44,11 @@ DECLARE_string(ssl_certificate);
DECLARE_double
(
sim_map_radius
);
DECLARE_double
(
sim_map_radius
);
DECLARE_int32
(
dreamview_worker_num
);
DECLARE_int32
(
dreamview_worker_num
);
DECLARE_bool
(
enable_update_size_check
);
DECLARE_bool
(
enable_update_size_check
);
DECLARE_uint32
(
max_update_size
);
DECLARE_uint32
(
max_update_size
);
DECLARE_bool
(
sim_world_with_routing_path
);
#endif // MODULES_DREAMVIEW_BACKEND_COMMON_DREAMVIEW_GFLAGS_H_
#endif // MODULES_DREAMVIEW_BACKEND_COMMON_DREAMVIEW_GFLAGS_H_
modules/dreamview/backend/handlers/websocket.cc
浏览文件 @
7a706633
...
@@ -116,6 +116,7 @@ bool WebSocketHandler::SendData(Connection *conn, const std::string &data,
...
@@ -116,6 +116,7 @@ bool WebSocketHandler::SendData(Connection *conn, const std::string &data,
}
}
}
}
}
}
// Note that while we are holding the connection lock, the connection won't be
// Note that while we are holding the connection lock, the connection won't be
// closed and removed.
// closed and removed.
int
ret
;
int
ret
;
...
...
modules/dreamview/backend/simulation_world/simulation_world_service.cc
浏览文件 @
7a706633
...
@@ -192,9 +192,7 @@ void UpdateTurnSignal(const apollo::common::VehicleSignal &signal,
...
@@ -192,9 +192,7 @@ void UpdateTurnSignal(const apollo::common::VehicleSignal &signal,
}
}
}
}
inline
double
SecToMs
(
const
double
sec
)
{
inline
double
SecToMs
(
const
double
sec
)
{
return
sec
*
1000.0
;
}
return
sec
*
1000.0
;
}
}
// namespace
}
// namespace
...
@@ -234,6 +232,9 @@ void SimulationWorldService::Update() {
...
@@ -234,6 +232,9 @@ void SimulationWorldService::Update() {
auto
car
=
world_
.
auto_driving_car
();
auto
car
=
world_
.
auto_driving_car
();
world_
.
Clear
();
world_
.
Clear
();
*
world_
.
mutable_auto_driving_car
()
=
car
;
*
world_
.
mutable_auto_driving_car
()
=
car
;
route_paths_
.
clear
();
to_clear_
=
false
;
to_clear_
=
false
;
}
}
...
@@ -303,7 +304,7 @@ Json SimulationWorldService::GetUpdateAsJson(double radius) const {
...
@@ -303,7 +304,7 @@ Json SimulationWorldService::GetUpdateAsJson(double radius) const {
}
}
void
SimulationWorldService
::
GetMapElementIds
(
double
radius
,
void
SimulationWorldService
::
GetMapElementIds
(
double
radius
,
MapElementIds
*
ids
)
{
MapElementIds
*
ids
)
const
{
// Gather required map element ids based on current location.
// Gather required map element ids based on current location.
apollo
::
common
::
PointENU
point
;
apollo
::
common
::
PointENU
point
;
const
auto
&
adc
=
world_
.
auto_driving_car
();
const
auto
&
adc
=
world_
.
auto_driving_car
();
...
@@ -850,6 +851,7 @@ void SimulationWorldService::UpdateSimulationWorld(
...
@@ -850,6 +851,7 @@ void SimulationWorldService::UpdateSimulationWorld(
}
}
world_
.
clear_route_path
();
world_
.
clear_route_path
();
route_paths_
.
clear
();
world_
.
set_routing_time
(
header_time
);
world_
.
set_routing_time
(
header_time
);
for
(
const
Path
&
path
:
paths
)
{
for
(
const
Path
&
path
:
paths
)
{
...
@@ -859,14 +861,38 @@ void SimulationWorldService::UpdateSimulationWorld(
...
@@ -859,14 +861,38 @@ void SimulationWorldService::UpdateSimulationWorld(
std
::
vector
<
int
>
sampled_indices
=
std
::
vector
<
int
>
sampled_indices
=
DownsampleByAngle
(
path
.
path_points
(),
angle_threshold
);
DownsampleByAngle
(
path
.
path_points
(),
angle_threshold
);
RoutePath
*
route_path
=
world_
.
add_route_path
();
route_paths_
.
emplace_back
();
RoutePath
*
route_path
=
&
route_paths_
.
back
();
for
(
int
index
:
sampled_indices
)
{
for
(
int
index
:
sampled_indices
)
{
const
auto
&
path_point
=
path
.
path_points
()[
index
];
const
auto
&
path_point
=
path
.
path_points
()[
index
];
PolygonPoint
*
route_point
=
route_path
->
add_point
();
PolygonPoint
*
route_point
=
route_path
->
add_point
();
route_point
->
set_x
(
path_point
.
x
()
+
map_service_
->
GetXOffset
());
route_point
->
set_x
(
path_point
.
x
()
+
map_service_
->
GetXOffset
());
route_point
->
set_y
(
path_point
.
y
()
+
map_service_
->
GetYOffset
());
route_point
->
set_y
(
path_point
.
y
()
+
map_service_
->
GetYOffset
());
}
}
// Populate route path
if
(
FLAGS_sim_world_with_routing_path
)
{
auto
*
new_path
=
world_
.
add_route_path
();
*
new_path
=
*
route_path
;
}
}
}
Json
SimulationWorldService
::
GetRoutePathAsJson
()
const
{
Json
response
;
response
[
"routingTime"
]
=
world_
.
routing_time
();
response
[
"routePath"
]
=
Json
::
array
();
for
(
const
auto
&
route_path
:
route_paths_
)
{
Json
path
;
path
[
"point"
]
=
Json
::
array
();
for
(
const
auto
&
route_point
:
route_path
.
point
())
{
path
[
"point"
].
push_back
({{
"x"
,
route_point
.
x
()},
{
"y"
,
route_point
.
y
()},
{
"z"
,
route_point
.
z
()}});
}
response
[
"routePath"
].
push_back
(
path
);
}
}
return
response
;
}
}
void
SimulationWorldService
::
ReadRoutingFromFile
(
void
SimulationWorldService
::
ReadRoutingFromFile
(
...
...
modules/dreamview/backend/simulation_world/simulation_world_service.h
浏览文件 @
7a706633
...
@@ -134,7 +134,9 @@ class SimulationWorldService {
...
@@ -134,7 +134,9 @@ class SimulationWorldService {
buffer
.
AddMonitorMsgItem
(
log_level
,
msg
);
buffer
.
AddMonitorMsgItem
(
log_level
,
msg
);
}
}
void
GetMapElementIds
(
double
radius
,
MapElementIds
*
ids
);
void
GetMapElementIds
(
double
radius
,
MapElementIds
*
ids
)
const
;
nlohmann
::
json
GetRoutePathAsJson
()
const
;
private:
private:
/**
/**
...
@@ -199,6 +201,9 @@ class SimulationWorldService {
...
@@ -199,6 +201,9 @@ class SimulationWorldService {
// SimulationWorldService instance.
// SimulationWorldService instance.
SimulationWorld
world_
;
SimulationWorld
world_
;
// Downsampled route paths to be rendered in frontend.
std
::
vector
<
RoutePath
>
route_paths_
;
// The handle of MapService, not owned by SimulationWorldService.
// The handle of MapService, not owned by SimulationWorldService.
const
MapService
*
map_service_
;
const
MapService
*
map_service_
;
...
...
modules/dreamview/backend/simulation_world/simulation_world_updater.cc
浏览文件 @
7a706633
...
@@ -43,8 +43,8 @@ SimulationWorldUpdater::SimulationWorldUpdater(WebSocketHandler *websocket,
...
@@ -43,8 +43,8 @@ SimulationWorldUpdater::SimulationWorldUpdater(WebSocketHandler *websocket,
bool
routing_from_file
)
bool
routing_from_file
)
:
sim_world_service_
(
map_service
,
routing_from_file
),
:
sim_world_service_
(
map_service
,
routing_from_file
),
map_service_
(
map_service
),
map_service_
(
map_service
),
map_ws_
(
map_ws
),
websocket_
(
websocket
),
websocket_
(
websocket
),
map_ws_
(
map_ws
),
sim_control_
(
sim_control
)
{
sim_control_
(
sim_control
)
{
RegisterMessageHandlers
();
RegisterMessageHandlers
();
}
}
...
@@ -149,6 +149,14 @@ void SimulationWorldUpdater::RegisterMessageHandlers() {
...
@@ -149,6 +149,14 @@ void SimulationWorldUpdater::RegisterMessageHandlers() {
websocket_
->
SendBinaryData
(
conn
,
to_send
,
true
);
websocket_
->
SendBinaryData
(
conn
,
to_send
,
true
);
});
});
websocket_
->
RegisterMessageHandler
(
"RequestRoutePath"
,
[
this
](
const
Json
&
json
,
WebSocketHandler
::
Connection
*
conn
)
{
Json
response
=
sim_world_service_
.
GetRoutePathAsJson
();
response
[
"type"
]
=
"RoutePath"
;
websocket_
->
SendData
(
conn
,
response
.
dump
());
});
websocket_
->
RegisterMessageHandler
(
websocket_
->
RegisterMessageHandler
(
"GetDefaultEndPoint"
,
"GetDefaultEndPoint"
,
[
this
](
const
Json
&
json
,
WebSocketHandler
::
Connection
*
conn
)
{
[
this
](
const
Json
&
json
,
WebSocketHandler
::
Connection
*
conn
)
{
...
...
modules/dreamview/frontend/dist/app.bundle.js
浏览文件 @
7a706633
此差异已折叠。
点击以展开。
modules/dreamview/frontend/dist/app.bundle.js.map
浏览文件 @
7a706633
此差异已折叠。
点击以展开。
modules/dreamview/frontend/src/renderer/index.js
浏览文件 @
7a706633
...
@@ -332,7 +332,7 @@ class Renderer {
...
@@ -332,7 +332,7 @@ class Renderer {
this
.
perceptionObstacles
.
update
(
world
,
this
.
coordinates
,
this
.
scene
);
this
.
perceptionObstacles
.
update
(
world
,
this
.
coordinates
,
this
.
scene
);
this
.
decision
.
update
(
world
,
this
.
coordinates
,
this
.
scene
);
this
.
decision
.
update
(
world
,
this
.
coordinates
,
this
.
scene
);
this
.
prediction
.
update
(
world
,
this
.
coordinates
,
this
.
scene
);
this
.
prediction
.
update
(
world
,
this
.
coordinates
,
this
.
scene
);
this
.
routing
.
update
(
world
,
this
.
coordinates
,
this
.
scene
);
this
.
updateRouting
(
world
.
routingTime
,
world
.
routePath
);
this
.
gnss
.
update
(
world
,
this
.
coordinates
,
this
.
scene
);
this
.
gnss
.
update
(
world
,
this
.
coordinates
,
this
.
scene
);
if
(
this
.
planningAdc
&&
if
(
this
.
planningAdc
&&
...
@@ -341,6 +341,10 @@ class Renderer {
...
@@ -341,6 +341,10 @@ class Renderer {
}
}
}
}
updateRouting
(
routingTime
,
routePath
)
{
this
.
routing
.
update
(
routingTime
,
routePath
,
this
.
coordinates
,
this
.
scene
);
}
updateGroundImage
(
mapName
)
{
updateGroundImage
(
mapName
)
{
this
.
ground
.
updateImage
(
mapName
);
this
.
ground
.
updateImage
(
mapName
);
}
}
...
...
modules/dreamview/frontend/src/renderer/map.js
浏览文件 @
7a706633
...
@@ -338,7 +338,7 @@ export default class Map {
...
@@ -338,7 +338,7 @@ export default class Map {
return
{
"
pos
"
:
position
,
"
heading
"
:
heading
};
return
{
"
pos
"
:
position
,
"
heading
"
:
heading
};
}
else
{
}
else
{
console
.
error
(
'
Error loading
traffic light
. Unable to determine heading.
'
);
console
.
error
(
'
Error loading
stop sign
. Unable to determine heading.
'
);
return
null
;
return
null
;
}
}
}
}
...
...
modules/dreamview/frontend/src/renderer/routing.js
浏览文件 @
7a706633
...
@@ -12,16 +12,16 @@ export default class Routing {
...
@@ -12,16 +12,16 @@ export default class Routing {
this
.
lastRoutingTime
=
-
1
;
this
.
lastRoutingTime
=
-
1
;
}
}
update
(
world
,
coordinates
,
scene
)
{
update
(
routingTime
,
routePath
,
coordinates
,
scene
)
{
this
.
routePaths
.
forEach
(
path
=>
{
this
.
routePaths
.
forEach
(
path
=>
{
path
.
visible
=
STORE
.
options
.
showRouting
;
path
.
visible
=
STORE
.
options
.
showRouting
;
});
});
// There has not been a new routing published since last time.
// There has not been a new routing published since last time.
if
(
this
.
lastRoutingTime
===
world
.
routingTime
)
{
if
(
this
.
lastRoutingTime
===
routingTime
||
routePath
===
undefined
)
{
return
;
return
;
}
}
this
.
lastRoutingTime
=
world
.
routingTime
;
this
.
lastRoutingTime
=
routingTime
;
// Clear the old route paths
// Clear the old route paths
this
.
routePaths
.
forEach
(
path
=>
{
this
.
routePaths
.
forEach
(
path
=>
{
...
@@ -30,11 +30,7 @@ export default class Routing {
...
@@ -30,11 +30,7 @@ export default class Routing {
path
.
geometry
.
dispose
();
path
.
geometry
.
dispose
();
});
});
if
(
world
.
routePath
===
undefined
)
{
routePath
.
forEach
(
path
=>
{
return
;
}
world
.
routePath
.
forEach
(
path
=>
{
const
points
=
coordinates
.
applyOffsetToArray
(
path
.
point
);
const
points
=
coordinates
.
applyOffsetToArray
(
path
.
point
);
const
pathMesh
=
drawThickBandFromPoints
(
points
,
0.3
/* width */
,
const
pathMesh
=
drawThickBandFromPoints
(
points
,
0.3
/* width */
,
0xFF0000
/* red */
,
0.6
,
5
/* z offset */
);
0xFF0000
/* red */
,
0.6
,
5
/* z offset */
);
...
...
modules/dreamview/frontend/src/store/websocket/websocket_realtime.js
浏览文件 @
7a706633
...
@@ -14,6 +14,7 @@ export default class RosWebSocketEndpoint {
...
@@ -14,6 +14,7 @@ export default class RosWebSocketEndpoint {
this
.
lastSeqNum
=
-
1
;
this
.
lastSeqNum
=
-
1
;
this
.
currMapRadius
=
null
;
this
.
currMapRadius
=
null
;
this
.
updatePOI
=
true
;
this
.
updatePOI
=
true
;
this
.
routingTime
=
-
1
;
}
}
initialize
()
{
initialize
()
{
...
@@ -71,6 +72,11 @@ export default class RosWebSocketEndpoint {
...
@@ -71,6 +72,11 @@ export default class RosWebSocketEndpoint {
RENDERER
.
updateMapIndex
(
message
.
mapHash
,
RENDERER
.
updateMapIndex
(
message
.
mapHash
,
message
.
mapElementIds
,
message
.
mapRadius
);
message
.
mapElementIds
,
message
.
mapRadius
);
}
}
if
(
this
.
routingTime
!==
message
.
routingTime
)
{
// A new routing needs to be fetched from backend.
this
.
requestRoutePath
();
this
.
routingTime
=
message
.
routingTime
;
}
this
.
counter
+=
1
;
this
.
counter
+=
1
;
break
;
break
;
case
"
MapElementIds
"
:
case
"
MapElementIds
"
:
...
@@ -80,6 +86,9 @@ export default class RosWebSocketEndpoint {
...
@@ -80,6 +86,9 @@ export default class RosWebSocketEndpoint {
case
"
DefaultEndPoint
"
:
case
"
DefaultEndPoint
"
:
STORE
.
routeEditingManager
.
updateDefaultRoutingEndPoint
(
message
);
STORE
.
routeEditingManager
.
updateDefaultRoutingEndPoint
(
message
);
break
;
break
;
case
"
RoutePath
"
:
RENDERER
.
updateRouting
(
message
.
routingTime
,
message
.
routePath
);
break
;
}
}
};
};
this
.
websocket
.
onclose
=
event
=>
{
this
.
websocket
.
onclose
=
event
=>
{
...
@@ -221,4 +230,10 @@ export default class RosWebSocketEndpoint {
...
@@ -221,4 +230,10 @@ export default class RosWebSocketEndpoint {
enable
:
enable
,
enable
:
enable
,
}));
}));
}
}
requestRoutePath
()
{
this
.
websocket
.
send
(
JSON
.
stringify
({
type
:
"
RequestRoutePath
"
,
}));
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录