diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..9732897 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // IntelliSense を使用して利用可能な属性を学べます。 + // 既存の属性の説明をホバーして表示します。 + // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: 現在のファイル", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/waypoint_manager/scripts/.vscode/launch.json b/waypoint_manager/scripts/.vscode/launch.json new file mode 100644 index 0000000..9732897 --- /dev/null +++ b/waypoint_manager/scripts/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // IntelliSense を使用して利用可能な属性を学べます。 + // 既存の属性の説明をホバーして表示します。 + // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: 現在のファイル", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/waypoint_manager/scripts/devel_GUI.py b/waypoint_manager/scripts/devel_GUI.py index 0df3f2a..fdee784 100755 --- a/waypoint_manager/scripts/devel_GUI.py +++ b/waypoint_manager/scripts/devel_GUI.py @@ -19,8 +19,12 @@ self.menu_bar = tk.Menu(self) # メニューバーを配置 self.file_menu = tk.Menu(self.menu_bar, tearoff=tk.OFF) # バーに追加するメニューを作成 self.menu_bar.add_cascade(label="File", menu=self.file_menu) # Fileメニューとしてバーに追加 - self.file_menu.add_command(label="Save", command=self.menu_save_clicked, accelerator="Ctrl+S") # FileメニューにSaveコマンドを追加 - self.file_menu.add_command(label="Save As", command=self.menu_saveas_clicked, accelerator="Ctrl+Shift+S") # 同様にSave Asコマンドを追加 + self.file_menu.add_command(label="Save", + command=self.menu_save_clicked, + accelerator="Ctrl+S") # FileメニューにSaveコマンドを追加 + self.file_menu.add_command(label="Save As", + command=self.menu_saveas_clicked, + accelerator="Ctrl+Shift+S") # 同様にSave Asコマンドを追加 self.bind_all("", self.menu_save_clicked) #キーボードショートカットを設定 self.bind_all("", self.menu_saveas_clicked) self.master.config(menu=self.menu_bar) # 大元に作成したメニューバーを設定 @@ -58,6 +62,7 @@ ## マウスイベントを設定 self.master.bind("", self.mouse_wheel) self.master.bind("", self.left_click_move) + self.master.bind("", self.left_click) self.master.bind("", self.right_click) return @@ -66,9 +71,9 @@ #--- mapのファイルパスを受け取り、map画像とmapの設定ファイルを読み込む --- #--- 今はパスを直接指定して読み込んでいるので、rospy.get_param()を使って読み込めるように --- def get_map_info(self): - map_path = '..\..\waypoint_nav\maps\map' # .pgmと.yamlの手前までのパス - map_img_pil = Image.open(Path(map_path+'.pgm')) # .pgmをplillowで読み込む - with open(map_path+'.yaml') as file: # .yamlを読み込む + map_path = Path('..','..','waypoint_nav','maps','map') # .pgmと.yamlの手前までのパス + map_img_pil = Image.open(Path(str(map_path)+'.pgm')) # .pgmをplillowで読み込む + with open(str(map_path)+'.yaml') as file: # .yamlを読み込む map_yaml = ruamel.yaml.YAML().load(file) return map_img_pil, map_yaml # この2つの変数を戻り値とする @@ -77,7 +82,7 @@ #--- これもget_param()でパスを受け取り、読み込めるようにする --- def get_waypoints(self): - file_path = '..\..\waypoint_nav\param\waypoints.yaml' + file_path = Path('..','..','waypoint_nav','param','waypoints.yaml') with open(file_path) as file: waypoints = ruamel.yaml.YAML().load(file) return waypoints @@ -131,6 +136,11 @@ def menu_saveas_clicked(self, event=None): print("Clicked \"Save As\"") return + + + + def left_click(self, event): + self.popup_menu.unpost() @@ -139,6 +149,7 @@ if __name__ == "__main__": #rospy.init_node("manager_GUI") root = tk.Tk() # 大元になるウィンドウ - root.state("zoomed") # ウィンドウを最大化 + w, h = root.winfo_screenwidth(), root.winfo_screenheight() + root.geometry("%dx%d+0+0" % (w, h)) app = Application(master=root) # tk.Frameを継承したApplicationクラスのインスタンス app.mainloop() diff --git a/waypoint_manager/scripts/manager_GUI.py b/waypoint_manager/scripts/manager_GUI.py index b964bca..e69de29 100755 --- a/waypoint_manager/scripts/manager_GUI.py +++ b/waypoint_manager/scripts/manager_GUI.py @@ -1,15 +0,0 @@ -import rospy -import tkinter as tk - -class Application(tk.Frame): - - # Constructer - def __init__(self, master=None): - super().__init__(master) - - -if __name__ == "__main__": - #rospy.init_node("manager_GUI") # maybe no mean - root = tk.Tk() - app = Application(master = root) - app.mainloop() diff --git a/waypoint_manager/scripts/test.py b/waypoint_manager/scripts/test.py deleted file mode 100755 index 31484f7..0000000 --- a/waypoint_manager/scripts/test.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python - -import matplotlib.pyplot as plt -import rospy -import tkinter as tk - - -fig = plt.figure("Test") -axes = plt.subplot(1,1,1) -axes.plot(1,1, "b", marker=".", markersize=10) - - -plt.show()