def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_MagnetometerCalibrationPanel() self.ui.setupUi(self) self._is_running = False self._amount_axis = 3 self._axix_max = [0, 0, 0] self._axis_min = [0, 0, 0] self._axix_x = '0' self._axix_y = '1' self._axix_z = '2' self._is_connected = False self.ui.start.clicked.connect(self.start_magnetometer_calibration) self.ui.cancel.clicked.connect(self.cancel_magnetometer_calibration) vehicle_event_dispatcher.register( self._magnetometer_raw_data_updated, VehicleEventDispatcher.MAGNETOMETER_RAW_DATA_EVENT) ui_event_dispatcher.register( self._connection_state_changed, UIEventDispatcher.CONNECTION_STATE_CHANGED_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_PIDParametersUpdaterPanel() self.ui.setupUi(self) self.ui.pid_type_list.addItem("ACCRO") self.ui.pid_type_list.addItem("STABLE") self.ui.pid_type_list.clicked.connect(self._pid_list_selection_clicked) self.ui.pid_type_list.setCurrentRow(0) self._accro_pid_tuning_controller = AccroPIDTuningController( vehicle_event_dispatcher, ui_event_dispatcher) self.ui.panel_container.addWidget(self._accro_pid_tuning_controller) self.ui.panel_container.setCurrentIndex(0) self._stable_pid_tuning_controller = StablePIDTuningController( vehicle_event_dispatcher, ui_event_dispatcher) self.ui.panel_container.addWidget(self._stable_pid_tuning_controller) self.ui.beginner_radio_button.clicked.connect( self._beginner_radio_button_pressed) self.ui.intermediate_radio_button.clicked.connect( self._intermediate_radio_button_pressed) self.ui.advance_radio_button.clicked.connect( self._advanced_radio_button_pressed) self.ui.beginner_radio_button.setChecked(True) self._current_pid_tuning_controller = self._accro_pid_tuning_controller
def __init__(self, vehicle_model, protocol_handler): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.vehicle_model = vehicle_model self._protocol_handler = protocol_handler self.ui = Ui_SensorsCalibrationPanel() self.ui.setupUi(self) self.ui.start.clicked.connect(self.start_calibration) self.ui.cancel.clicked.connect(self.cancel_calibration) self.ui.cancel.setEnabled(False) self.state = 0 self.AmountReadings = 100 self.ReadingNumber = 0 self.AmountStates = 6 self.CalLevel = '0' self.CalUpsidedown = '1' self.CalLeft = '2' self.CalRight = '3' self.CalFront = '4' self.CalRear = '5' self.change_gui_picture(self.state)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_PIDParametersUpdaterPanel() self.ui.setupUi(self) self.ui.pid_type_list.addItem("ACCRO") self.ui.pid_type_list.addItem("STABLE") self.ui.pid_type_list.clicked.connect(self._pid_list_selection_clicked) self.ui.pid_type_list.setCurrentRow(0) self._accro_pid_tuning_controller = AccroPIDTuningController(vehicle_event_dispatcher, ui_event_dispatcher) self.ui.panel_container.addWidget(self._accro_pid_tuning_controller) self.ui.panel_container.setCurrentIndex(0) self._stable_pid_tuning_controller = StablePIDTuningController(vehicle_event_dispatcher, ui_event_dispatcher) self.ui.panel_container.addWidget(self._stable_pid_tuning_controller) self.ui.beginner_radio_button.clicked.connect(self._beginner_radio_button_pressed) self.ui.intermediate_radio_button.clicked.connect(self._intermediate_radio_button_pressed) self.ui.advance_radio_button.clicked.connect(self._advanced_radio_button_pressed) self.ui.beginner_radio_button.setChecked(True) self._current_pid_tuning_controller = self._accro_pid_tuning_controller
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_DataPlotPanel() self.ui.setupUi(self) self.ui.plot_view.setRange(xRange=(0, 128), padding=0.0) self.ui.plot_view.clear() self.ui.plot_view.setBackground(QtGui.QColor('white')) self.ui.tree_widget.clear() self._plot_index = 0 self._plot_datas_arrays = [] self._curves = [] self._tree_nodes = [] vehicle_event_dispatcher.register(self._receiver_nb_channels_received, VehicleEventDispatcher.RECEIVER_NB_CHANNEL_EVENT) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register(self._receiver_roll_event, VehicleEventDispatcher.RECEIVER_ROLL_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_pitch_event, VehicleEventDispatcher.RECEIVER_PITCH_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_yaw_event, VehicleEventDispatcher.RECEIVER_YAW_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_throttle_event, VehicleEventDispatcher.RECEIVER_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_mode_event, VehicleEventDispatcher.RECEIVER_MODE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux1_event, VehicleEventDispatcher.RECEIVER_AUX1_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux2_event, VehicleEventDispatcher.RECEIVER_AUX2_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux3_event, VehicleEventDispatcher.RECEIVER_AUX3_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux4_event, VehicleEventDispatcher.RECEIVER_AUX4_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux5_event, VehicleEventDispatcher.RECEIVER_AUX5_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux6_event, VehicleEventDispatcher.RECEIVER_AUX6_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux7_event, VehicleEventDispatcher.RECEIVER_AUX7_PROPERTY_EVENT)
def __init__(self, vehicle_model, protocol_handler): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self._vehicle_model = vehicle_model self._protocol_handler = protocol_handler self.ui = Ui_MagnetometerCalibrationPanel() self.ui.setupUi(self) self._is_running = False self._amount_axis = 3 self._axix_max = [0, 0, 0] # x y z self._axis_min = [0, 0, 0] # x y z self._axix_x = '0' self._axix_y = '1' self._axix_z = '2' self._is_connected = False self.ui.start.clicked.connect(self.start_magnetometer_calibration) self.ui.cancel.clicked.connect(self.cancel_magnetometer_calibration) self._vehicle_model.register(self._magnetometer_raw_data_updated, VehicleModel.MAGNETOMETER_RAW_DATA_EVENT) self._vehicle_model.register(self._connection_state_changed, VehicleModel.CONNECTION_STATE_CHANGED_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_DataPlotPanel() self.ui.setupUi(self) self.ui.plot_view.setRange(xRange=(0, 128), padding=0.0) self.ui.plot_view.clear() self.ui.plot_view.setBackground(QtGui.QColor('white')) self.ui.tree_widget.clear() self._plot_index = 0 self._plot_datas_arrays = [] self._curves = [] colors = [ QtGui.QColor('blue'), QtGui.QColor('red'), QtGui.QColor('lime'), QtGui.QColor('cornflowerblue'), QtGui.QColor('greenyellow'), QtGui.QColor('violet'), QtGui.QColor('orange'), QtGui.QColor('deepskyblue'), QtGui.QColor('firebrick'), QtGui.QColor('aqua') ] self.gyro_parent = QtGui.QTreeWidgetItem(self.ui.tree_widget) self.gyro_parent.setCheckState(0, 2) self.gyro_parent.setText(0, 'Gyro') self.gyro_parent.addChild( self.createPlotLine(0, colors[0], 'Gyro X Axis')) self.gyro_parent.addChild( self.createPlotLine(1, colors[1], 'Gyro Y Axis')) self.gyro_parent.addChild( self.createPlotLine(2, colors[2], 'Gyro Z Axis')) self.ui.tree_widget.expandItem(self.gyro_parent) self.accel_parent = QtGui.QTreeWidgetItem(self.ui.tree_widget) self.accel_parent.setCheckState(0, 2) self.accel_parent.setText(0, 'Accel') self.accel_parent.addChild( self.createPlotLine(3, colors[3], 'Accel X Axis')) self.accel_parent.addChild( self.createPlotLine(4, colors[4], 'Accel Y Axis')) self.accel_parent.addChild( self.createPlotLine(5, colors[5], 'Accel Z Axis')) self.ui.tree_widget.expandItem(self.accel_parent) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register( self._gyro_raw_data_receved, VehicleEventDispatcher.GYRO_DATA_EVENT) vehicle_event_dispatcher.register( self._accel_raw_data_receved, VehicleEventDispatcher.ACCEL_DATA_EVENT) vehicle_event_dispatcher.register( self._mag_raw_data_receved, VehicleEventDispatcher.MAGNETOMETER_DATA_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_MotorCommandPanel() self.ui.setupUi(self) self._motor_slider1 = MotorSlider(1) self.ui.gridLayout.addWidget(self._motor_slider1, 0, 0, 1, 1) self._motor_slider2 = MotorSlider(2) self.ui.gridLayout.addWidget(self._motor_slider2, 0, 1, 1, 1) self._motor_slider3 = MotorSlider(3) self.ui.gridLayout.addWidget(self._motor_slider3, 0, 2, 1, 1) self._motor_slider4 = MotorSlider(4) self.ui.gridLayout.addWidget(self._motor_slider4, 0, 3, 1, 1) self._motor_slider5 = MotorSlider(5) self.ui.gridLayout.addWidget(self._motor_slider5, 0, 4, 1, 1) self._motor_slider6 = MotorSlider(6) self.ui.gridLayout.addWidget(self._motor_slider6, 0, 5, 1, 1) self._motor_slider7 = MotorSlider(7) self.ui.gridLayout.addWidget(self._motor_slider7, 0, 4, 1, 1) self._motor_slider8 = MotorSlider(8) self.ui.gridLayout.addWidget(self._motor_slider8, 0, 5, 1, 1) self.ui.unlock_check_box.stateChanged.connect(self._check_box_state_changed) self.ui.send_command_button.clicked.connect(self._send_motors_commands) self.ui.stop_all_motors_button.clicked.connect(self._send_stop_commands) self.ui.help_button.clicked.connect(self._display_help_image) self._timer = None ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register(self._nb_motors_received, VehicleEventDispatcher.NUMBER_MOTORS_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_DataPlotPanel() self.ui.setupUi(self) self.ui.plot_view.setRange(xRange=(0, 128), padding=0.0) self.ui.plot_view.clear() self.ui.plot_view.setBackground(QtGui.QColor('white')) self.ui.tree_widget.clear() self._plot_index = 0 self._plot_datas_arrays = [] self._curves = [] self._tree_nodes = [] vehicle_event_dispatcher.register( self._receiver_nb_channels_received, VehicleEventDispatcher.RECEIVER_NB_CHANNEL_EVENT) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register( self._receiver_roll_event, VehicleEventDispatcher.RECEIVER_ROLL_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_pitch_event, VehicleEventDispatcher.RECEIVER_PITCH_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_yaw_event, VehicleEventDispatcher.RECEIVER_YAW_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_throttle_event, VehicleEventDispatcher.RECEIVER_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_mode_event, VehicleEventDispatcher.RECEIVER_MODE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux1_event, VehicleEventDispatcher.RECEIVER_AUX1_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux2_event, VehicleEventDispatcher.RECEIVER_AUX2_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux3_event, VehicleEventDispatcher.RECEIVER_AUX3_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux4_event, VehicleEventDispatcher.RECEIVER_AUX4_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux5_event, VehicleEventDispatcher.RECEIVER_AUX5_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux6_event, VehicleEventDispatcher.RECEIVER_AUX6_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux7_event, VehicleEventDispatcher.RECEIVER_AUX7_PROPERTY_EVENT)
def __init__(self, vehicle_model, protocol_handler): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self._vehicle_model = vehicle_model self._protocol_handler = protocol_handler self.ui = Ui_DataPlotPanel() self.ui.setupUi(self)
def __init__(self, vehicle_model, message_sender): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.vehicle_model = vehicle_model self.message_sender = message_sender self.ui = Ui_DataPlotPanel() self.ui.setupUi(self)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_ReceiverCalibrationPanel() self.ui.setupUi(self) self.ui.start_button.setEnabled(True) self.ui.cancel_button.setEnabled(False) leftStickScene = QtGui.QGraphicsScene() leftStickBackground = QtGui.QPixmap("./resources/TxDial.png") leftStickItem = QtGui.QGraphicsPixmapItem(leftStickBackground) leftStickScene.addItem(leftStickItem) self.leftStick = QtGui.QGraphicsEllipseItem(QtCore.QRectF(75, 75, 30, 30)) self.leftStick.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.leftStick.setBrush(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) leftStickScene.addItem(self.leftStick) self.ui.left_transmitter.setScene(leftStickScene) rightStickScene = QtGui.QGraphicsScene() rightStickBackground = QtGui.QPixmap("./resources/TxDial.png") rightStickItem = QtGui.QGraphicsPixmapItem(rightStickBackground) rightStickScene.addItem(rightStickItem) self.rightStick = QtGui.QGraphicsEllipseItem(QtCore.QRectF(75, 75, 30, 30)) self.rightStick.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.rightStick.setBrush(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) rightStickScene.addItem(self.rightStick) self.ui.right_transmitter.setScene(rightStickScene) self._nb_channels = 12 self._raw_receiver_min_values = [1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500] self._raw_receiver_max_values = [1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500] self.max_amount_channels = 12 self._raw_roll = 1500 self._raw_pitch = 1500 self._raw_yaw = 1500 self._raw_throttle = 1500 self.ui.start_button.clicked.connect(self.start_RCcalibration) self.ui.cancel_button.clicked.connect(self._cancel_calibration) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register(self._receiver_channel_count_received, VehicleEventDispatcher.RECEIVER_NB_CHANNEL_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_roll_received, VehicleEventDispatcher.RECEIVER_ROLL_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_pitch_received, VehicleEventDispatcher.RECEIVER_PITCH_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_yaw_received, VehicleEventDispatcher.RECEIVER_YAW_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_throttle_received, VehicleEventDispatcher.RECEIVER_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_mode_received, VehicleEventDispatcher.RECEIVER_MODE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_aux1_received, VehicleEventDispatcher.RECEIVER_AUX1_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_aux2_received, VehicleEventDispatcher.RECEIVER_AUX2_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_aux3_received, VehicleEventDispatcher.RECEIVER_AUX3_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_aux4_received, VehicleEventDispatcher.RECEIVER_AUX4_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_aux5_received, VehicleEventDispatcher.RECEIVER_AUX5_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_aux6_received, VehicleEventDispatcher.RECEIVER_AUX6_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_raw_aux7_received, VehicleEventDispatcher.RECEIVER_AUX7_PROPERTY_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_PIDTuningPanel() self.ui.setupUi(self) self._current_roll_pid = PIDData(100, 150, -300) self._current_pitch_pid = PIDData(100, 150, -300) self._current_stick_scaling = 1 self._is_starting = False self._user_update_mode = PIDUpdateMode.BEGINNER_MODE self._roll_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._roll_pid_controller) self._roll_pid_controller.set_title('PID tuning') self._roll_pid_controller.set_default(PIDData(100, 150, -350)) self._roll_pid_controller.set_p_bounds(50, 200) self._roll_pid_controller.set_p_title('Pitch Gain') self._roll_pid_controller.set_i_bounds(100, 300) self._roll_pid_controller.set_i_title('Error correction') self._roll_pid_controller.set_d_bounds(-1000, -100) self._roll_pid_controller.set_d_title('Set Point') self._pitch_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._pitch_pid_controller) self._pitch_pid_controller.set_title('PID tuning') self._pitch_pid_controller.set_default(PIDData(100, 150, -350)) self._pitch_pid_controller.set_p_bounds(50, 200) self._pitch_pid_controller.set_p_title('Pitch Gain') self._pitch_pid_controller.set_i_bounds(100, 300) self._pitch_pid_controller.set_i_title('Error correction') self._pitch_pid_controller.set_d_bounds(-1000, -100) self._pitch_pid_controller.set_d_title('Set Point') self._stick_scaling_controller = ConfigSingleLinePanelController() self._stick_scaling_controller.set_title('Stick Scaling') self._stick_scaling_controller.set_line_description('Stick Scaling') self._stick_scaling_controller.set_bounds(1, 6) self._stick_scaling_controller.set_default('1') self.ui.main_layout.addWidget(self._stick_scaling_controller) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register( self._roll_pid_received, VehicleEventDispatcher.PID_ACCRO_ROLL) vehicle_event_dispatcher.register( self._pitch_pid_received, VehicleEventDispatcher.PID_ACCRO_PITCH) vehicle_event_dispatcher.register( self._accro_stick_scaling_received, VehicleEventDispatcher.PID_ACCRO_STICK_SCALING) self._cpt_before_send = 5 self.set_beginner_mode()
def __init__(self, vehicle_event_dispatcher, protocol_handler): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_MainMenuePanel() self.ui.setupUi(self) self.ui.button_vehicle_status.clicked.connect(self.load_vehicle_status) self.ui.button_vehicle_configuration.clicked.connect(self.load_vehicle_configuration) self.ui.button_serial_monitor.clicked.connect(self.load_serial_monitor) self.ui.button_firmware_download.clicked.connect(self.load_firmware_download) self.ui.button_vehicle_setup.clicked.connect(self.load_vehicle_setup)
def __init__(self, vehicle_event_dispatcher, protocol_handler): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_CommMonitorPanel() self.ui.setupUi(self) self.ui.sendButton.setEnabled(False) self.ui.clearButton.setEnabled(False) # Connect GUI slots and signals self.ui.lineEdit.returnPressed.connect(self.sendCommand) self.ui.sendButton.clicked.connect(self.sendCommand) self.ui.clearButton.clicked.connect(self.clearComm)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_PIDTuningPanel() self.ui.setupUi(self) self._accel_roll_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._accel_roll_pid_controller) self._accel_roll_pid_controller.hide_i_line() self._accel_roll_pid_controller.hide_d_line() self._accel_roll_pid_controller.p_line.ui.label.setText( 'Accel Roll Gain') self._accel_roll_pid_controller.i_line.ui.label.setText( 'Accel Roll Error Correction') self._accel_roll_pid_controller.d_line.ui.label.setText( 'Accel Roll Set Point Adjustment') self._gyro_roll_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._gyro_roll_pid_controller) self._gyro_roll_pid_controller.hide_i_line() self._gyro_roll_pid_controller.p_line.ui.label.setText( 'Gyro Roll Gain') self._gyro_roll_pid_controller.i_line.ui.label.setText( 'Gyro Roll Error Correction') self._gyro_roll_pid_controller.d_line.ui.label.setText( 'Gyro Roll Set Point Adjustment') self._accel_pitch_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._accel_pitch_pid_controller) self._accel_pitch_pid_controller.hide_i_line() self._accel_pitch_pid_controller.hide_d_line() self._accel_pitch_pid_controller.p_line.ui.label.setText( 'Accel Pitch Gain') self._accel_pitch_pid_controller.i_line.ui.label.setText( 'Accel Pitch Error Correction') self._accel_pitch_pid_controller.d_line.ui.label.setText( 'Accel Pitch Set Point Adjustment') self._gyro_pitch_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._gyro_pitch_pid_controller) self._gyro_pitch_pid_controller.p_line.ui.label.setText( 'Gyro Pitch Gain') self._gyro_pitch_pid_controller.i_line.ui.label.setText( 'Gyro Pitch Error Correction') self._gyro_pitch_pid_controller.d_line.ui.label.setText( 'Gyro Pitch Set Point Adjustment') self.setBeginnerMode() self.ui.linked_check_box.clicked.connect(self._linked_checkbox_pressed) self._linked_checkbox_pressed()
def __init__(self, vehicle_model, message_sender): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.vehicle_model = vehicle_model self.message_sender = message_sender self.ui = Ui_VehicleConfigurationPanel() self.ui.setupUi(self) self.image = QtGui.QPixmap("./resources/Quad+.png") self.ui.updateButton.clicked.connect(self.updateConfiguration)
def __init__(self, vehicle_event_dispatcher, protocol_handler): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_MainMenuePanel() self.ui.setupUi(self) self.ui.button_vehicle_status.clicked.connect(self.load_vehicle_status) self.ui.button_vehicle_configuration.clicked.connect( self.load_vehicle_configuration) self.ui.button_serial_monitor.clicked.connect(self.load_serial_monitor) self.ui.button_firmware_download.clicked.connect( self.load_firmware_download) self.ui.button_vehicle_setup.clicked.connect(self.load_vehicle_setup)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher, parent=None): super(MotorCommandController, self).__init__(parent) BasePanelController.__init__(self) self.ui = MotorCommandPanel() self.ui.setupUi(self) self.ui.sendButton.setEnabled(False) self.ui.clearButton.setEnabled(False) self.started = False # Connect GUI slots and signals self.ui.sendButton.clicked.connect(self.sendCommand) self.ui.clearButton.clicked.connect(self.clearCommand)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_PIDTuningPanel() self.ui.setupUi(self) self._current_roll_pid = PIDData(100,150,-300) self._current_pitch_pid = PIDData(100,150,-300) self._current_stick_scaling = 1 self._is_starting = False self._user_update_mode = PIDUpdateMode.BEGINNER_MODE self._roll_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._roll_pid_controller) self._roll_pid_controller.set_title('PID tuning') self._roll_pid_controller.set_default(PIDData(100,150,-350)) self._roll_pid_controller.set_p_bounds(50,200) self._roll_pid_controller.set_p_title('Pitch Gain') self._roll_pid_controller.set_i_bounds(100,300) self._roll_pid_controller.set_i_title('Error correction') self._roll_pid_controller.set_d_bounds(-1000,-100) self._roll_pid_controller.set_d_title('Set Point') self._pitch_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._pitch_pid_controller) self._pitch_pid_controller.set_title('PID tuning') self._pitch_pid_controller.set_default(PIDData(100,150,-350)) self._pitch_pid_controller.set_p_bounds(50,200) self._pitch_pid_controller.set_p_title('Pitch Gain') self._pitch_pid_controller.set_i_bounds(100,300) self._pitch_pid_controller.set_i_title('Error correction') self._pitch_pid_controller.set_d_bounds(-1000,-100) self._pitch_pid_controller.set_d_title('Set Point') self._stick_scaling_controller = ConfigSingleLinePanelController() self._stick_scaling_controller.set_title('Stick Scaling') self._stick_scaling_controller.set_line_description('Stick Scaling') self._stick_scaling_controller.set_bounds(1,6) self._stick_scaling_controller.set_default('1') self.ui.main_layout.addWidget(self._stick_scaling_controller) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register(self._roll_pid_received, VehicleEventDispatcher.PID_ACCRO_ROLL) vehicle_event_dispatcher.register(self._pitch_pid_received, VehicleEventDispatcher.PID_ACCRO_PITCH) vehicle_event_dispatcher.register(self._accro_stick_scaling_received, VehicleEventDispatcher.PID_ACCRO_STICK_SCALING) self._cpt_before_send = 5 self.set_beginner_mode()
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_AccelCalibrationPanel() self.ui.setupUi(self) self.ui.start_button.clicked.connect(self._start_button_pressed) self.ui.cancel_button.clicked.connect(self._cancel_button_pressed) self.ui.progress_bar.setMaximum(AccelCalibrationController.NB_SAMPLE_TO_READ) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register(self._accel_raw_data_received, VehicleEventDispatcher.ACCEL_RAW_DATA_EVENT) self._set_initial_panel_state()
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_VehicleConfigurationPanel() self.ui.setupUi(self) self.ui.configSpecs.setRowCount(15) self.ui.configSpecs.setColumnCount(1) self._reset_panel() ui_event_dispatcher.register( self._connection_state_changed, UIEventDispatcher.CONNECTION_STATE_CHANGED_EVENT) vehicle_event_dispatcher.register( self._flight_config_received, VehicleEventDispatcher.FLIGHT_CONFIG_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.BOAR_TYPE_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.RECEIVER_TYPE_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.RECEIVER_NB_CHANNEL_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.NUMBER_MOTORS_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.GYROSCOPE_DETECTED_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.ACCELEROMETER_DETECTED_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.BAROMETER_DETECTED_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.MAGNETOMETER_DETECTED_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.HEADING_HOLD_ENABLED_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.ALTITUDE_HOLD_ENABLED_EVENT) vehicle_event_dispatcher.register( self._board_config_received, VehicleEventDispatcher.BATTERY_MONITOR_ENABLED_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_PIDParametersUpdaterPanel() self.ui.setupUi(self) self.ui.parameterTable.verticalHeader().setVisible(False) self.ui.buttonLoad.setEnabled(False) self.ui.buttonSave.setEnabled(False) self.ui.buttonUpload.setEnabled(False) self.ui.listParameterType.clicked.connect(self.updateSelection) self.ui.buttonUpload.clicked.connect(self.updateParameters) self.ui.buttonSave.clicked.connect(self.underConstruction) self.ui.buttonLoad.clicked.connect(self.underConstruction)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_DataPlotPanel() self.ui.setupUi(self) self.ui.plot_view.setRange(xRange=(0, 128), padding=0.0) self.ui.plot_view.clear() self.ui.plot_view.setBackground(QtGui.QColor('white')) self.ui.tree_widget.clear() self._plot_index = 0 self._plot_datas_arrays = [] self._curves = [] self._colors = [ QtGui.QColor('blue'), QtGui.QColor('red'), QtGui.QColor('lime'), QtGui.QColor('cornflowerblue'), QtGui.QColor('greenyellow'), QtGui.QColor('violet'), QtGui.QColor('orange'), QtGui.QColor('deepskyblue'), QtGui.QColor('firebrick'), QtGui.QColor('aqua')] self.gyro_parent = QtGui.QTreeWidgetItem(self.ui.tree_widget) self.gyro_parent.setCheckState(0, 2) self.gyro_parent.setText(0, 'Gyro') self.gyro_parent.addChild (self.createPlotLine(0, self._colors[0], 'Gyro X Axis')) self.gyro_parent.addChild (self.createPlotLine(1, self._colors[1], 'Gyro Y Axis')) self.gyro_parent.addChild (self.createPlotLine(2, self._colors[2], 'Gyro Z Axis')) self.ui.tree_widget.expandItem(self.gyro_parent) self.accel_parent = QtGui.QTreeWidgetItem(self.ui.tree_widget) self.accel_parent.setCheckState(0, 2) self.accel_parent.setText(0, 'Accel') self.accel_parent.addChild (self.createPlotLine(3, self._colors[3], 'Accel X Axis')) self.accel_parent.addChild (self.createPlotLine(4, self._colors[4], 'Accel Y Axis')) self.accel_parent.addChild (self.createPlotLine(5, self._colors[5], 'Accel Z Axis')) self.ui.tree_widget.expandItem(self.accel_parent) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register(self._gyro_raw_data_receved, VehicleEventDispatcher.GYRO_DATA_EVENT) vehicle_event_dispatcher.register(self._accel_raw_data_receved, VehicleEventDispatcher.ACCEL_DATA_EVENT) vehicle_event_dispatcher.register(self._mag_raw_data_receved, VehicleEventDispatcher.MAGNETOMETER_DATA_EVENT) vehicle_event_dispatcher.register(self._is_magnetometer_detected_event, VehicleEventDispatcher.MAGNETOMETER_DETECTED_EVENT)
def __init__(self, vehicle_model, message_sender): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.vehicle_model = vehicle_model self.message_sender = message_sender self.ui = Ui_CommMonitorPanel() self.ui.setupUi(self) self.ui.sendButton.setEnabled(False) self.ui.clearButton.setEnabled(False) # Connect GUI slots and signals self.ui.lineEdit.returnPressed.connect(self.sendCommand) self.ui.sendButton.clicked.connect(self.sendCommand) self.ui.clearButton.clicked.connect(self.clearComm)
def __init__(self, vehicle_model, message_sender, parent=None): super(MotorCommandController, self).__init__(parent) BasePanelController.__init__(self) self.vehicle_model = vehicle_model self.message_sender = message_sender self.started = False self.ui = MotorCommandPanel() self.ui.setupUi(self) self.ui.sendButton.setEnabled(False) self.ui.clearButton.setEnabled(False) # Connect GUI slots and signals self.ui.sendButton.clicked.connect(self.sendCommand) self.ui.clearButton.clicked.connect(self.clearCommand)
def __init__(self, vehicle_event_dispatcher, protocol_handler): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_ReceiverChannelDetectionPanel() self.ui.setupUi(self) self.ui.start.setEnabled(True) self.ui.cancel.setEnabled(False) self.ui.cancel.clicked.connect(self.cancel_RC) self.ui.start.clicked.connect(self.start_RCsetup) self.amount_channels = 12 self.last_RCvalue = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] self.first_loop = 80 self.channel_order_map = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100] self.channel_detecting = 0 self.running = False self.channel_offset = 200 self.max_amount_channels = 12
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_MagnetometerCalibrationPanel() self.ui.setupUi(self) self._min_mag_values = [0, 0, 0] self._max_mag_values = [0, 0, 0] self._axix_x = '0' self._axix_y = '1' self._axix_z = '2' self.ui.start_button.clicked.connect(self._start_button_pressed) self.ui.cancel_button.clicked.connect(self._cancel_button_pressed) vehicle_event_dispatcher.register(self._magnetometer_raw_data_updated, VehicleEventDispatcher.MAGNETOMETER_RAW_DATA_EVENT) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_AccelCalibrationPanel() self.ui.setupUi(self) self.ui.start_button.clicked.connect(self._start_button_pressed) self.ui.cancel_button.clicked.connect(self._cancel_button_pressed) self.ui.progress_bar.setMaximum( AccelCalibrationController.NB_SAMPLE_TO_READ) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register( self._accel_raw_data_received, VehicleEventDispatcher.ACCEL_RAW_DATA_EVENT) self._set_initial_panel_state()
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_PIDTuningPanel() self.ui.setupUi(self) self._gyro_roll_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._gyro_roll_pid_controller) self._gyro_pitch_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._gyro_pitch_pid_controller) self._gyro_pitch_pid_controller.p_line.ui.label.setText('Pitch Gain') self._gyro_pitch_pid_controller.i_line.ui.label.setText('Pitch Error Correction') self._gyro_pitch_pid_controller.d_line.ui.label.setText('Pitch Set Point Adjustment') self.setBeginnerMode() self.ui.linked_check_box.clicked.connect(self._linked_checkbox_pressed) self._linked_checkbox_pressed()
def __init__(self, vehicle_event_dispatcher, protocol_handler): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_ReceiverChannelDetectionPanel() self.ui.setupUi(self) self.ui.start.setEnabled(True) self.ui.cancel.setEnabled(False) self.ui.cancel.clicked.connect(self.cancel_RC) self.ui.start.clicked.connect(self.start_RCsetup) self.amount_channels = 12 self.last_RCvalue = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] self.first_loop = 80 self.channel_order_map = [ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 ] self.channel_detecting = 0 self.running = False self.channel_offset = 200 self.max_amount_channels = 12
def __init__(self, vehicle_event_dispatcher, protocol_handler): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_VehicleDynamicConfigPanel() self.ui.setupUi(self) self.ui.updateButton.clicked.connect(self._send_mini_config) palette = QtGui.QPalette() palette.setColor(QtGui.QPalette.Foreground, QtCore.Qt.white) self.ui.receiverTitle.setPalette(palette) self.ui.motorTitle.setPalette(palette) self.ui.triBox.clicked.connect(self.triCheckBoxPressed) self.ui.quadBox.clicked.connect(self.quadCheckBoxPressed) self.ui.quadPlusBox.clicked.connect(self.quadPlusCheckBoxPressed) self.ui.quadY4Box.clicked.connect(self.y4CheckBoxPressed) self.ui.y6Box.clicked.connect(self.y6CheckBoxPressed) self.ui.hexaPlusBox.clicked.connect(self.hexPlusCheckBoxPressed) self.ui.hexaXBox.clicked.connect(self.hexXCheckBoxPressed) self.ui.reverseRotation.clicked.connect( self.reverseRotationCheckBoxPressed) self.ui.ppmRecv.clicked.connect(self.ppmReceiverCheckBoxPressed) self.ui.normalRecv.clicked.connect(self.normalReceiverCheckBoxPressed) self._flight_config_type = FlightConfigType.QUAD_X self._receiver_type = ReceiverConfigType.RECEIVER_PWM self._reversed_yaw = '1' self._selected_flight_config = FlightConfigType.QUAD_X self._selected_receiver_config = ReceiverConfigType.RECEIVER_PWM self._selected_reversed_yaw_rotation = '1' self._update_panel_component() vehicle_event_dispatcher.register( self._flight_config_updated, VehicleEventDispatcher.FLIGHT_CONFIG_EVENT) vehicle_event_dispatcher.register( self._yaw_direction_updated, VehicleEventDispatcher.YAW_DIRECTION_CONFIG_EVENT) vehicle_event_dispatcher.register( self._receiver_type_updated, VehicleEventDispatcher.RECEIVER_TYPE_EVENT)
def __init__(self, vehicle_model, message_sender): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.vehicle_model = vehicle_model self.message_sender = message_sender self.ui = Ui_ReceiverCalibrationPanel() self.ui.setupUi(self) self.ui.start.setEnabled(True) self.ui.cancel.setEnabled(False) leftStickScene = QtGui.QGraphicsScene() leftStickBackground = QtGui.QPixmap("./resources/TxDial.png") leftStickItem = QtGui.QGraphicsPixmapItem(leftStickBackground) leftStickScene.addItem(leftStickItem) self.leftStick = QtGui.QGraphicsEllipseItem(QtCore.QRectF(75, 75, 30, 30)) self.leftStick.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.leftStick.setBrush(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) leftStickScene.addItem(self.leftStick) self.ui.leftTransmitter.setScene(leftStickScene) rightStickScene = QtGui.QGraphicsScene() rightStickBackground = QtGui.QPixmap("./resources/TxDial.png") rightStickItem = QtGui.QGraphicsPixmapItem(rightStickBackground) rightStickScene.addItem(rightStickItem) self.rightStick = QtGui.QGraphicsEllipseItem(QtCore.QRectF(75, 75, 30, 30)) self.rightStick.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.rightStick.setBrush(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) rightStickScene.addItem(self.rightStick) self.ui.rightTransmitter.setScene(rightStickScene) self.running = False self.amount_channels = 12 self.RCmin = [1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500] self.RCmax = [1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500] self.max_amount_channels = 12 self.ui.start.clicked.connect(self.start_RCcalibration) self.ui.cancel.clicked.connect(self.cancel_RCcalibration)
def __init__(self, vehicle_model, message_sender): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.vehicle_model = vehicle_model self.message_sender = message_sender self.ui = Ui_MagnetometerCalibrationPanel() self.ui.setupUi(self) self.running = False self.amount_axis = 3 self.axix_max = [0, 0, 0] # x y z self.axis_min = [0, 0, 0] # x y z self.axix_x = '0' self.axix_y = '1' self.axix_z = '2' self.ui.start.clicked.connect(self.start_magnetometer_calibration) self.ui.cancel.clicked.connect(self.cancel_magnetometer_calibration)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_MagnetometerCalibrationPanel() self.ui.setupUi(self) self._min_mag_values = [0, 0, 0] self._max_mag_values = [0, 0, 0] self._axix_x = '0' self._axix_y = '1' self._axix_z = '2' self.ui.start_button.clicked.connect(self._start_button_pressed) self.ui.cancel_button.clicked.connect(self._cancel_button_pressed) vehicle_event_dispatcher.register( self._magnetometer_raw_data_updated, VehicleEventDispatcher.MAGNETOMETER_RAW_DATA_EVENT) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_MagnetometerCalibrationPanel() self.ui.setupUi(self) self._is_running = False self._amount_axis = 3 self._axix_max = [0, 0, 0] self._axis_min = [0, 0, 0] self._axix_x = '0' self._axix_y = '1' self._axix_z = '2' self._is_connected = False self.ui.start.clicked.connect(self.start_magnetometer_calibration) self.ui.cancel.clicked.connect(self.cancel_magnetometer_calibration) vehicle_event_dispatcher.register(self._magnetometer_raw_data_updated, VehicleEventDispatcher.MAGNETOMETER_RAW_DATA_EVENT) ui_event_dispatcher.register(self._connection_state_changed, UIEventDispatcher.CONNECTION_STATE_CHANGED_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_PIDTuningPanel() self.ui.setupUi(self) self._accel_roll_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._accel_roll_pid_controller) self._accel_roll_pid_controller.hide_i_line() self._accel_roll_pid_controller.hide_d_line() self._accel_roll_pid_controller.p_line.ui.title_label.setText('Accel Roll Gain') self._accel_roll_pid_controller.i_line.ui.title_label.setText('Accel Roll Error Correction') self._accel_roll_pid_controller.d_line.ui.title_label.setText('Accel Roll Set Point Adjustment') self._gyro_roll_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._gyro_roll_pid_controller) self._gyro_roll_pid_controller.hide_i_line() self._gyro_roll_pid_controller.p_line.ui.title_label.setText('Gyro Roll Gain') self._gyro_roll_pid_controller.i_line.ui.title_label.setText('Gyro Roll Error Correction') self._gyro_roll_pid_controller.d_line.ui.title_label.setText('Gyro Roll Set Point Adjustment') self._accel_pitch_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._accel_pitch_pid_controller) self._accel_pitch_pid_controller.hide_i_line() self._accel_pitch_pid_controller.hide_d_line() self._accel_pitch_pid_controller.p_line.ui.title_label.setText('Accel Pitch Gain') self._accel_pitch_pid_controller.i_line.ui.title_label.setText('Accel Pitch Error Correction') self._accel_pitch_pid_controller.d_line.ui.title_label.setText('Accel Pitch Set Point Adjustment') self._gyro_pitch_pid_controller = PIDWidgetController() self.ui.main_layout.addWidget(self._gyro_pitch_pid_controller) self._gyro_pitch_pid_controller.p_line.ui.title_label.setText('Gyro Pitch Gain') self._gyro_pitch_pid_controller.i_line.ui.title_label.setText('Gyro Pitch Error Correction') self._gyro_pitch_pid_controller.d_line.ui.title_label.setText('Gyro Pitch Set Point Adjustment') self.setBeginnerMode()
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_VehicleConfigurationPanel() self.ui.setupUi(self) self.ui.configSpecs.setRowCount(15) self.ui.configSpecs.setColumnCount(1) self._reset_panel() ui_event_dispatcher.register(self._connection_state_changed, UIEventDispatcher.CONNECTION_STATE_CHANGED_EVENT) vehicle_event_dispatcher.register(self._flight_config_received, VehicleEventDispatcher.FLIGHT_CONFIG_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.BOAR_TYPE_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.RECEIVER_TYPE_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.RECEIVER_NB_CHANNEL_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.NUMBER_MOTORS_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.GYROSCOPE_DETECTED_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.ACCELEROMETER_DETECTED_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.BAROMETER_DETECTED_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.MAGNETOMETER_DETECTED_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.HEADING_HOLD_ENABLED_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.ALTITUDE_HOLD_ENABLED_EVENT) vehicle_event_dispatcher.register(self._vehicle_description_event_received, VehicleEventDispatcher.BATTERY_MONITOR_ENABLED_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_MotorCommandPanel() self.ui.setupUi(self) self._motor_slider1 = MotorSlider(1) self.ui.gridLayout.addWidget(self._motor_slider1, 0, 0, 1, 1) self._motor_slider2 = MotorSlider(2) self.ui.gridLayout.addWidget(self._motor_slider2, 0, 1, 1, 1) self._motor_slider3 = MotorSlider(3) self.ui.gridLayout.addWidget(self._motor_slider3, 0, 2, 1, 1) self._motor_slider4 = MotorSlider(4) self.ui.gridLayout.addWidget(self._motor_slider4, 0, 3, 1, 1) self._motor_slider5 = MotorSlider(5) self.ui.gridLayout.addWidget(self._motor_slider5, 0, 4, 1, 1) self._motor_slider6 = MotorSlider(6) self.ui.gridLayout.addWidget(self._motor_slider6, 0, 5, 1, 1) self._motor_slider7 = MotorSlider(7) self.ui.gridLayout.addWidget(self._motor_slider7, 0, 4, 1, 1) self._motor_slider8 = MotorSlider(8) self.ui.gridLayout.addWidget(self._motor_slider8, 0, 5, 1, 1) self.ui.unlock_check_box.stateChanged.connect( self._check_box_state_changed) self.ui.send_command_button.clicked.connect(self._send_motors_commands) self.ui.stop_all_motors_button.clicked.connect( self._send_stop_commands) self.ui.help_button.clicked.connect(self._display_help_image) self._timer = None ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register( self._nb_motors_received, VehicleEventDispatcher.NUMBER_MOTORS_EVENT)
def __init__(self, vehicle_event_dispatcher, protocol_handler): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_VehicleDynamicConfigPanel() self.ui.setupUi(self) self.ui.updateButton.clicked.connect(self._send_mini_config) palette = QtGui.QPalette() palette.setColor(QtGui.QPalette.Foreground, QtCore.Qt.white) self.ui.receiverTitle.setPalette(palette) self.ui.motorTitle.setPalette(palette) self.ui.triBox.clicked.connect(self.triCheckBoxPressed) self.ui.quadBox.clicked.connect(self.quadCheckBoxPressed) self.ui.quadPlusBox.clicked.connect(self.quadPlusCheckBoxPressed) self.ui.quadY4Box.clicked.connect(self.y4CheckBoxPressed) self.ui.y6Box.clicked.connect(self.y6CheckBoxPressed) self.ui.hexaPlusBox.clicked.connect(self.hexPlusCheckBoxPressed) self.ui.hexaXBox.clicked.connect(self.hexXCheckBoxPressed) self.ui.reverseRotation.clicked.connect(self.reverseRotationCheckBoxPressed) self.ui.ppmRecv.clicked.connect(self.ppmReceiverCheckBoxPressed) self.ui.normalRecv.clicked.connect(self.normalReceiverCheckBoxPressed) self._flight_config_type = FlightConfigType.QUAD_X self._receiver_type = ReceiverConfigType.RECEIVER_PWM self._reversed_yaw = '1' self._selected_flight_config = FlightConfigType.QUAD_X self._selected_receiver_config = ReceiverConfigType.RECEIVER_PWM self._selected_reversed_yaw_rotation = '1' self._update_panel_component() vehicle_event_dispatcher.register(self._flight_config_updated, VehicleEventDispatcher.FLIGHT_CONFIG_EVENT) vehicle_event_dispatcher.register(self._yaw_direction_updated, VehicleEventDispatcher.YAW_DIRECTION_CONFIG_EVENT) vehicle_event_dispatcher.register(self._receiver_type_updated, VehicleEventDispatcher.RECEIVER_TYPE_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_ReceiverCalibrationPanel() self.ui.setupUi(self) self.ui.start.setEnabled(True) self.ui.cancel.setEnabled(False) leftStickScene = QtGui.QGraphicsScene() leftStickBackground = QtGui.QPixmap("./resources/TxDial.png") leftStickItem = QtGui.QGraphicsPixmapItem(leftStickBackground) leftStickScene.addItem(leftStickItem) self.leftStick = QtGui.QGraphicsEllipseItem(QtCore.QRectF(75, 75, 30, 30)) self.leftStick.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.leftStick.setBrush(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) leftStickScene.addItem(self.leftStick) self.ui.leftTransmitter.setScene(leftStickScene) rightStickScene = QtGui.QGraphicsScene() rightStickBackground = QtGui.QPixmap("./resources/TxDial.png") rightStickItem = QtGui.QGraphicsPixmapItem(rightStickBackground) rightStickScene.addItem(rightStickItem) self.rightStick = QtGui.QGraphicsEllipseItem(QtCore.QRectF(75, 75, 30, 30)) self.rightStick.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.rightStick.setBrush(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) rightStickScene.addItem(self.rightStick) self.ui.rightTransmitter.setScene(rightStickScene) self.running = False self.amount_channels = 12 self.RCmin = [1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500] self.RCmax = [1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500] self.max_amount_channels = 12 self.ui.start.clicked.connect(self.start_RCcalibration) self.ui.cancel.clicked.connect(self.cancel_RCcalibration)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_ReceiverCalibrationPanel() self.ui.setupUi(self) self.ui.start_button.setEnabled(True) self.ui.cancel_button.setEnabled(False) leftStickScene = QtGui.QGraphicsScene() leftStickBackground = QtGui.QPixmap("./resources/TxDial.png") leftStickItem = QtGui.QGraphicsPixmapItem(leftStickBackground) leftStickScene.addItem(leftStickItem) self.leftStick = QtGui.QGraphicsEllipseItem( QtCore.QRectF(75, 75, 30, 30)) self.leftStick.setPen( QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.leftStick.setBrush( QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) leftStickScene.addItem(self.leftStick) self.ui.left_transmitter.setScene(leftStickScene) rightStickScene = QtGui.QGraphicsScene() rightStickBackground = QtGui.QPixmap("./resources/TxDial.png") rightStickItem = QtGui.QGraphicsPixmapItem(rightStickBackground) rightStickScene.addItem(rightStickItem) self.rightStick = QtGui.QGraphicsEllipseItem( QtCore.QRectF(75, 75, 30, 30)) self.rightStick.setPen( QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.rightStick.setBrush( QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) rightStickScene.addItem(self.rightStick) self.ui.right_transmitter.setScene(rightStickScene) self._nb_channels = 12 self._raw_receiver_min_values = [ 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500 ] self._raw_receiver_max_values = [ 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500 ] self.max_amount_channels = 12 self._raw_roll = 1500 self._raw_pitch = 1500 self._raw_yaw = 1500 self._raw_throttle = 1500 self.ui.start_button.clicked.connect(self.start_RCcalibration) self.ui.cancel_button.clicked.connect(self._cancel_calibration) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT) vehicle_event_dispatcher.register( self._receiver_channel_count_received, VehicleEventDispatcher.RECEIVER_NB_CHANNEL_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_roll_received, VehicleEventDispatcher.RECEIVER_ROLL_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_pitch_received, VehicleEventDispatcher.RECEIVER_PITCH_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_yaw_received, VehicleEventDispatcher.RECEIVER_YAW_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_throttle_received, VehicleEventDispatcher.RECEIVER_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_mode_received, VehicleEventDispatcher.RECEIVER_MODE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_aux1_received, VehicleEventDispatcher.RECEIVER_AUX1_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_aux2_received, VehicleEventDispatcher.RECEIVER_AUX2_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_aux3_received, VehicleEventDispatcher.RECEIVER_AUX3_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_aux4_received, VehicleEventDispatcher.RECEIVER_AUX4_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_aux5_received, VehicleEventDispatcher.RECEIVER_AUX5_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_aux6_received, VehicleEventDispatcher.RECEIVER_AUX6_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_raw_aux7_received, VehicleEventDispatcher.RECEIVER_AUX7_PROPERTY_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_VehicleOverallStatusPanel() self.ui.setupUi(self) self._protocol_handler = None self._channel_count = 0 self._flight_config = 'Quad +' self._channel_bar_gauge_array = [] self._channels_label_array_text = ['Mode'] self._channels_label_array_object = [] self._motor_gauge_pixel_width = 25.0 self._label_pixel_height = 25 self._window_height = 400 self._motors_count = 4 self._vehicle_roll = 0.0 self._vehicle_pitch = 0.0 self._receiver_roll = 0 self._receiver_pitch = 0 self._receiver_yaw = 0 self._receiver_throttle = 0 horizon_background_image = QtGui.QPixmap('./resources/artificialHorizonBackGround.svg') self._horizon_background_image = QtGui.QGraphicsPixmapItem(horizon_background_image) horizon_dial_image = QtGui.QPixmap('./resources/artificialHorizonDial.svg') horizon_dial_item = QtGui.QGraphicsPixmapItem(horizon_dial_image) horizon_dial_item.setPos(QtCore.QPointF(100.0, 390.0)) horizon_compass_background = QtGui.QPixmap('./resources/artificialHorizonCompassBackGround.svg') horizon_compass_background_item = QtGui.QGraphicsPixmapItem(horizon_compass_background) horizon_compass_background_item.setPos(QtCore.QPointF(100.0, 390.0)) horizon_compass = QtGui.QPixmap('./resources/artificialHorizonCompass.svg') self._horizon_compass_item = QtGui.QGraphicsPixmapItem(horizon_compass) self._horizon_compass_item.setPos(QtCore.QPointF(100.0, 390.0)) horizon_scene = QtGui.QGraphicsScene() horizon_scene.addItem(self._horizon_background_image) horizon_scene.addItem(horizon_dial_item) horizon_scene.addItem(horizon_compass_background_item) horizon_scene.addItem(self._horizon_compass_item) # Setup text info in artificial horizon_background_image rollLabel = horizon_scene.addText('Roll:') rollLabel.setDefaultTextColor(QtCore.Qt.white) rollLabel.setPos(102, 420) self.roll = horizon_scene.addText('0.0') self.roll.setDefaultTextColor(QtCore.Qt.white) self.roll.setPos(125, 420) pitchLabel = horizon_scene.addText('Pitch:') pitchLabel.setDefaultTextColor(QtCore.Qt.white) pitchLabel.setPos(102, 405) self.pitch = horizon_scene.addText('0.0') self.pitch.setDefaultTextColor(QtCore.Qt.white) self.pitch.setPos(132, 405) headingLabel = horizon_scene.addText('Heading:') headingLabel.setDefaultTextColor(QtCore.Qt.white) headingLabel.setPos(102, 390) self.heading = horizon_scene.addText('0.0') self.heading.setDefaultTextColor(QtCore.Qt.white) self.heading.setPos(147, 390) altitudeLabel = horizon_scene.addText('Altitude:') altitudeLabel.setDefaultTextColor(QtCore.Qt.white) altitudeLabel.setPos(320, 390) self.altitude = horizon_scene.addText('000.0') self.altitude.setDefaultTextColor(QtCore.Qt.white) self.altitude.setPos(363, 390) altHoldLabel = horizon_scene.addText('Alt Hold:') altHoldLabel.setDefaultTextColor(QtCore.Qt.white) altHoldLabel.setPos(331, 405) self.altitudeHold = horizon_scene.addText('Off') self.altitudeHold.setDefaultTextColor(QtCore.Qt.red) self.altitudeHold.setPos(374, 405) armLabel = horizon_scene.addText('Motors:') armLabel.setDefaultTextColor(QtCore.Qt.white) armLabel.setPos(102, 653) self.motorArm = horizon_scene.addText('Not Armed') self.motorArm.setDefaultTextColor(QtCore.Qt.red) self.motorArm.setPos(102, 668) battLabel = horizon_scene.addText('Batt:') battLabel.setDefaultTextColor(QtCore.Qt.white) battLabel.setPos(330, 653) self.batteryPower = horizon_scene.addText('0.000') self.batteryPower.setDefaultTextColor(QtCore.Qt.white) self.batteryPower.setPos(357, 653) modeLabel = horizon_scene.addText('Mode:') modeLabel.setDefaultTextColor(QtCore.Qt.white) modeLabel.setPos(330, 668) self.flightMode = horizon_scene.addText('Acro') self.flightMode.setDefaultTextColor(QtCore.Qt.yellow) self.flightMode.setPos(362, 668) self.ui.artificialHorizon.setScene(horizon_scene) # Setup left transmitter stick leftStickScene = QtGui.QGraphicsScene() leftStickBackground = QtGui.QPixmap('./resources/TxDial.png') leftStickItem = QtGui.QGraphicsPixmapItem(leftStickBackground) leftStickScene.addItem(leftStickItem) self.leftStick = QtGui.QGraphicsEllipseItem(QtCore.QRectF(75, 75, 30, 30)) self.leftStick.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.leftStick.setBrush(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) leftStickScene.addItem(self.leftStick) self.ui.leftTransmitter.setScene(leftStickScene) # Setup right transmitter stick rightStickScene = QtGui.QGraphicsScene() rightStickBackground = QtGui.QPixmap('./resources/TxDial.png') rightStickItem = QtGui.QGraphicsPixmapItem(rightStickBackground) rightStickScene.addItem(rightStickItem) self.rightStick = QtGui.QGraphicsEllipseItem(QtCore.QRectF(75, 75, 30, 30)) self.rightStick.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.rightStick.setBrush(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) rightStickScene.addItem(self.rightStick) self.ui.rightTransmitter.setScene(rightStickScene) vehicle_event_dispatcher.register(self._flight_config_received, VehicleEventDispatcher.FLIGHT_CONFIG_EVENT) vehicle_event_dispatcher.register(self._receiver_channel_count_received, VehicleEventDispatcher.RECEIVER_NB_CHANNEL_EVENT) vehicle_event_dispatcher.register(self._motors_count_received, VehicleEventDispatcher.NUMBER_MOTORS_EVENT) vehicle_event_dispatcher.register(self._motor_armed_event, VehicleEventDispatcher.MOTOR_ARMED_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._vehicle_roll_event, VehicleEventDispatcher.VEHICLE_ROLL_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._vehicle_pitch_event, VehicleEventDispatcher.VEHICLE_PITCH_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._vehicle_heading_event, VehicleEventDispatcher.VEHICLE_HEADING_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._vehicle_altitude_hold_state_event, VehicleEventDispatcher.ALTITUDE_HOLD_STATE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._vehicle_altitude_event, VehicleEventDispatcher.VEHICLE_ALTITUDE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_roll_event, VehicleEventDispatcher.RECEIVER_ROLL_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_pitch_event, VehicleEventDispatcher.RECEIVER_PITCH_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_yaw_event, VehicleEventDispatcher.RECEIVER_YAW_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_throttle_event, VehicleEventDispatcher.RECEIVER_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_mode_event, VehicleEventDispatcher.RECEIVER_MODE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux1_event, VehicleEventDispatcher.RECEIVER_AUX1_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux2_event, VehicleEventDispatcher.RECEIVER_AUX2_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux3_event, VehicleEventDispatcher.RECEIVER_AUX3_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux4_event, VehicleEventDispatcher.RECEIVER_AUX4_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux5_event, VehicleEventDispatcher.RECEIVER_AUX5_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux6_event, VehicleEventDispatcher.RECEIVER_AUX6_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._receiver_aux7_event, VehicleEventDispatcher.RECEIVER_AUX7_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._motor1_throttle_event, VehicleEventDispatcher.MOTOR1_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._motor2_throttle_event, VehicleEventDispatcher.MOTOR2_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._motor3_throttle_event, VehicleEventDispatcher.MOTOR3_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._motor4_throttle_event, VehicleEventDispatcher.MOTOR4_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._motor5_throttle_event, VehicleEventDispatcher.MOTOR5_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._motor6_throttle_event, VehicleEventDispatcher.MOTOR6_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._motor7_throttle_event, VehicleEventDispatcher.MOTOR7_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._motor8_throttle_event, VehicleEventDispatcher.MOTOR8_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._flight_mode_event, VehicleEventDispatcher.FLIGHT_MODE_PROPERTY_EVENT) vehicle_event_dispatcher.register(self._battery_voltage_received, VehicleEventDispatcher.BATTERY_VOLTAGE_PROPERTY_EVENT) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT)
def __init__(self, vehicle_event_dispatcher, ui_event_dispatcher): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.ui = Ui_VehicleOverallStatusPanel() self.ui.setupUi(self) self._protocol_handler = None self._channel_count = 0 self._flight_config = 'Quad +' self._channel_bar_gauge_array = [] self._channels_label_array_text = ['Mode'] self._channels_label_array_object = [] self._motor_gauge_pixel_width = 25.0 self._label_pixel_height = 25 self._window_height = 400 self._motors_count = 4 self._vehicle_roll = 0.0 self._vehicle_pitch = 0.0 self._receiver_roll = 0 self._receiver_pitch = 0 self._receiver_yaw = 0 self._receiver_throttle = 0 horizon_background_image = QtGui.QPixmap( './resources/artificialHorizonBackGround.svg') self._horizon_background_image = QtGui.QGraphicsPixmapItem( horizon_background_image) horizon_dial_image = QtGui.QPixmap( './resources/artificialHorizonDial.svg') horizon_dial_item = QtGui.QGraphicsPixmapItem(horizon_dial_image) horizon_dial_item.setPos(QtCore.QPointF(100.0, 390.0)) horizon_compass_background = QtGui.QPixmap( './resources/artificialHorizonCompassBackGround.svg') horizon_compass_background_item = QtGui.QGraphicsPixmapItem( horizon_compass_background) horizon_compass_background_item.setPos(QtCore.QPointF(100.0, 390.0)) horizon_compass = QtGui.QPixmap( './resources/artificialHorizonCompass.svg') self._horizon_compass_item = QtGui.QGraphicsPixmapItem(horizon_compass) self._horizon_compass_item.setPos(QtCore.QPointF(100.0, 390.0)) horizon_scene = QtGui.QGraphicsScene() horizon_scene.addItem(self._horizon_background_image) horizon_scene.addItem(horizon_dial_item) horizon_scene.addItem(horizon_compass_background_item) horizon_scene.addItem(self._horizon_compass_item) # Setup text info in artificial horizon_background_image rollLabel = horizon_scene.addText('Roll:') rollLabel.setDefaultTextColor(QtCore.Qt.white) rollLabel.setPos(102, 420) self.roll = horizon_scene.addText('0.0') self.roll.setDefaultTextColor(QtCore.Qt.white) self.roll.setPos(125, 420) pitchLabel = horizon_scene.addText('Pitch:') pitchLabel.setDefaultTextColor(QtCore.Qt.white) pitchLabel.setPos(102, 405) self.pitch = horizon_scene.addText('0.0') self.pitch.setDefaultTextColor(QtCore.Qt.white) self.pitch.setPos(132, 405) headingLabel = horizon_scene.addText('Heading:') headingLabel.setDefaultTextColor(QtCore.Qt.white) headingLabel.setPos(102, 390) self.heading = horizon_scene.addText('0.0') self.heading.setDefaultTextColor(QtCore.Qt.white) self.heading.setPos(147, 390) altitudeLabel = horizon_scene.addText('Altitude:') altitudeLabel.setDefaultTextColor(QtCore.Qt.white) altitudeLabel.setPos(320, 390) self.altitude = horizon_scene.addText('000.0') self.altitude.setDefaultTextColor(QtCore.Qt.white) self.altitude.setPos(363, 390) altHoldLabel = horizon_scene.addText('Alt Hold:') altHoldLabel.setDefaultTextColor(QtCore.Qt.white) altHoldLabel.setPos(331, 405) self.altitudeHold = horizon_scene.addText('Off') self.altitudeHold.setDefaultTextColor(QtCore.Qt.red) self.altitudeHold.setPos(374, 405) armLabel = horizon_scene.addText('Motors:') armLabel.setDefaultTextColor(QtCore.Qt.white) armLabel.setPos(102, 653) self.motorArm = horizon_scene.addText('Not Armed') self.motorArm.setDefaultTextColor(QtCore.Qt.red) self.motorArm.setPos(102, 668) battLabel = horizon_scene.addText('Batt:') battLabel.setDefaultTextColor(QtCore.Qt.white) battLabel.setPos(330, 653) self.batteryPower = horizon_scene.addText('0.000') self.batteryPower.setDefaultTextColor(QtCore.Qt.white) self.batteryPower.setPos(357, 653) modeLabel = horizon_scene.addText('Mode:') modeLabel.setDefaultTextColor(QtCore.Qt.white) modeLabel.setPos(330, 668) self.flightMode = horizon_scene.addText('Acro') self.flightMode.setDefaultTextColor(QtCore.Qt.yellow) self.flightMode.setPos(362, 668) self.ui.artificialHorizon.setScene(horizon_scene) # Setup left transmitter stick leftStickScene = QtGui.QGraphicsScene() leftStickBackground = QtGui.QPixmap('./resources/TxDial.png') leftStickItem = QtGui.QGraphicsPixmapItem(leftStickBackground) leftStickScene.addItem(leftStickItem) self.leftStick = QtGui.QGraphicsEllipseItem( QtCore.QRectF(75, 75, 30, 30)) self.leftStick.setPen( QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.leftStick.setBrush( QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) leftStickScene.addItem(self.leftStick) self.ui.leftTransmitter.setScene(leftStickScene) # Setup right transmitter stick rightStickScene = QtGui.QGraphicsScene() rightStickBackground = QtGui.QPixmap('./resources/TxDial.png') rightStickItem = QtGui.QGraphicsPixmapItem(rightStickBackground) rightStickScene.addItem(rightStickItem) self.rightStick = QtGui.QGraphicsEllipseItem( QtCore.QRectF(75, 75, 30, 30)) self.rightStick.setPen( QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.rightStick.setBrush( QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) rightStickScene.addItem(self.rightStick) self.ui.rightTransmitter.setScene(rightStickScene) vehicle_event_dispatcher.register( self._flight_config_received, VehicleEventDispatcher.FLIGHT_CONFIG_EVENT) vehicle_event_dispatcher.register( self._receiver_channel_count_received, VehicleEventDispatcher.RECEIVER_NB_CHANNEL_EVENT) vehicle_event_dispatcher.register( self._motors_count_received, VehicleEventDispatcher.NUMBER_MOTORS_EVENT) vehicle_event_dispatcher.register( self._motor_armed_event, VehicleEventDispatcher.MOTOR_ARMED_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._vehicle_roll_event, VehicleEventDispatcher.VEHICLE_ROLL_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._vehicle_pitch_event, VehicleEventDispatcher.VEHICLE_PITCH_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._vehicle_heading_event, VehicleEventDispatcher.VEHICLE_HEADING_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._vehicle_altitude_hold_state_event, VehicleEventDispatcher.ALTITUDE_HOLD_STATE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._vehicle_altitude_event, VehicleEventDispatcher.VEHICLE_ALTITUDE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_roll_event, VehicleEventDispatcher.RECEIVER_ROLL_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_pitch_event, VehicleEventDispatcher.RECEIVER_PITCH_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_yaw_event, VehicleEventDispatcher.RECEIVER_YAW_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_throttle_event, VehicleEventDispatcher.RECEIVER_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_mode_event, VehicleEventDispatcher.RECEIVER_MODE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux1_event, VehicleEventDispatcher.RECEIVER_AUX1_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux2_event, VehicleEventDispatcher.RECEIVER_AUX2_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux3_event, VehicleEventDispatcher.RECEIVER_AUX3_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux4_event, VehicleEventDispatcher.RECEIVER_AUX4_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux5_event, VehicleEventDispatcher.RECEIVER_AUX5_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux6_event, VehicleEventDispatcher.RECEIVER_AUX6_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._receiver_aux7_event, VehicleEventDispatcher.RECEIVER_AUX7_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._motor1_throttle_event, VehicleEventDispatcher.MOTOR1_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._motor2_throttle_event, VehicleEventDispatcher.MOTOR2_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._motor3_throttle_event, VehicleEventDispatcher.MOTOR3_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._motor4_throttle_event, VehicleEventDispatcher.MOTOR4_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._motor5_throttle_event, VehicleEventDispatcher.MOTOR5_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._motor6_throttle_event, VehicleEventDispatcher.MOTOR6_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._motor7_throttle_event, VehicleEventDispatcher.MOTOR7_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._motor8_throttle_event, VehicleEventDispatcher.MOTOR8_THROTTLE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._flight_mode_event, VehicleEventDispatcher.FLIGHT_MODE_PROPERTY_EVENT) vehicle_event_dispatcher.register( self._battery_voltage_received, VehicleEventDispatcher.BATTERY_VOLTAGE_PROPERTY_EVENT) ui_event_dispatcher.register(self._protocol_handler_changed_event, UIEventDispatcher.PROTOCOL_HANDLER_EVENT)
def __init__(self, vehicle_model, message_sender): QtGui.QWidget.__init__(self) BasePanelController.__init__(self) self.vehicle_model = vehicle_model self.message_sender = message_sender self.ui = Ui_VehicleOverallStatusPanel() self.ui.setupUi(self) self.channelCount = 0 self.rawData = "" # Setup artificial horizon horizon = QtGui.QPixmap("./resources/artificialHorizonBackGround.svg") self.horizonItem = QtGui.QGraphicsPixmapItem(horizon) horizonDial = QtGui.QPixmap("./resources/artificialHorizonDial.svg") horizonDialItem = QtGui.QGraphicsPixmapItem(horizonDial) horizonDialItem.setPos(QtCore.QPointF(100.0, 390.0)) horizonCompassBackground = QtGui.QPixmap("./resources/artificialHorizonCompassBackGround.svg") horizonCompassBackGroundItem = QtGui.QGraphicsPixmapItem(horizonCompassBackground) horizonCompassBackGroundItem.setPos(QtCore.QPointF(100.0, 390.0)) horizonCompass = QtGui.QPixmap("./resources/artificialHorizonCompass.svg") self.horizonCompassItem = QtGui.QGraphicsPixmapItem(horizonCompass) self.horizonCompassItem.setPos(QtCore.QPointF(100.0, 390.0)) horizonScene = QtGui.QGraphicsScene() horizonScene.addItem(self.horizonItem) horizonScene.addItem(horizonDialItem) horizonScene.addItem(horizonCompassBackGroundItem) horizonScene.addItem(self.horizonCompassItem) # Setup text info in artificial horizon rollLabel = horizonScene.addText("Roll:") rollLabel.setDefaultTextColor(QtCore.Qt.white) rollLabel.setPos(102, 420) self.roll = horizonScene.addText("0.0") self.roll.setDefaultTextColor(QtCore.Qt.white) self.roll.setPos(125, 420) pitchLabel = horizonScene.addText("Pitch:") pitchLabel.setDefaultTextColor(QtCore.Qt.white) pitchLabel.setPos(102, 405) self.pitch = horizonScene.addText("0.0") self.pitch.setDefaultTextColor(QtCore.Qt.white) self.pitch.setPos(132, 405) headingLabel = horizonScene.addText("Heading:") headingLabel.setDefaultTextColor(QtCore.Qt.white) headingLabel.setPos(102, 390) self.heading = horizonScene.addText("0.0") self.heading.setDefaultTextColor(QtCore.Qt.white) self.heading.setPos(147, 390) altitudeLabel = horizonScene.addText("Altitude:") altitudeLabel.setDefaultTextColor(QtCore.Qt.white) altitudeLabel.setPos(320, 390) self.altitude = horizonScene.addText("000.0") self.altitude.setDefaultTextColor(QtCore.Qt.white) self.altitude.setPos(363, 390) altHoldLabel = horizonScene.addText("Alt Hold:") altHoldLabel.setDefaultTextColor(QtCore.Qt.white) altHoldLabel.setPos(331, 405) self.altitudeHold = horizonScene.addText("Off") self.altitudeHold.setDefaultTextColor(QtCore.Qt.red) self.altitudeHold.setPos(374, 405) armLabel = horizonScene.addText("Motors:") armLabel.setDefaultTextColor(QtCore.Qt.white) armLabel.setPos(102, 653) self.motorArm = horizonScene.addText("Not Armed") self.motorArm.setDefaultTextColor(QtCore.Qt.red) self.motorArm.setPos(102, 668) battLabel = horizonScene.addText("Batt:") battLabel.setDefaultTextColor(QtCore.Qt.white) battLabel.setPos(330, 653) self.batteryPower = horizonScene.addText("0.000") self.batteryPower.setDefaultTextColor(QtCore.Qt.white) self.batteryPower.setPos(357, 653) modeLabel = horizonScene.addText("Mode:") modeLabel.setDefaultTextColor(QtCore.Qt.white) modeLabel.setPos(330, 668) self.flightMode = horizonScene.addText("Acro") self.flightMode.setDefaultTextColor(QtCore.Qt.yellow) self.flightMode.setPos(362, 668) self.ui.artificialHorizon.setScene(horizonScene) # Setup left transmitter stick leftStickScene = QtGui.QGraphicsScene() leftStickBackground = QtGui.QPixmap("./resources/TxDial.png") leftStickItem = QtGui.QGraphicsPixmapItem(leftStickBackground) leftStickScene.addItem(leftStickItem) self.leftStick = QtGui.QGraphicsEllipseItem(QtCore.QRectF(75, 75, 30, 30)) self.leftStick.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.leftStick.setBrush(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) leftStickScene.addItem(self.leftStick) self.ui.leftTransmitter.setScene(leftStickScene) # Setup right transmitter stick rightStickScene = QtGui.QGraphicsScene() rightStickBackground = QtGui.QPixmap("./resources/TxDial.png") rightStickItem = QtGui.QGraphicsPixmapItem(rightStickBackground) rightStickScene.addItem(rightStickItem) self.rightStick = QtGui.QGraphicsEllipseItem(QtCore.QRectF(75, 75, 30, 30)) self.rightStick.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black, QtCore.Qt.SolidPattern), 2)) self.rightStick.setBrush(QtGui.QBrush(QtCore.Qt.blue, QtCore.Qt.SolidPattern)) rightStickScene.addItem(self.rightStick) self.ui.rightTransmitter.setScene(rightStickScene)