Пример #1
0
    def updateControlInputs(self):
        """ sends the control inputs to Arduino """
        if self.portOpen:
            # make sure the connection has not been broken
            if self.checkConnection():
                # send the control variables
                communicationProtocol.sendMessage(self.arduinoSerialConnection, self.controlParameters)

        # update the display of engine throttles
        self.throttleDial_portVer.currentThrottle = self.controlParameters["motorPortVer"]
        self.throttleDial_portVer.Refresh()
        self.throttleDial_portHor.currentThrottle = self.controlParameters["motorPortHor"]
        self.throttleDial_portHor.Refresh()
        self.throttleDial_stbdVer.currentThrottle = self.controlParameters["motorStbdVer"]
        self.throttleDial_stbdVer.Refresh()
        self.throttleDial_stbdHor.currentThrottle = self.controlParameters["motorStbdHor"]
        self.throttleDial_stbdHor.Refresh()
Пример #2
0
    def onArmModules(self, eent):
        """ Call the Arduino and ask it to arm modules; will wait for a gien time
        to give the MC enough slack to finish all tasks required """

        if self.portOpen and self.checkConnection:
            communicationProtocol.sendMessage(self.arduinoSerialConnection, self.armModulesCommand)

            line = self.arduinoSerialConnection.readline()

            readings = communicationProtocol.readMessage(line)

            try:
                delay = readings["setupDelay"]
                dialog = rovGuiArmDialog(float(delay) / 1000.0)
                dialog.ShowModal()
            except KeyError:
                wx.MessageBox("Something fell over while asking Arduino to arm!", "Error", wx.OK | wx.ICON_ERROR)
Пример #3
0
    def updateSensorReadings(self):
        """ Go over each sensor and get its reading, updating the internally stored values """
        if self.portOpen:
            # make sure the connection has not been broken
            if self.checkConnection():
                pass
                # ask the Arduino nicely to return the current readings
                communicationProtocol.sendMessage(self.arduinoSerialConnection, self.sensorReadingsRequestObject)

                # get the most recent line from the serial port
                line = self.arduinoSerialConnection.readline()

                # pass on to the parser
                readings = communicationProtocol.readMessage(line)

                # update sensor and other readings
                for readingKey in readings:
                    self.sensorParameters[readingKey] = float(readings[readingKey])
Пример #4
0
    def onArmModules(self, eent):
        """ Call the Arduino and ask it to arm modules; will wait for a gien time
        to give the MC enough slack to finish all tasks required """

        if self.portOpen and self.checkConnection:
            communicationProtocol.sendMessage(self.arduinoSerialConnection,
                                              self.armModulesCommand)

            line = self.arduinoSerialConnection.readline()

            readings = communicationProtocol.readMessage(line)

            try:
                delay = readings['setupDelay']
                dialog = rovGuiArmDialog(float(delay) / 1000.)
                dialog.ShowModal()
            except KeyError:
                wx.MessageBox(
                    'Something fell over while asking Arduino to arm!',
                    'Error', wx.OK | wx.ICON_ERROR)
Пример #5
0
    def updateSensorReadings(self):
        """ Go over each sensor and get its reading, updating the internally stored values """
        if self.portOpen:
            # make sure the connection has not been broken
            if self.checkConnection():
                pass
                # ask the Arduino nicely to return the current readings
                communicationProtocol.sendMessage(
                    self.arduinoSerialConnection,
                    self.sensorReadingsRequestObject)

                # get the most recent line from the serial port
                line = self.arduinoSerialConnection.readline()

                # pass on to the parser
                readings = communicationProtocol.readMessage(line)

                # update sensor and other readings
                for readingKey in readings:
                    self.sensorParameters[readingKey] = float(
                        readings[readingKey])
Пример #6
0
    def updateControlInputs(self):
        """ sends the control inputs to Arduino """
        if self.portOpen:
            # make sure the connection has not been broken
            if self.checkConnection():
                # send the control variables
                communicationProtocol.sendMessage(self.arduinoSerialConnection,
                                                  self.controlParameters)

        # update the display of engine throttles
        self.throttleDial_portVer.currentThrottle = self.controlParameters[
            'motorPortVer']
        self.throttleDial_portVer.Refresh()
        self.throttleDial_portHor.currentThrottle = self.controlParameters[
            'motorPortHor']
        self.throttleDial_portHor.Refresh()
        self.throttleDial_stbdVer.currentThrottle = self.controlParameters[
            'motorStbdVer']
        self.throttleDial_stbdVer.Refresh()
        self.throttleDial_stbdHor.currentThrottle = self.controlParameters[
            'motorStbdHor']
        self.throttleDial_stbdHor.Refresh()