Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
40d64829
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,发现更多精彩内容 >>
提交
40d64829
编写于
7月 17, 2017
作者:
A
Aaron Xiao
提交者:
Jiangtao Hu
7月 17, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix code styles of row composing.
上级
c8511541
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
41 deletion
+40
-41
modules/common/status/status.h
modules/common/status/status.h
+1
-2
modules/common/time/time.h
modules/common/time/time.h
+4
-8
modules/hmi/web/config.py
modules/hmi/web/config.py
+2
-2
modules/hmi/web/ros_service_api.py
modules/hmi/web/ros_service_api.py
+4
-4
modules/hmi/web/runtime_status.py
modules/hmi/web/runtime_status.py
+29
-25
未找到文件。
modules/common/status/status.h
浏览文件 @
40d64829
...
...
@@ -88,8 +88,7 @@ class Status {
bool
operator
!=
(
const
Status
&
rh
)
const
{
return
!
(
*
this
==
rh
);
}
/**
* @brief returns the error message of the status, empty if the status is
* OK.
* @brief returns the error message of the status, empty if the status is OK.
* @returns the error message
*/
const
std
::
string
&
error_message
()
const
{
return
msg_
;
}
...
...
modules/common/time/time.h
浏览文件 @
40d64829
...
...
@@ -41,8 +41,7 @@ namespace time {
/**
* @class Duration
* @brief the default Duration is of precision nanoseconds (1e-9
* seconds).
* @brief the default Duration is of precision nanoseconds (1e-9 seconds).
*/
using
Duration
=
std
::
chrono
::
nanoseconds
;
...
...
@@ -66,8 +65,7 @@ using hours = std::chrono::hours;
/**
* @brief converts the input duration (nanos) to a 64 bit integer, with
* the unit specified by PrecisionDuration.
* @param duration the input duration that needs to be converted to
* integer.
* @param duration the input duration that needs to be converted to integer.
* @return an integer representing the duration in the specified unit.
*/
template
<
typename
PrecisionDuration
>
...
...
@@ -78,8 +76,7 @@ int64_t AsInt64(const Duration &duration) {
/**
* @brief converts the input timestamp (nanos) to a 64 bit integer, with
* the unit specified by PrecisionDuration.
* @param timestamp the input timestamp that needs to be converted to
* integer.
* @param timestamp the input timestamp that needs to be converted to integer.
* @return an integer representing the timestamp in the specified unit.
*/
template
<
typename
PrecisionDuration
>
...
...
@@ -109,8 +106,7 @@ inline double ToSecond(const Timestamp ×tamp) {
}
/**
* @brief converts the integer-represented timestamp to \class
* Timestamp.
* @brief converts the integer-represented timestamp to \class Timestamp.
* @return a Timestamp object.
*/
template
<
typename
PrecisionDuration
>
...
...
modules/hmi/web/config.py
浏览文件 @
40d64829
...
...
@@ -75,8 +75,8 @@ class Config(object):
"""
Get realpath from a path string in config.
Starting with '/' indicates an absolute path, otherwise it will be taken
as a relative path
of the Apollo root.
Starting with '/' indicates an absolute path, otherwise it will be taken
as a relative path
of the Apollo root.
"""
if
path_str
.
startswith
(
'/'
):
return
path_str
...
...
modules/hmi/web/ros_service_api.py
浏览文件 @
40d64829
...
...
@@ -42,6 +42,7 @@ class RosServiceApi(flask_restful.Resource):
@
staticmethod
def
execute_cmd
(
cmd_name
):
"""Run ros command by sending GRPC requests and return HTTP response."""
ToolStatus
=
runtime_status_pb2
.
ToolStatus
channel
=
grpc
.
insecure_channel
(
gflags
.
FLAGS
.
hmi_ros_node_service
)
stub
=
ros_node_pb2
.
HMIRosNodeStub
(
channel
)
...
...
@@ -54,8 +55,8 @@ class RosServiceApi(flask_restful.Resource):
# Update runtime status.
tool_status
=
status
.
get_tools
()
if
tool_status
.
playing_status
!=
runtime_status_pb2
.
ToolStatus
.
PLAYING_NOT_READY
:
tool_status
.
playing_status
=
runtime_status_pb2
.
ToolStatus
.
PLAYING_READY_TO_CHECK
if
tool_status
.
playing_status
!=
ToolStatus
.
PLAYING_NOT_READY
:
tool_status
.
playing_status
=
ToolStatus
.
PLAYING_READY_TO_CHECK
elif
cmd_name
==
'start_auto_driving'
:
request
=
ros_node_pb2
.
ChangeDrivingModeRequest
(
...
...
@@ -63,8 +64,7 @@ class RosServiceApi(flask_restful.Resource):
response
=
stub
.
ChangeDrivingMode
(
request
)
# Update runtime status.
status
.
get_tools
(
).
playing_status
=
runtime_status_pb2
.
ToolStatus
.
PLAYING
status
.
get_tools
().
playing_status
=
ToolStatus
.
PLAYING
else
:
error_msg
=
'RosServiceApi: Unknown command "{}"'
.
format
(
cmd_name
)
glog
.
error
(
error_msg
)
...
...
modules/hmi/web/runtime_status.py
浏览文件 @
40d64829
...
...
@@ -45,6 +45,7 @@ class RuntimeStatus(object):
@
classmethod
def
reset
(
cls
,
check_playable_file
=
False
):
"""Reset runtime status to start."""
ToolStatus
=
runtime_status_pb2
.
ToolStatus
cls
.
pb_singleton
.
Clear
()
cls
.
pb_fingerprint
=
0
cls
.
module_dict
.
clear
()
...
...
@@ -52,11 +53,11 @@ class RuntimeStatus(object):
tool_status
=
cls
.
get_tools
()
if
check_playable_file
and
cls
.
stat_playable_duration
()
>
0
:
tool_status
.
recording_status
=
runtime_status_pb2
.
ToolStatus
.
RECORDING_FINISHED
tool_status
.
playing_status
=
runtime_status_pb2
.
ToolStatus
.
PLAYING_READY_TO_CHECK
tool_status
.
recording_status
=
ToolStatus
.
RECORDING_FINISHED
tool_status
.
playing_status
=
ToolStatus
.
PLAYING_READY_TO_CHECK
else
:
tool_status
.
recording_status
=
runtime_status_pb2
.
ToolStatus
.
RECORDING_READY_TO_CHECK
tool_status
.
playing_status
=
runtime_status_pb2
.
ToolStatus
.
PLAYING_NOT_READY
tool_status
.
recording_status
=
ToolStatus
.
RECORDING_READY_TO_CHECK
tool_status
.
playing_status
=
ToolStatus
.
PLAYING_NOT_READY
cls
.
_calculate
()
@
classmethod
...
...
@@ -110,18 +111,15 @@ class RuntimeStatus(object):
cls
.
_calculate
()
new_fingerprint
=
hash
(
str
(
cls
.
pb_singleton
))
if
cls
.
pb_fingerprint
!=
new_fingerprint
:
flask_socketio
.
emit
(
'new_status'
,
cls
.
status_json
(),
broadcast
=
True
,
namespace
=
'/runtime_status'
)
flask_socketio
.
emit
(
'new_status'
,
cls
.
status_json
(),
broadcast
=
True
,
namespace
=
'/runtime_status'
)
cls
.
pb_fingerprint
=
new_fingerprint
@
classmethod
def
_calculate
(
cls
):
"""Update runtime status fields which need to be calculated."""
conf_pb
=
config
.
Config
.
get_pb
()
modules_and_hardware_ready
=
cls
.
are_all_modules_ready
(
)
and
cls
.
are_all_hardware_ready
()
cls
.
_calculate_recording_status
(
modules_and_hardware_ready
)
...
...
@@ -153,7 +151,7 @@ class RuntimeStatus(object):
if
os
.
path
.
exists
(
file_to_play
):
with
open
(
file_to_play
,
'r'
)
as
f
:
kFreq
=
100
cls
.
playable_duration
=
sum
([
1
for
line
in
f
])
/
kFreq
cls
.
playable_duration
=
sum
([
1
for
_
in
f
])
/
kFreq
else
:
cls
.
playable_duration
=
0
return
cls
.
playable_duration
...
...
@@ -168,7 +166,8 @@ class RuntimeStatus(object):
recording_status
=
tool_status
.
recording_status
if
recording_status
==
CHECKING
and
modules_and_hardware_ready
:
tool_status
.
recording_status
=
READY_TO_START
elif
recording_status
==
READY_TO_START
and
not
modules_and_hardware_ready
:
elif
recording_status
==
READY_TO_START
and
\
not
modules_and_hardware_ready
:
tool_status
.
recording_status
=
CHECKING
@
classmethod
...
...
@@ -181,17 +180,17 @@ class RuntimeStatus(object):
if
tool_status
.
playing_status
==
ToolStatus
.
PLAYING_NOT_READY
:
if
tool_status
.
recording_status
==
ToolStatus
.
RECORDING_FINISHED
:
if
cls
.
playable_duration
>
0
:
tool_status
.
playing_status
=
ToolStatus
.
PLAYING_READY_TO_CHECK
tool_status
.
playing_status
=
\
ToolStatus
.
PLAYING_READY_TO_CHECK
else
:
glog
.
info
(
'RuntimeStatus::_calculate_playing_status: No file to play'
)
glog
.
info
(
'RuntimeStatus::_calculate_playing_status: '
\
'No file to play'
)
elif
(
playing_status
==
ToolStatus
.
PLAYING_CHECKING
and
modules_and_hardware_ready
and
tool_status
.
planning_ready
):
tool_status
.
playing_status
=
ToolStatus
.
PLAYING_READY_TO_START
glog
.
info
(
'RuntimeStatus::_calculate_playing_status:
All modules/hardware are ready'
)
'RuntimeStatus::_calculate_playing_status:
'
\
'All modules/hardware are ready'
)
elif
playing_status
==
ToolStatus
.
PLAYING_READY_TO_START
and
not
(
modules_and_hardware_ready
and
tool_status
.
planning_ready
):
tool_status
.
playing_status
=
ToolStatus
.
PLAYING_CHECKING
...
...
@@ -205,10 +204,12 @@ class RuntimeStatus(object):
tool_status
=
cls
.
get_tools
()
if
tool_status
.
recording_status
==
ToolStatus
.
RECORDING_READY_TO_CHECK
:
tool_status
.
message
=
'Before recording, you need to setup the system.'
tool_status
.
message
=
'Before recording, you need to setup the '
\
'system.'
elif
tool_status
.
recording_status
==
ToolStatus
.
RECORDING_CHECKING
:
tool_status
.
message
=
'Waiting for modules and hardware.'
elif
tool_status
.
recording_status
==
ToolStatus
.
RECORDING_READY_TO_START
:
elif
tool_status
.
recording_status
==
\
ToolStatus
.
RECORDING_READY_TO_START
:
tool_status
.
message
=
'Now you are ready to record.'
elif
(
tool_status
.
recording_status
==
ToolStatus
.
RECORDING
or
tool_status
.
playing_status
==
ToolStatus
.
PLAYING
):
...
...
@@ -217,8 +218,9 @@ class RuntimeStatus(object):
tool_status
.
message
=
str
(
cls
.
_current_timestamp
())
elif
(
tool_status
.
recording_status
==
ToolStatus
.
RECORDING_FINISHED
and
tool_status
.
playing_status
==
ToolStatus
.
PLAYING_NOT_READY
):
tool_status
.
message
=
'The recorded data/log/garage.csv is invalid.<br/>'
\
'Please fix, or simply try recording again by clicking "New".'
tool_status
.
message
=
'The recorded data/log/garage.csv is '
\
'invalid.<br/>Please fix, or simply try '
\
'recording again by clicking "New".'
elif
tool_status
.
playing_status
==
ToolStatus
.
PLAYING_CHECKING
:
if
tool_status
.
planning_ready
:
tool_status
.
message
=
'Waiting for modules and hardware.'
...
...
@@ -229,9 +231,11 @@ class RuntimeStatus(object):
'Before playing, please setup the system.'
\
.
format
(
cls
.
playable_duration
)
elif
tool_status
.
playing_status
==
ToolStatus
.
PLAYING_READY_TO_START
:
tool_status
.
message
=
'Make sure the OPERATOR is ready! Now you are good to go.'
tool_status
.
message
=
'Make sure the OPERATOR is ready! '
\
'Now you are good to go.'
else
:
tool_status
.
message
=
'Something goes wrong.<br/>Please record again or RESET ALL.'
tool_status
.
message
=
'Something goes wrong.<br/>'
\
'Please record again or RESET ALL.'
@
classmethod
def
_current_timestamp
(
cls
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录