testsuite_widget.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #       
00003 # License: BSD
00004 #   https://raw.github.com/yujinrobot/kobuki_desktop/master/kobuki_qtestsuite/LICENSE 
00005 #
00006 ##############################################################################
00007 # Imports
00008 ##############################################################################
00009 
00010 import roslib
00011 roslib.load_manifest('kobuki_qtestsuite')
00012 import rospy
00013 
00014 from python_qt_binding.QtCore import Signal,Slot
00015 from python_qt_binding.QtGui import QWidget
00016 #from rqt_py_common.extended_combo_box import ExtendedComboBox
00017 
00018 from geometry_msgs.msg import Twist
00019 from nav_msgs.msg import Odometry
00020 
00021 # Local resource imports
00022 import detail.common_rc
00023 from detail.testsuite_ui import Ui_testsuite_widget
00024 
00025 class TestSuiteWidget(QWidget):
00026 
00027     def __init__(self, parent=None):
00028         super(TestSuiteWidget, self).__init__(parent)
00029         self._ui = Ui_testsuite_widget()
00030         self._tabs = []
00031         
00032     def setupUi(self):
00033         self._ui.setupUi(self)
00034         self._tabs = [self._ui.battery_profile_frame, 
00035                       self._ui.gyro_drift_frame, 
00036                       self._ui.payload_frame, 
00037                       self._ui.cliff_sensor_frame,
00038                       self._ui.life_frame,
00039                       self._ui.wandering_frame
00040                        ] 
00041         self._current_tab = self._tabs[self._ui.testsuite_tab_widget.currentIndex()]
00042         self._ui.configuration_dock.setupUi()
00043         self._ui.battery_profile_frame.setupUi(self._ui.configuration_dock.cmd_vel_topic_name())
00044         self._ui.gyro_drift_frame.setupUi()
00045         self._ui.payload_frame.setupUi()
00046         self._ui.cliff_sensor_frame.setupUi()
00047         self._ui.life_frame.setupUi()
00048         self._ui.wandering_frame.setupUi()
00049         #self.cmd_vel_publisher = rospy.Publisher(self._ui.configuration_dock.cmd_vel_topic_name(), Twist)
00050         #self.odom_subscriber = rospy.Subscriber(self._ui.configuration_dock.odom_topic_name(), Odometry, self.odometry_callback)
00051         ####################
00052         # Slot Callbacks
00053         ####################
00054         self._ui.configuration_dock._ui.cmd_vel_topic_combo_box.currentIndexChanged[str].connect(
00055                     self._ui.battery_profile_frame.on_cmd_vel_topic_combo_box_currentIndexChanged)
00056     
00057     def shutdown(self):
00058         self._ui.battery_profile_frame.shutdown()
00059         self._ui.gyro_drift_frame.shutdown()
00060         self._ui.wandering_frame.shutdown()
00061         self._ui.payload_frame.shutdown()
00062         self._ui.cliff_sensor_frame.shutdown()
00063         self._ui.life_frame.shutdown()
00064         
00065     ##########################################################################
00066     # Slot Callbacks
00067     ##########################################################################
00068     @Slot(str)
00069     def on_cmd_vel_topic_combo_box_currentIndexChanged(self, topic_name):
00070         # This is probably a bit broken, need to test with more than just /cmd_vel so
00071         # there is more than one option.
00072         print("Dude")
00073         self.cmd_vel_publisher = rospy.Publisher(str(self.cmd_vel_topic_combo_box.currentText()), Twist)
00074 
00075     @Slot(str)
00076     def on_odom_topic_combo_box_currentIndexChanged(self, topic_name):
00077         # Need to redo the subscriber here
00078         pass
00079     
00080     @Slot(int)
00081     def on_testsuite_tab_widget_currentChanged(self, index):
00082         self._current_tab.hibernate()
00083         self._current_tab = self._tabs[self._ui.testsuite_tab_widget.currentIndex()]
00084         self._current_tab.restore()
00085 


kobuki_qtestsuite
Author(s): Daniel Stonier
autogenerated on Wed Aug 26 2015 12:18:33