Exemple #1
0
    def export_file_sensor_data_gps(self, sensor: Sensor, sensors_data: list,
                                    file_format, directory):

        # GPS is stored as SIRF data structures.
        from libopenimu.importers.wimu import GPSGeodetic

        filename = directory + sensor.name
        if 'CSV' in file_format:
            filename = filename + '.CSV'
        elif 'Matlab' in file_format:
            filename = filename + '.mat'

        print('output to file : ', filename)

        # Write CSV header
        header = str()
        channels = self.get_all_channels(sensor=sensor)

        # Create data array
        # TODO, WILL HANDLE ONLY ONE GPS CHANNEL FOR NOW
        my_array = np.zeros(shape=(len(sensors_data), 3))

        for channel in channels:
            header = header + 'TIME;' + channel.label + '-Latitude;' + channel.label + '-Longitude;'

            for i in range(0, len(sensors_data)):
                gps_data = GPSGeodetic()
                gps_data.from_bytes(sensors_data[i].data)
                # Fill data
                my_array[i][0] = sensors_data[
                    i].timestamps.start_timestamp.timestamp()
                my_array[i][1] = gps_data.get_latitude()
                my_array[i][2] = gps_data.get_longitude()

        # Save CSV
        # print('dims:', my_array.shape)
        # Write values
        if 'CSV' in file_format:
            np.savetxt(filename, my_array, delimiter=";", header=header)
        elif 'Matlab' in file_format:
            sio.savemat(filename, {
                sensor.name: my_array.transpose(),
                'labels': header.split(';')
            },
                        do_compression=True)
Exemple #2
0
                    timeseries_gyro[-1]['label'] = channel.label
            if sensor.id_sensor_type == SensorType.GPS:
                print('Found GPS')
                channels = manager.get_all_channels(sensor=sensor)
                for channel in channels:
                    print('Found channel GPS', channel)
                    # No convesion for GPS, stored in raw binary
                    channel_data = manager.get_all_sensor_data(recordset=record, convert=False, sensor=sensor,
                                                               channel=channel)

                    from libopenimu.importers.wimu import GPSGeodetic
                    for sensor_data in channel_data:
                        geo = GPSGeodetic()
                        geo.from_bytes(sensor_data.data)
                        # print(geo)
                        gps_vals[sensor_data.start_timestamp] = [geo.get_latitude(), geo.get_longitude()]

        # Only first recordset
        break

    # Create widgets
    def create_window(label=''):
        window = QMainWindow()
        view = IMUChartView(window)
        window.setCentralWidget(view)
        window.setWindowTitle(label)
        window.resize(640, 480)
        return [window, view]

    def create_gps_view(label=''):
        window = QMainWindow()
Exemple #3
0
                    print('Found channel GPS', channel)
                    # No convesion for GPS, stored in raw binary
                    channel_data = manager.get_all_sensor_data(
                        recordset=record,
                        convert=False,
                        sensor=sensor,
                        channel=channel)

                    from libopenimu.importers.wimu import GPSGeodetic
                    for sensor_data in channel_data:
                        geo = GPSGeodetic()
                        geo.from_bytes(sensor_data.data)
                        # print(geo)
                        gps_vals[sensor_data.start_timestamp] = [
                            geo.get_latitude(),
                            geo.get_longitude()
                        ]

        # Only first recordset
        break

    # Create widgets
    def create_window(label=''):
        window = QMainWindow()
        view = IMUChartView(window)
        window.setCentralWidget(view)
        window.setWindowTitle(label)
        window.resize(640, 480)
        return [window, view]

    def create_gps_view(label=''):