-
Notifications
You must be signed in to change notification settings - Fork 0
/
interactive.py
78 lines (68 loc) · 2.17 KB
/
interactive.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import cherrypy
import rospy
from geometry_msgs.msg import PoseStamped
from launcher import Launcher
config = {
'global' : {
'server.socket_host' : '192.168.3.3',
'server.socket_port' : 8080
}
}
class HelloWorld(object):
def __init__(self):
self.laucher = Launcher()
@cherrypy.expose
def index(self):
# <input type="button" value="goalA" onclick="location.href='192.168.3.3:8080/goalA_to'">
# ERIC https://github.com/VirtuosoEric/robot_web_service/blob/pn60/home.html
f = open("t.html", "r")
return f
@cherrypy.expose
def start_roscore(self):
self.laucher.roslauncher()
return 'start roscore'
@cherrypy.expose
def kill_roscore(self):
self.laucher.kill_roscore()
return 'kill roscore'
@cherrypy.expose
def goalA_to(self):
pub = rospy.Publisher('move_base_simple/goal', PoseStamped, queue_size=10)
goal = PoseStamped()
goal.header.frame_id = "map"
goal.header.stamp = rospy.Time.now()
goal.pose.position.x = 0
goal.pose.position.y = -1
goal.pose.position.z = 0
goal.pose.orientation.w = 1.0
pub.publish(goal)
return 'goal to!'
@cherrypy.expose
def goalA_leave(self):
pub = rospy.Publisher('move_base_simple/goal', PoseStamped, queue_size=10)
goal = PoseStamped()
goal.header.frame_id = "map"
goal.header.stamp = rospy.Time.now()
goal.pose.position.x = 0
goal.pose.position.y = 1
goal.pose.position.z = 0
goal.pose.orientation.w = 1.0
pub.publish(goal)
return 'goal leave!'
@cherrypy.expose
def goalB_to(self):
# f = open("latop.html", "r")
return 'Hello!'
@cherrypy.expose
def goalB_leave(self):
# f = open("latop.html", "r")
return 'Hello!'
@cherrypy.expose
def goalC_to(self):
# f = open("latop.html", "r")
return 'Hello!'
if __name__ == '__main__':
# laucher = Launcher()
# laucher.launch_roscore()
# rospy.init_node('berry_goal', anonymous=True)
cherrypy.quickstart(HelloWorld(), '/',config)