l1.5-safety-system/safety_user_plugin/scripts/user_plugin.py

64 lines
2.0 KiB
Python
Raw Normal View History

2018-09-17 18:29:00 +02:00
#!/usr/bin/env python
2018-09-17 18:29:00 +02:00
import os
import rospy
import rospkg
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
2018-09-17 18:29:00 +02:00
class UserPlugin(Plugin):
def __init__(self,context):
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()
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