14 from python_qt_binding.QtCore
import QObject, Signal, Slot, pyqtSlot, QTimer
16 from python_qt_binding.QtGui
import QFrame, QVBoxLayout
18 from python_qt_binding.QtWidgets
import QFrame, QVBoxLayout
23 from kobuki_testsuite
import Rotate
26 import detail.common_rc
28 from detail.life_frame_ui
import Ui_life_frame
35 STATE_STOPPED =
"stopped" 40 super(LifeFrame, self).
__init__(parent)
41 self.
_ui = Ui_life_frame()
42 self.
_motion = Rotate(
'/mobile_base/commands/velocity')
46 self._timer.setInterval(250)
48 self.
_state = LifeFrame.STATE_STOPPED
52 self._ui.setupUi(self)
53 self._ui.start_button.setEnabled(
True)
54 self._ui.stop_button.setEnabled(
False)
55 self._motion.init(self._ui.angular_speed_spinbox.value())
59 Used to terminate the plugin 61 rospy.loginfo(
"Kobuki TestSuite: life frame shutdown")
62 self._motion.shutdown()
70 This gets called when the frame goes out of focus (tab switch). 71 Disable everything to avoid running N tabs in parallel when in 72 reality we are only running one. 78 Restore the frame after a hibernate. 88 self.
_state = LifeFrame.STATE_RUN
89 self._ui.run_progress.reset()
90 self._ui.idle_progress.reset()
92 self._motion_thread.start()
95 self.
_state = LifeFrame.STATE_STOPPED
98 self._motion_thread.wait()
105 self._ui.start_button.setEnabled(
False)
106 self._ui.stop_button.setEnabled(
True)
114 self._ui.start_button.setEnabled(
True)
115 self._ui.stop_button.setEnabled(
False)
119 self._motion.init(self._ui.angular_speed_spinbox.value())
127 if self.
_state == LifeFrame.STATE_RUN:
128 new_value = self._ui.run_progress.value()+1
129 if new_value == self._ui.run_progress.maximum():
130 print(
" Switching to idle")
132 self.
_state = LifeFrame.STATE_IDLE
134 self._ui.run_progress.setValue(new_value)
135 if self.
_state == LifeFrame.STATE_IDLE:
136 new_value = self._ui.idle_progress.value()+1
137 if new_value == self._ui.idle_progress.maximum():
138 print(
" Switching to run")
141 self._ui.idle_progress.setValue(new_value)
def hibernate(self)
Widget Management.
def on_stop_button_clicked(self)
def start(self)
Motion Callbacks.
def update_progress_callback(self)
Timer Callbacks.
def __init__(self, parent=None)
def on_angular_speed_spinbox_valueChanged(self, value)
def on_start_button_clicked(self)
Qt Callbacks.