def main(): util.controlset = controlset.ControlSet() util.costmap = util.CostMap() root = graphics.root root.title("Lattice Planner") root.configure(background = 'grey') graphics.canvas.pack() # x initial entryLabel_x1 = Label(root) entryLabel_x1["text"] = "init: X" entryLabel_x1.pack(side = LEFT) entryWidget_x1 = Entry(root) entryWidget_x1["width"] = 5 entryWidget_x1.pack(side = LEFT) # y initial entryLabel_y1 = Label(root) entryLabel_y1["text"] = "Y" entryLabel_y1.pack(side = LEFT) entryWidget_y1 = Entry(root) entryWidget_y1["width"] = 5 entryWidget_y1.pack(side = LEFT) # theta initial entryLabel_th1 = Label(root) entryLabel_th1["text"] = "TH" entryLabel_th1.pack(side = LEFT) entryWidget_th1 = Entry(root) entryWidget_th1["width"] = 5 entryWidget_th1.pack(side = LEFT) # d goal (cm) entryLabel_d = Label(root) entryLabel_d["text"] = " goal: d" entryLabel_d.pack(side = LEFT) entryWidget_d = Entry(root) entryWidget_d["width"] = 5 entryWidget_d.pack(side = LEFT) # theta goal entryLabel_th = Label(root) entryLabel_th["text"] = "TH" entryLabel_th.pack(side = LEFT) entryWidget_th = Entry(root) entryWidget_th["width"] = 5 entryWidget_th.pack(side = LEFT) b = Button(root,text = "Go",command = lambda: startPlanner(float(entryWidget_x1.get()),float(entryWidget_y1.get()),float(entryWidget_th1.get()),float(entryWidget_d.get()),float(entryWidget_th.get()))) g = Button(root,text = "Show lattice",command = lambda:graphics.draw_lattice()) g.pack(side = RIGHT) b.pack(side = RIGHT) util.costmap.draw_costmap() graphics.draw_court() root.mainloop()
def initialize_gui(): global root rospy.init_node('GUI') while not rospy.is_shutdown(): root = graphics.root root.protocol("WM_DELETE_WINDOW", windowclosed) root.title("Lattice Planner") root.configure(background = 'grey') graphics.canvas.pack() # d goal (cm) entryLabel_d = Label(root) entryLabel_d["text"] = "goal: d" entryLabel_d.pack(side = LEFT) entryWidget_d = Entry(root) entryWidget_d["width"] = 5 entryWidget_d.pack(side = LEFT) # theta goal entryLabel_th = Label(root) entryLabel_th["text"] = "TH" entryLabel_th.pack(side = LEFT) entryWidget_th = Entry(root) entryWidget_th["width"] = 5 entryWidget_th.pack(side = LEFT) # Buttons b = Button(root,text = "Newball",command = lambda: startPlanner(d_goal = float(entryWidget_d.get()),th_goal = float(entryWidget_th.get()), goaltype = "newball")) b.pack(side = LEFT) g = Button(root,text = "Show lattice",command = lambda:graphics.draw_lattice()) g.pack(side = RIGHT) # goal_x (cm) entryLabel_x = Label(root) entryLabel_x["text"] = "goal: x" entryLabel_x.pack(side = LEFT) entryWidget_x = Entry(root) entryWidget_x["width"] = 5 entryWidget_x.pack(side = LEFT) # goal_y (cm) entryLabel_y = Label(root) entryLabel_y["text"] = "goal: y" entryLabel_y.pack(side = LEFT) entryWidget_y = Entry(root) entryWidget_y["width"] = 5 entryWidget_y.pack(side = LEFT) # goal_theta (cm) entryLabel_th2 = Label(root) entryLabel_th2["text"] = "goal: theta" entryLabel_th2.pack(side = LEFT) entryWidget_th2 = Entry(root) entryWidget_th2["width"] = 5 entryWidget_th2.pack(side = LEFT) b2 = Button(root,text = "GoToPose",command = lambda: startPlanner(x_goal = float(entryWidget_x.get()),y_goal = float(entryWidget_y.get()), th_goal_abs = float(entryWidget_th2.get()), goaltype = "gotopose")) b2.pack(side = RIGHT) graphics.draw_court() graphics.draw_landmarks() graphics.canvas.configure(cursor = "crosshair") graphics.canvas.bind("<Button-1>", onclick) rospy.Subscriber("pose",Pose, received_odometry) rospy.Subscriber("path",Path,received_path) root.mainloop()
def initialize_gui(): global root rospy.init_node('GUI') while not rospy.is_shutdown(): root = graphics.root root.protocol("WM_DELETE_WINDOW", windowclosed) root.title("Lattice Planner") root.configure(background='grey') graphics.canvas.pack() # d goal (cm) entryLabel_d = Label(root) entryLabel_d["text"] = "goal: d" entryLabel_d.pack(side=LEFT) entryWidget_d = Entry(root) entryWidget_d["width"] = 5 entryWidget_d.pack(side=LEFT) # theta goal entryLabel_th = Label(root) entryLabel_th["text"] = "TH" entryLabel_th.pack(side=LEFT) entryWidget_th = Entry(root) entryWidget_th["width"] = 5 entryWidget_th.pack(side=LEFT) # Buttons b = Button( root, text="Newball", command=lambda: startPlanner(d_goal=float(entryWidget_d.get()), th_goal=float(entryWidget_th.get()), goaltype="newball")) b.pack(side=LEFT) g = Button(root, text="Show lattice", command=lambda: graphics.draw_lattice()) g.pack(side=RIGHT) # goal_x (cm) entryLabel_x = Label(root) entryLabel_x["text"] = "goal: x" entryLabel_x.pack(side=LEFT) entryWidget_x = Entry(root) entryWidget_x["width"] = 5 entryWidget_x.pack(side=LEFT) # goal_y (cm) entryLabel_y = Label(root) entryLabel_y["text"] = "goal: y" entryLabel_y.pack(side=LEFT) entryWidget_y = Entry(root) entryWidget_y["width"] = 5 entryWidget_y.pack(side=LEFT) # goal_theta (cm) entryLabel_th2 = Label(root) entryLabel_th2["text"] = "goal: theta" entryLabel_th2.pack(side=LEFT) entryWidget_th2 = Entry(root) entryWidget_th2["width"] = 5 entryWidget_th2.pack(side=LEFT) b2 = Button(root, text="GoToPose", command=lambda: startPlanner( x_goal=float(entryWidget_x.get()), y_goal=float(entryWidget_y.get()), th_goal_abs=float(entryWidget_th2.get()), goaltype="gotopose")) b2.pack(side=RIGHT) graphics.draw_court() graphics.draw_landmarks() graphics.canvas.configure(cursor="crosshair") graphics.canvas.bind("<Button-1>", onclick) rospy.Subscriber("pose", Pose, received_odometry) rospy.Subscriber("path", Path, received_path) root.mainloop()