Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
b16edced
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,发现更多精彩内容 >>
提交
b16edced
编写于
8月 02, 2017
作者:
A
Aaron Xiao
提交者:
Jiangtao Hu
8月 02, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
HMI sends RESET before AUTO when requested.
上级
c9b4769f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
13 deletion
+22
-13
modules/hmi/web/hmi_main.py
modules/hmi/web/hmi_main.py
+2
-0
modules/hmi/web/ros_service_api.py
modules/hmi/web/ros_service_api.py
+19
-12
modules/hmi/web/templates/cards/quick_start_panel.tpl
modules/hmi/web/templates/cards/quick_start_panel.tpl
+1
-1
未找到文件。
modules/hmi/web/hmi_main.py
浏览文件 @
b16edced
...
...
@@ -21,6 +21,7 @@ import gflags
import
google.apputils.app
import
handlers
import
ros_service_api
import
runtime_status
gflags
.
DEFINE_string
(
'host'
,
'0.0.0.0'
,
'Host of the HMI server.'
)
...
...
@@ -33,6 +34,7 @@ gflags.DEFINE_string(
def
main
(
argv
):
"""App entry point."""
runtime_status
.
RuntimeStatus
.
reset
(
True
)
ros_service_api
.
RosServiceApi
.
init_ros
()
FLAGS
=
gflags
.
FLAGS
# Start web server.
...
...
modules/hmi/web/ros_service_api.py
浏览文件 @
b16edced
...
...
@@ -18,6 +18,7 @@
"""HMI ros node service restful Api."""
import
httplib
import
time
import
flask_restful
import
glog
...
...
@@ -33,6 +34,14 @@ class RosServiceApi(flask_restful.Resource):
pad_msg_pub
=
None
pad_msg_seq_num
=
0
@
classmethod
def
init_ros
(
cls
):
"""Init ros node."""
rospy
.
init_node
(
'hmi_ros_node_service'
,
anonymous
=
True
)
cls
.
pad_msg_pub
=
rospy
.
Publisher
(
'/apollo/control/pad'
,
pad_msg_pb2
.
PadMessage
,
queue_size
=
1
)
# Restful interface.
def
get
(
self
,
cmd_name
):
"""Run ros command and return HTTP response."""
return
RosServiceApi
.
execute_cmd
(
cmd_name
)
...
...
@@ -52,6 +61,12 @@ class RosServiceApi(flask_restful.Resource):
# Update runtime status.
if
tool_status
.
playing_status
==
ToolStatus
.
PLAYING_READY_TO_START
:
tool_status
.
playing_status
=
ToolStatus
.
PLAYING
elif
cmd_name
==
'restart_auto_driving'
:
# Send one RESET before entering AUTO mode, with 0.5s interval.
interval
=
0.5
cls
.
perform_driving_action
(
pad_msg_pb2
.
RESET
)
time
.
sleep
(
interval
)
cls
.
execute_cmd
(
'start_auto_driving'
)
else
:
error_msg
=
'RosServiceApi: Unknown command "{}"'
.
format
(
cmd_name
)
glog
.
error
(
error_msg
)
...
...
@@ -64,20 +79,12 @@ class RosServiceApi(flask_restful.Resource):
@
classmethod
def
perform_driving_action
(
cls
,
driving_action
):
"""Request to perform driving action."""
if
cls
.
pad_msg_pub
is
None
:
rospy
.
init_node
(
'hmi_ros_node_service'
,
anonymous
=
True
)
cls
.
pad_msg_pub
=
rospy
.
Publisher
(
'/apollo/control/pad'
,
pad_msg_pb2
.
PadMessage
,
queue_size
=
1
)
pad_msg
=
pad_msg_pb2
.
PadMessage
()
pad_msg
.
header
.
timestamp_sec
=
rospy
.
get_time
()
pad_msg
.
header
.
module_name
=
"hmi_ros_node_service"
pad_msg
.
action
=
driving_action
# Send pad message 3 times.
for
_
in
range
(
3
):
cls
.
pad_msg_seq_num
+=
1
pad_msg
.
header
.
sequence_num
=
cls
.
pad_msg_seq_num
cls
.
pad_msg_seq_num
+=
1
pad_msg
.
header
.
sequence_num
=
cls
.
pad_msg_seq_num
glog
.
info
(
'Publishing message: {}'
.
format
(
pad_msg
))
cls
.
pad_msg_pub
.
publish
(
pad_msg
)
rospy
.
sleep
(
0.5
)
glog
.
info
(
'Publishing message: {}'
.
format
(
pad_msg
))
cls
.
pad_msg_pub
.
publish
(
pad_msg
)
modules/hmi/web/templates/cards/quick_start_panel.tpl
浏览文件 @
b16edced
...
...
@@ -127,7 +127,7 @@
</div>
<div
class=
"col-xs-4 quick_start_col2"
>
<button
type=
"button"
class=
"btn hmi_large_btn"
onclick=
"ros_request('start_auto_driving')"
>
Start Auto
</button>
onclick=
"ros_request('
re
start_auto_driving')"
>
Start Auto
</button>
<span
class=
"glyphicon"
></span>
</div>
</div>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录