From 14ba640a11a730d38246be8ac1474416279d00bd Mon Sep 17 00:00:00 2001 From: Clark Teeple Date: Wed, 23 Mar 2022 12:09:16 -0400 Subject: [PATCH] added version --- _version.txt | 1 + src/simple_ur_move/controller_handler.py | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 _version.txt diff --git a/_version.txt b/_version.txt new file mode 100644 index 0000000..6da28dd --- /dev/null +++ b/_version.txt @@ -0,0 +1 @@ +0.1.1 \ No newline at end of file diff --git a/src/simple_ur_move/controller_handler.py b/src/simple_ur_move/controller_handler.py index 01c3bac..9609c49 100644 --- a/src/simple_ur_move/controller_handler.py +++ b/src/simple_ur_move/controller_handler.py @@ -51,7 +51,7 @@ def get_controllers_with_state(self, states=None): ---------- states : list or str List of states (or s single state) to check for - (``initialized``, ``running``, ``stopped``, + (``uninitialized``, ``initialized``, ``running``, ``stopped``, ``waiting``, ``aborted``, ``unknown``) Returns @@ -99,6 +99,20 @@ def load_controller(self, controller): response : str Service response from the controller manager ''' + # Check if the controller is already loaded + all_controllers = self.get_controllers_with_state() + loaded_controllers = self.get_controllers_with_state(['running','stopped','initialized']) + if self.debug: + print("ALL CONTROLLERS") + print(all_controllers) + print('\n'+"LOADED CONTROLLERS") + print(loaded_controllers) + + if str(controller) in loaded_controllers: + return True + + if self.debug: + print("LOADING CONTROLLER: %s"%(controller)) name = self.robot_name+'/controller_manager/load_controller' result = utils.call_service(name, LoadController, name=str(controller)) return result