diff --git a/safety_user_plugin/launch/user_plugin.launch b/safety_user_plugin/launch/user_plugin.launch index 1f4e185..26fc0cb 100644 --- a/safety_user_plugin/launch/user_plugin.launch +++ b/safety_user_plugin/launch/user_plugin.launch @@ -1,35 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/safety_user_plugin/scripts/qt_wrapper.py b/safety_user_plugin/scripts/qt_wrapper.py index d7e27d6..ef962ec 100644 --- a/safety_user_plugin/scripts/qt_wrapper.py +++ b/safety_user_plugin/scripts/qt_wrapper.py @@ -13,4 +13,14 @@ class QtWrapper: self.widget.textBrowser.setText('Sukces') + def connect_signals(self): + raise NotImplementedError + def select_robot(self,robot_id): + raise NotImplementedError + + def update_robots_list_gui(self,robots_id_list): + raise NotImplementedError + + def update_selected_robot_info(self,robot_info): + raise NotImplementedError \ No newline at end of file diff --git a/safety_user_plugin/scripts/robot_info.py b/safety_user_plugin/scripts/robot_info.py new file mode 100644 index 0000000..1301632 --- /dev/null +++ b/safety_user_plugin/scripts/robot_info.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + + + +class RobotInfo: + + def __init__(self): + raise(NotImplementedError) \ No newline at end of file diff --git a/safety_user_plugin/scripts/ros_wrapper.py b/safety_user_plugin/scripts/ros_wrapper.py index 8d98723..effa329 100644 --- a/safety_user_plugin/scripts/ros_wrapper.py +++ b/safety_user_plugin/scripts/ros_wrapper.py @@ -1,6 +1,16 @@ - +#!/usr/bin/env python class ROSWrapper: def __init__(self): - pass \ No newline at end of file + pass + + def setup_node(self): + raise NotImplementedError + + def select_robot(self,robot_id): + raise NotImplementedError + return False + + def set_robots_list_update_callback(self,callback_function): + self.robots_list_update_callback = callback_function diff --git a/safety_user_plugin/scripts/user_info.py b/safety_user_plugin/scripts/user_info.py new file mode 100644 index 0000000..fbe87e1 --- /dev/null +++ b/safety_user_plugin/scripts/user_info.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +class UserInfo: + + def __init__(self): + self.selected_robot_id = None + self.robots_id_list = [] + + def select_robot(self,robot_id): + self.selected_robot_id = robot_id + + def update_robots_list(self,robots_id_list): + self.robots_id_list = robots_id_list \ No newline at end of file diff --git a/safety_user_plugin/scripts/user_plugin.py b/safety_user_plugin/scripts/user_plugin.py index 62aa6f6..aef3ff4 100755 --- a/safety_user_plugin/scripts/user_plugin.py +++ b/safety_user_plugin/scripts/user_plugin.py @@ -9,6 +9,7 @@ from qt_gui.plugin import Plugin from qt_wrapper import QtWrapper from ros_wrapper import ROSWrapper from user_widget import UserWidget +from user_info import UserInfo class UserPlugin(Plugin): @@ -16,6 +17,48 @@ class UserPlugin(Plugin): super(UserPlugin, self).__init__(context) self.setObjectName('User Plugin - L1.5 safety system') - self.widget = UserWidget(context) - self.qt_wrapper = QtWrapper(self.widget) - self.ros_wrapper = ROSWrapper() \ No newline at end of file + self._widget = UserWidget(context) + self._qt_wrapper = QtWrapper(self._widget) + self._ros_wrapper = ROSWrapper() + self._user_info = UserInfo() + + # self.register_callback_functions() + + # At the end! + # self._qt_wrapper.connect_signals() + # self._ros_wrapper.setup_node() + + def register_callback_functions(self): + raise NotImplementedError + # self._ros_wrapper.set_robots_list_update_callback(self.handle_robots_list_update) + + + # ROS callback functions + def handle_robots_list_update(self,robots_id_list): + self._user_info.update_robots_list(robots_id_list) + self._qt_wrapper.update_robots_list_gui(robots_id_list) + + def handle_selected_robot_info_update(self,robot_info): + self._qt_wrapper.update_selected_robot_info(self,robot_info) + + def handle_master_stop_update(self,topic_state): + raise(NotImplementedError) + + # Qt callback functions + def handle_robot_selection(self,robot_id): + if self._user_info.selected_robot_id is None: + if self._ros_wrapper.select_robot(robot_id) == True: + self._qt_wrapper.select_robot(robot_id) + self._user_info.select_robot(robot_id) + else: + # TODO - raise ROS subscriptions problem exception + raise NotImplementedError + else: + # TODO - raise user already selected robot exception + raise NotImplementedError + + def handle_user_stop_button_update(self,button_state): + raise NotImplementedError + + def handle_clutch_switch(self,clutch_state): + raise NotImplementedError \ No newline at end of file