class RobotWeb(object): def __init__(self): self.laucher = Launcher() @cherrypy.expose def index(self): return "Hello! We are Virtuoso Robotics!" @cherrypy.expose def start_roscore(self): self.laucher.launch_roscore() return 'start roscore' @cherrypy.expose def kill_roscore(self): self.laucher.kill_roscore() return 'kill roscore' @cherrypy.expose def start_roslaunch(self): self.laucher.roslauncher() return 'start roslaunch' @cherrypy.expose def kill_roslaunch(self): self.laucher.kill_roslaunch() return 'kill roslaunch'
class HelloWorld(object): def __init__(self): self.laucher = Launcher() self.pub = rospy.Publisher('move_base_simple/goal', PoseStamped, queue_size=10) @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("home.html", "r") return f @cherrypy.expose def start(self): # t = threading.Thread(target=launch_nav) # t.daemon = True # t.start() self.laucher.roslauncher() f = open("strat.html", "r") return f @cherrypy.expose def kill(self): self.laucher.kill_roslaunch() return 'kill roscore' @cherrypy.expose def goalA_to(self): goal = PoseStamped() goal.header.frame_id = "map" goal.header.stamp = rospy.Time.now() goal.pose.position.x = 0.240 goal.pose.position.y = -0.344 goal.pose.position.z = 0 goal.pose.orientation.w = 1.0 self.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 = 0 goal.pose.position.z = 0 goal.pose.orientation.w = 1.0 self.pub.publish(goal) return 'goal leave!' @cherrypy.expose def goalB_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.601 goal.pose.position.y = -0.138 goal.pose.position.z = 0 goal.pose.orientation.w = 1.0 self.pub.publish(goal) return 'goal to!' # return 'Hello!' @cherrypy.expose def goalB_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 = 0 goal.pose.position.z = 0 goal.pose.orientation.w = 1.0 self.pub.publish(goal) return 'Hello!' @cherrypy.expose def goalC_to(self): # f = open("latop.html", "r") return 'Hello!'