Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 876a7725 authored by AUTERNAUD Alex's avatar AUTERNAUD Alex
Browse files

closing controller issue

parent 7aadb872
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
from multiprocessing import Process, Lock from multiprocessing import Process, Lock
from multiprocessing.managers import SharedMemoryManager from multiprocessing.managers import SharedMemoryManager
from multiprocessing import active_children
import atexit import atexit
import rospy import rospy
import time import time
...@@ -268,7 +269,7 @@ class RobotController(): ...@@ -268,7 +269,7 @@ class RobotController():
self.flags, self.flags,
self.lock)) self.lock))
self.path_planner_process.start() self.path_planner_process.start()
atexit.register(lambda x: self.on_subprocess_exit("Path planner"), self.path_planner_process) # atexit.register(lambda x: self.on_subprocess_exit("Path planner"), self.path_planner_process)
def update_shared_memory(self, state): def update_shared_memory(self, state):
if self.shared_global_map is None: if self.shared_global_map is None:
...@@ -464,7 +465,7 @@ class RobotController(): ...@@ -464,7 +465,7 @@ class RobotController():
self.flags, self.flags,
self.lock)) self.lock))
self.goal_finder_process.start() self.goal_finder_process.start()
atexit.register(lambda x: self.on_subprocess_exit("Goal finder"), self.goal_finder_process) # atexit.register(lambda x: self.on_subprocess_exit("Goal finder"), self.goal_finder_process)
def get_static_cost_map(self, state): def get_static_cost_map(self, state):
tic = time.time() tic = time.time()
...@@ -747,6 +748,8 @@ class RobotController(): ...@@ -747,6 +748,8 @@ class RobotController():
self.actions = np.copy(self.initial_action) self.actions = np.copy(self.initial_action)
def close(self): def close(self):
active = active_children()
rospy.loginfo(f'Active Children before closing: {len(active)}')
with self.lock: with self.lock:
self.flags[0] = 0 self.flags[0] = 0
if self.path_planner_enabled: if self.path_planner_enabled:
...@@ -756,4 +759,6 @@ class RobotController(): ...@@ -756,4 +759,6 @@ class RobotController():
if self.smm_enabled: if self.smm_enabled:
self.smm.shutdown() self.smm.shutdown()
self.is_init = False self.is_init = False
active = active_children()
rospy.loginfo(f'Active Children at the end of closing: {len(active)}')
rospy.loginfo('RobotController closed') rospy.loginfo('RobotController closed')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment