configuration_dock_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 QDockWidget
00016 from rqt_py_common.extended_combo_box import ExtendedComboBox
00017 
00018 # Local resource imports
00019 import detail.common_rc
00020 from detail.configuration_dock_ui import Ui_configuration_dock_widget
00021 
00022 class ConfigurationDockWidget(QDockWidget):
00023 
00024     def __init__(self, parent=None):
00025         super(ConfigurationDockWidget, self).__init__(parent)
00026         
00027         self._ui = Ui_configuration_dock_widget()
00028         #self._ui.setupUi(self)
00029 
00030         
00031     def setupUi(self):
00032         self._ui.setupUi(self)
00033         _, _, topic_types = rospy.get_master().getTopicTypes()
00034         cmd_vel_topics = [ topic[0] for topic in topic_types if topic[1] == 'geometry_msgs/Twist' ]
00035         self._ui.cmd_vel_topic_combo_box.setItems.emit(sorted(cmd_vel_topics))
00036         #self.cmd_vel_publisher = rospy.Publisher(str(self.cmd_vel_topic_combo_box.currentText()), Twist)
00037         odom_topics = [ topic[0] for topic in topic_types if topic[1] == 'nav_msgs/Odometry' ]
00038         self._ui.odom_topic_combo_box.setItems.emit(sorted(odom_topics))
00039         #self.odom_subscriber = rospy.Subscriber(str(self.odom_topic_combo_box.currentText()), Odometry, self.odometry_callback)
00040         
00041     def cmd_vel_topic_name(self):
00042         return str(self._ui.cmd_vel_topic_combo_box.currentText())
00043 
00044     def odom_topic_name(self):
00045         return str(self._ui.odom_topic_combo_box.currentText())
00046         
00047     ##########################################################################
00048     # Slot Callbacks
00049     ##########################################################################
00050     @Slot(str)
00051     def on_cmd_vel_topic_combo_box_currentIndexChanged(self, topic_name):
00052         pass
00053         # This is probably a bit broken, need to test with more than just /cmd_vel so
00054         # there is more than one option.
00055         #self.cmd_vel_publisher = rospy.Publisher(str(self.cmd_vel_topic_combo_box.currentText()), Twist)
00056 
00057     @Slot(str)
00058     def on_odom_topic_combo_box_currentIndexChanged(self, topic_name):
00059         # Need to redo the subscriber here
00060         pass
00061 


kobuki_qtestsuite
Author(s): Daniel Stonier
autogenerated on Mon Oct 6 2014 01:31:16