6 from PyQt4
import QtGui, QtCore
8 from python_qt_binding
import loadUi
9 from python_qt_binding.QtCore
import QEvent, QModelIndex, QObject, Qt, QTimer, Signal, Slot, QTimer
10 from python_qt_binding.QtGui
import QShortcut, QTableWidgetItem, QWidget, QLCDNumber, QItemDelegate, QAbstractItemView, QPen, QBrush, QColor, QTransform
11 from rospy
import Time
12 from std_msgs.msg
import Bool
13 from std_msgs.msg
import Float64, Float32, Empty
17 _update_task_delegates = Signal()
20 QObject.__init__(self, context)
21 self.setObjectName(
'TrackerBaseUi')
33 ui_file = os.path.join(rospkg.RosPack().get_path(
'tracker_base_ui'),
'lib',
'TrackerBaseUi.ui')
35 self._widget.setObjectName(
'TrackerBaseUi')
46 if context.serial_number() > 1:
47 self._widget.setWindowTitle(self._widget.windowTitle() + (
' (%d)' % context.serial_number()))
49 context.add_widget(self.
_widget)
62 self._widget.supply_lineEdit.setText(
'unknown')
67 self._widget.graphicsView_Flipper.setScene(self.
flipper_scene)
69 self._widget.graphicsView_Flipper.setRenderHint(QtGui.QPainter.Antialiasing)
71 self._widget.graphicsView_Flipper.show()
84 self._update_task_delegates.emit()
90 self.flipper_cmd +=0.1
107 self._WhiteLightPublisher.publish(value)
110 self._BlueLightPublisher.publish(value)
113 self._CalibFlipperPublisher.publish(Empty())
116 self._FlipperCommandPublisher.publish(0.5)
120 self._FlipperCommandPublisher.publish(0)
124 self._FlipperCommandPublisher.publish(-0.2)
129 self._widget.supply_lineEdit.setText(
'unknown')
131 self._widget.supply_lineEdit.setText(str(self.
supply))
136 y = length * math.cos(-angle)
137 x = length * math.sin(-angle)
138 return {
'y':y,
'x':x }
143 self.flipper_scene.addLine(200, 50+coords[
'x'], 300, 50+coords[
'x'])
148 self.flipper_scene.addLine(200, 100+coords[
'x'], 300, 100+coords[
'x'])
153 self._widget.flipper_front_current.setText(str(self.
flipper_state))
165 self.flipper_scene.clear()
171 self.flipper_scene.addRect(65, 60, 145, 25, QPen(), QBrush(QColor(255,0,0)))
174 self.flipper_scene.addEllipse(150, 50, 50, 50, QPen(), QBrush(QColor(0,0,0)))
177 self.flipper_scene.addEllipse(50, 50, 50, 50, QPen(), QBrush(QColor(0,0,0)))
180 transform = QTransform()
181 transform.translate(155,70)
183 transform.translate(-25,-25)
186 flipper_wheel = QtGui.QGraphicsEllipseItem(120,5, 50, 50)
187 flipper_wheel.setTransform(transform)
188 flipper_wheel.setBrush( QBrush(QColor(0,0,0)))
190 self.flipper_scene.addItem(flipper_wheel)
194 transform = QTransform()
195 transform.translate(160,75)
197 transform.translate(-10,-10)
198 flipper_link = QtGui.QGraphicsRectItem(0,0, 135, 20)
199 flipper_link.setBrush( QBrush(QColor(163,163,163)))
201 flipper_link.setTransform(transform)
203 self.flipper_scene.addItem(flipper_link)
206 self.flipper_scene.addEllipse(155, 70, 10, 10, QPen(), QBrush(QColor(0,0,0)))
208 transform = QTransform()
209 transform.translate(160,75)
211 transform.translate(-10,-10)
214 flipper_wheel_connection = QtGui.QGraphicsEllipseItem(120,5, 10, 10)
215 flipper_wheel_connection.setTransform(transform)
216 flipper_wheel_connection.setBrush( QBrush(QColor(0,0,0)))
218 self.flipper_scene.addItem(flipper_wheel_connection)
def _on_white_changed(self, value)
def _on_tracker_supply(self, message)
def save_settings(self, plugin_settings, instance_settings)
def _on_update_task_delegates(self)
def _on_calib_flipper_button_pressed(self)
def draw_flipper_state(self)
def _flipper_center_button_pressed(self)
def _flipper_up_button_pressed(self)
def _on_flipper_cmd(self, message)
def draw_flipper_max(self)
def draw_flipper_min(self)
def _flipper_down_button_pressed(self)
def __init__(self, context)
def restore_settings(self, plugin_settings, instance_settings)
def shutdown_plugin(self)
def compute_coordinates(self, angle)
def _on_flipper_state(self, message)
def _on_blue_changed(self, value)