diff --git a/waypoint_manager/scripts/manager_GUI.py b/waypoint_manager/scripts/manager_GUI.py index b2ea0a9..802bca5 100755 --- a/waypoint_manager/scripts/manager_GUI.py +++ b/waypoint_manager/scripts/manager_GUI.py @@ -2,6 +2,7 @@ import tkinter.filedialog import math import ruamel.yaml +import gc from pathlib import Path from tkinter import messagebox from lib.mymaplib import MyMap @@ -132,6 +133,7 @@ messagebox.showerror(title="Format error", message="Selected map file is unexpected format.") return try: + del self.mymap self.mymap = MyMap(Path(map_path), map_yaml) except FileNotFoundError: messagebox.showerror(title="Image file is not found", message="\""+map_yaml["image"]+"\" is not found.") @@ -166,6 +168,7 @@ self.menu_open_waypoints() else: self.plot_waypoints() + gc.collect() return @@ -198,6 +201,7 @@ if (not "waypoints" in wp_yaml.keys()) or (not "finish_pose" in wp_yaml.keys()): messagebox.showerror(title="Format error", message="Selected waypoints file is unexpected format.") return + del self.waypoints self.waypoints = WaypointList(wp_yaml) self.finish_pose = FinishPose(wp_yaml) self.waypoints_filepath = Path(filepath) @@ -207,6 +211,7 @@ self.file_menu.entryconfigure("Save", state=tk.NORMAL) self.file_menu.entryconfigure("Save As", state=tk.NORMAL) self.popup_menu.entryconfigure("Add waypoint here", state=tk.NORMAL) + gc.collect() return @@ -630,6 +635,7 @@ self.wp_info_win.destroy() self.disp_waypoint_info(self.editing_waypoint_id) self.update_title() + gc.collect() return add_btn = tk.Button(sub_win, text="Add", width=5, height=1, font=font, anchor=tk.CENTER, bg="#AFA") add_btn["command"] = add_param @@ -667,6 +673,7 @@ self.editing_waypoint_id = None self.moving_waypoint = False self.wp_info_win.destroy() + gc.collect() return diff --git a/waypoint_nav/launch/waypoint_nav.launch b/waypoint_nav/launch/waypoint_nav.launch index a19d48e..654e341 100755 --- a/waypoint_nav/launch/waypoint_nav.launch +++ b/waypoint_nav/launch/waypoint_nav.launch @@ -1,7 +1,7 @@ - + diff --git a/waypoint_nav/scripts/tandem_run_manager.py b/waypoint_nav/scripts/tandem_run_manager.py index 0dc16cd..7182457 100755 --- a/waypoint_nav/scripts/tandem_run_manager.py +++ b/waypoint_nav/scripts/tandem_run_manager.py @@ -72,13 +72,14 @@ try: if self.front_range is None: front = round(-msg.angle_min / msg.angle_increment) - ran = int(round(np.deg2rad(5) / msg.angle_increment)) + ran = int(round(np.deg2rad(10) / msg.angle_increment)) self.front_range = [front-ran, front+ran] return if not self.in_tandem_area: return - min_range = np.min(msg.ranges[self.front_range[0]:self.front_range[1]]) + sort_ranges = np.sort(msg.ranges[self.front_range[0]:self.front_range[1]]) + min_range = np.mean(sort_ranges[:5]) if (not self.stop) and (min_range < self.danger_dist): self.stop_nav() self.stop = True