Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
653d63f1
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,发现更多精彩内容 >>
提交
653d63f1
编写于
8月 16, 2017
作者:
S
siyangy
提交者:
Aaron Xiao
8月 16, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix flickered map and some minor optimization
上级
c4523b67
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
54 addition
and
40 deletion
+54
-40
modules/dreamview/backend/map/map_service.cc
modules/dreamview/backend/map/map_service.cc
+3
-3
modules/dreamview/backend/map/map_service.h
modules/dreamview/backend/map/map_service.h
+2
-2
modules/dreamview/backend/map/map_service_test.cc
modules/dreamview/backend/map/map_service_test.cc
+2
-2
modules/dreamview/backend/simulation_world/simulation_world_service.cc
...view/backend/simulation_world/simulation_world_service.cc
+6
-7
modules/dreamview/frontend/dist/app.bundle.js
modules/dreamview/frontend/dist/app.bundle.js
+9
-3
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
+2
-2
modules/dreamview/frontend/src/renderer/map.js
modules/dreamview/frontend/src/renderer/map.js
+27
-18
modules/dreamview/frontend/src/store/websocket.js
modules/dreamview/frontend/src/store/websocket.js
+2
-2
未找到文件。
modules/dreamview/backend/map/map_service.cc
浏览文件 @
653d63f1
...
...
@@ -127,8 +127,8 @@ nlohmann::json MapElementIds::Json() const {
MapService
::
MapService
(
const
std
::
string
&
map_filename
)
:
pnc_map_
(
map_filename
)
{}
MapElementIds
MapService
::
CollectMapElements
(
const
PointENU
&
point
,
double
radius
)
const
{
MapElementIds
MapService
::
CollectMapElement
Id
s
(
const
PointENU
&
point
,
double
radius
)
const
{
MapElementIds
result
;
std
::
vector
<
LaneInfoConstPtr
>
lanes
;
...
...
@@ -232,7 +232,7 @@ bool MapService::GetPointsFromRouting(const RoutingResponse &routing,
}
std
::
vector
<
int
>
sampled_indices
;
constexpr
double
angle_threshold
=
0.1
;
// threshold is about 5.72 degree.
constexpr
double
angle_threshold
=
0.1
;
// threshold is about 5.72 degree.
DownsampleByAngle
(
path
.
path_points
(),
angle_threshold
,
&
sampled_indices
);
for
(
int
index
:
sampled_indices
)
{
points
->
push_back
(
path
.
path_points
()[
index
]);
...
...
modules/dreamview/backend/map/map_service.h
浏览文件 @
653d63f1
...
...
@@ -62,8 +62,8 @@ struct MapElementIds {
class
MapService
{
public:
explicit
MapService
(
const
std
::
string
&
map_filename
);
MapElementIds
CollectMapElements
(
const
apollo
::
common
::
PointENU
&
point
,
double
raidus
)
const
;
MapElementIds
CollectMapElement
Id
s
(
const
apollo
::
common
::
PointENU
&
point
,
double
raidus
)
const
;
bool
GetPointsFromRouting
(
const
apollo
::
routing
::
RoutingResponse
&
routing
,
...
...
modules/dreamview/backend/map/map_service_test.cc
浏览文件 @
653d63f1
...
...
@@ -72,11 +72,11 @@ TEST_F(MapServiceTest, LoadMap) {
EXPECT_EQ
(
"l1"
,
map_service
.
hdmap
()
->
get_lane_by_id
(
id
)
->
id
().
id
());
}
TEST_F
(
MapServiceTest
,
CollectMapElements
)
{
TEST_F
(
MapServiceTest
,
CollectMapElement
Id
s
)
{
PointENU
p
;
p
.
set_x
(
0.0
);
p
.
set_y
(
0.0
);
MapElementIds
map_element_ids
=
map_service
.
CollectMapElements
(
p
,
20000.0
);
MapElementIds
map_element_ids
=
map_service
.
CollectMapElement
Id
s
(
p
,
20000.0
);
EXPECT_THAT
(
map_element_ids
.
lane
,
UnorderedElementsAre
(
"l1"
));
EXPECT_THAT
(
map_element_ids
.
crosswalk
,
UnorderedElementsAre
());
...
...
modules/dreamview/backend/simulation_world/simulation_world_service.cc
浏览文件 @
653d63f1
...
...
@@ -113,7 +113,7 @@ void SetObstacleInfo(const PerceptionObstacle &obstacle, Object *world_object) {
world_object
->
set_speed
(
std
::
hypot
(
obstacle
.
velocity
().
x
(),
obstacle
.
velocity
().
y
()));
world_object
->
set_speed_heading
(
std
::
atan2
(
obstacle
.
velocity
().
y
(),
obstacle
.
velocity
().
x
()));
std
::
atan2
(
obstacle
.
velocity
().
y
(),
obstacle
.
velocity
().
x
()));
world_object
->
set_timestamp_sec
(
obstacle
.
timestamp
());
}
...
...
@@ -224,8 +224,7 @@ bool LocateMarker(const apollo::planning::ObjectDecisionType &decision,
world_decision
->
set_type
(
Decision_Type_YIELD
);
fence_point
=
decision
.
yield
().
fence_point
();
heading
=
decision
.
yield
().
fence_heading
();
}
else
if
(
decision
.
has_overtake
()
&&
decision
.
overtake
().
has_fence_point
())
{
}
else
if
(
decision
.
has_overtake
()
&&
decision
.
overtake
().
has_fence_point
())
{
world_decision
->
set_type
(
Decision_Type_OVERTAKE
);
fence_point
=
decision
.
overtake
().
fence_point
();
heading
=
decision
.
overtake
().
fence_heading
();
...
...
@@ -319,13 +318,13 @@ Json SimulationWorldService::GetUpdateAsJson() const {
point
.
set_y
(
world_
.
auto_driving_car
().
position_y
());
MapElementIds
map_element_ids
=
map_service_
->
CollectMapElements
(
point
,
kMapRadius
);
map_service_
->
CollectMapElement
Id
s
(
point
,
kMapRadius
);
Json
update
;
update
[
"type"
]
=
"sim_world_update"
;
update
[
"timestamp"
]
=
apollo
::
common
::
time
::
AsInt64
<
millis
>
(
Clock
::
Now
());
update
[
"world"
]
=
Json
::
parse
(
sim_world_json
);
update
[
"mapElements"
]
=
map_element_ids
.
Json
();
update
[
"mapElement
Id
s"
]
=
map_element_ids
.
Json
();
update
[
"mapHash"
]
=
map_element_ids
.
Hash
();
return
update
;
...
...
@@ -546,8 +545,8 @@ void SimulationWorldService::UpdateDecision(const DecisionResult &decision_res,
// Update obstacle decision.
for
(
const
auto
&
obj_decision
:
decision_res
.
object_decision
().
decision
())
{
if
(
obj_decision
.
has_perception_id
())
{
Object
&
world_obj
=
obj_map_
[
std
::
to_string
(
obj_decision
.
perception_id
())];
Object
&
world_obj
=
obj_
map_
[
std
::
to_string
(
obj_
decision
.
perception_id
())];
if
(
!
world_obj
.
has_type
())
{
world_obj
.
set_type
(
Object_Type_VIRTUAL
);
}
...
...
modules/dreamview/frontend/dist/app.bundle.js
浏览文件 @
653d63f1
此差异已折叠。
点击以展开。
modules/dreamview/frontend/dist/app.bundle.js.map
浏览文件 @
653d63f1
此差异已折叠。
点击以展开。
modules/dreamview/frontend/src/renderer/index.js
浏览文件 @
653d63f1
...
...
@@ -219,8 +219,8 @@ class Renderer {
this
.
map
.
appendMapData
(
newData
,
this
.
coordinates
,
this
.
scene
);
}
updateMapIndex
(
hash
,
elements
)
{
this
.
map
.
updateIndex
(
hash
,
elements
,
this
.
scene
);
updateMapIndex
(
hash
,
element
Id
s
)
{
this
.
map
.
updateIndex
(
hash
,
element
Id
s
,
this
.
scene
);
}
}
...
...
modules/dreamview/frontend/src/renderer/map.js
浏览文件 @
653d63f1
...
...
@@ -19,28 +19,33 @@ const colorMapping = {
DEFAULT
:
0xC0C0C0
};
// The result will be the all the elements in current but
// not in data.
function
diffMapElements
(
elements
,
data
)
{
function
base64Decode
(
encoded
)
{
return
Buffer
.
from
(
encoded
,
'
base64
'
).
toString
();
}
// The result will be the all the elements in current but not in data.
function
diffMapElements
(
elementIds
,
data
)
{
const
result
=
{};
let
empty
=
true
;
for
(
const
kind
in
elements
)
{
for
(
const
kind
in
element
Id
s
)
{
result
[
kind
]
=
[];
const
new
Ones
=
element
s
[
kind
];
const
old
Ones
=
data
[
kind
];
const
new
Ids
=
elementId
s
[
kind
];
const
old
Data
=
data
[
kind
];
for
(
let
i
=
0
;
i
<
new
One
s
.
length
;
++
i
)
{
const
found
=
old
Ones
?
oldOnes
.
find
(
x
=>
{
return
x
.
id
.
id
===
newOne
s
[
i
];
for
(
let
i
=
0
;
i
<
new
Id
s
.
length
;
++
i
)
{
const
found
=
old
Data
?
oldData
.
find
(
old
=>
{
return
base64Decode
(
old
.
id
.
id
)
===
newId
s
[
i
];
})
:
false
;
if
(
!
found
)
{
result
[
kind
].
push
(
newOnes
[
i
]);
empty
=
false
;
result
[
kind
].
push
(
newIds
[
i
]);
}
}
}
return
result
;
return
empty
?
{}
:
result
;
}
function
addLaneMesh
(
laneType
,
points
)
{
...
...
@@ -232,16 +237,18 @@ export default class Map {
this
.
data
=
{};
}
removeExpiredElements
(
elements
,
scene
)
{
removeExpiredElements
(
element
Id
s
,
scene
)
{
const
newData
=
{};
for
(
const
kind
in
this
.
data
)
{
newData
[
kind
]
=
[];
const
oldDataOfThisKind
=
this
.
data
[
kind
];
const
current
=
elements
[
kind
];
const
current
=
element
Id
s
[
kind
];
if
(
current
)
{
for
(
let
i
=
0
;
i
<
oldDataOfThisKind
.
length
;
++
i
)
{
if
(
current
.
includes
(
oldDataOfThisKind
[
i
].
id
.
id
))
{
// Map elements Id is base64 encoded by MessageToJsonString
const
id
=
base64Decode
(
oldDataOfThisKind
[
i
].
id
.
id
);
if
(
current
.
includes
(
id
))
{
newData
[
kind
].
push
(
oldDataOfThisKind
[
i
]);
}
else
if
(
oldDataOfThisKind
[
i
].
drewObjects
)
{
oldDataOfThisKind
[
i
].
drewObjects
.
forEach
(
object
=>
{
...
...
@@ -301,12 +308,14 @@ export default class Map {
}
}
updateIndex
(
hash
,
elements
,
scene
)
{
updateIndex
(
hash
,
element
Id
s
,
scene
)
{
if
(
hash
!==
this
.
hash
)
{
this
.
hash
=
hash
;
const
diff
=
diffMapElements
(
elements
,
this
.
data
);
this
.
removeExpiredElements
(
elements
,
scene
);
WS
.
requestMapData
(
diff
);
const
diff
=
diffMapElements
(
elementIds
,
this
.
data
);
this
.
removeExpiredElements
(
elementIds
,
scene
);
if
(
!
_
.
isEmpty
(
diff
))
{
WS
.
requestMapData
(
diff
);
}
}
}
}
modules/dreamview/frontend/src/store/websocket.js
浏览文件 @
653d63f1
...
...
@@ -34,9 +34,9 @@ class WebSocketEndpoint {
// NOTE: This is a hack to limit the rate
// of map updates.
this
.
counter
=
0
;
RENDERER
.
updateMapIndex
(
message
.
mapHash
,
message
.
mapElements
);
RENDERER
.
updateMapIndex
(
message
.
mapHash
,
message
.
mapElementIds
);
}
this
.
counter
+=
1
;
break
;
case
"
MapData
"
:
RENDERER
.
updateMap
(
message
.
data
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录