Exemplo n.º 1
0
    def create():
        port = findSerialDevice(VectorNav.DEFAULT_VID, VectorNav.DEFAULT_PID)

        if port is None:
            raise Exception('VectorNav FTDI converter not detected')

        return VectorNav(port, VectorNav.DEFAULT_BAUD)
Exemplo n.º 2
0
    def _detectPort(self):
        # find Arduino com port
        self._port = findSerialDevice(self.DEFAULT_VID, self.DEFAULT_PID)

        # if arduino com port not found, exit with error
        if self._port is None:
            raise Exception('Arduino %04x:%04x not detected' %
                            (self.DEFAULT_VID, self.DEFAULT_PID))

        self._baud = self.DEFAULT_BAUD
Exemplo n.º 3
0
def initPixHawk(device=None, baudrate=115200, rate=4):
    """Start the thread that monitors the PixHawk Mavlink messages.

    Parameters
    ----------
    device: str
        Address of serialport device.
    baudrate: int
        Serialport baudrate (defaults to 57600)
    rate: int
        Requested rate of messages.
    """

    global flight_data_log
    flight_data_log = SortedDict()

    if device is None:
        device = findSerialDevice(0x067B, 0x2303)
        if device is None:
            raise Exception('PixHawk controller %04x:%04x not detected' %
                            (0x067B, 0x2303))

    #
    # Create the auvsi data folder.
    #
    if not os.path.exists(gs.AUVSI_BASE_FOLDER):
        os.makedirs(gs.AUVSI_BASE_FOLDER)
    if not os.path.exists(gs.FLIGHT_DATA_FOLDER):
        os.makedirs(gs.FLIGHT_DATA_FOLDER)

    #
    # create a mavlink serial instance
    #
    master = mavutil.mavlink_connection(device, baud=baudrate)

    #
    # Start the messages thread
    #
    d = threads.deferToThread(monitorMessages, master, rate)