13 from python_qt_binding.QtCore
import Signal, Slot, pyqtSlot
15 from python_qt_binding.QtGui
import QFrame, QVBoxLayout
17 from python_qt_binding.QtWidgets
import QFrame, QVBoxLayout
21 roslib.load_manifest(
'kobuki_qtestsuite')
24 from kobuki_testsuite
import TravelForward
27 import detail.common_rc
29 from detail.cliff_sensor_frame_ui
import Ui_cliff_sensor_frame
36 STATE_FORWARD =
"forward" 37 STATE_BACKWARD =
"backward" 38 STATE_STOPPED =
"stopped" 41 super(CliffSensorFrame, self).
__init__(parent)
42 self.
_ui = Ui_cliff_sensor_frame()
43 self.
_motion = TravelForward(
'/mobile_base/commands/velocity',
'/odom',
'/mobile_base/events/cliff')
46 self.
_state = CliffSensorFrame.STATE_FORWARD
51 self._ui.setupUi(self)
52 self._ui.start_button.setEnabled(
True)
53 self._ui.stop_button.setEnabled(
False)
54 self._motion.init(self._ui.speed_spinbox.value(), self.
_distance)
58 Used to terminate the plugin 60 rospy.loginfo(
"Kobuki TestSuite: cliff sensor shutdown")
61 self._motion.shutdown()
69 This gets called when the frame goes out of focus (tab switch). 70 Disable everything to avoid running N tabs in parallel when in 71 reality we are only running one. 77 Restore the frame after a hibernate. 87 if self.
_state == CliffSensorFrame.STATE_STOPPED:
89 elif self.
_state == CliffSensorFrame.STATE_FORWARD:
90 self.
_state = CliffSensorFrame.STATE_BACKWARD
91 self._motion.init(-self._motion.speed, 0.2)
93 self._motion_thread.start()
95 self.
_state = CliffSensorFrame.STATE_FORWARD
96 self._motion.init(-self._motion.speed, self.
_distance)
98 self._motion_thread.start()
105 self._ui.start_button.setEnabled(
False)
106 self._ui.stop_button.setEnabled(
True)
107 self.
_state = CliffSensorFrame.STATE_FORWARD
109 self._motion_thread.start()
113 self.
_state = CliffSensorFrame.STATE_STOPPED
119 self._motion_thread.wait()
120 self._ui.start_button.setEnabled(
True)
121 self._ui.stop_button.setEnabled(
False)
125 self._motion.init(self._ui.speed_spinbox.value(), self.
_distance)
def on_stop_button_clicked(self)
def __init__(self, parent=None)
def on_start_button_clicked(self)
Qt Callbacks.
def _run_finished(self)
Motion Callbacks.
def on_speed_spinbox_valueChanged(self, value)
def hibernate(self)
Widget Management.