def calculate_gyro_calibration(self, gyro_samples):
        """Performs a basic gyroscope bias calculation. 

        Takes a list of (x, y, z) samples and averages over each axis to calculate
        the bias values, and stores them in the calibration data structure for the 
        currently connected SK8"""

        totals = [0, 0, 0]
        for gs in gyro_samples:
            totals[0] += gs[0]
            totals[1] += gs[1]
            totals[2] += gs[2]

        for i in range(3):
            totals[i] = int(float(totals[i]) / len(gyro_samples))

        print('Saving gyro offsets for {}'.format(self.current_imuid))
        self.calibration_data[self.current_imuid][self.GYROX_OFFSET] = str(totals[0])
        self.calibration_data[self.current_imuid][self.GYROY_OFFSET] = str(totals[1])
        self.calibration_data[self.current_imuid][self.GYROZ_OFFSET] = str(totals[2])
        self.calibration_data[self.current_imuid][self.GYRO_TIMESTAMP] = datetime.now().isoformat()
        self.write_calibration_data()
        self.update_data_display(self.calibration_data[self.current_imuid])
        self.calibration_state = self.CAL_NONE
def calculate_gyro_calibration ( self , gyro_samples ) : totals = [ 0 , 0 , 0 ] for gs in gyro_samples : totals [ 0 ] += gs [ 0 ] totals [ 1 ] += gs [ 1 ] totals [ 2 ] += gs [ 2 ] for i in range ( 3 ) : totals [ i ] = int ( float ( totals [ i ] ) / len ( gyro_samples ) ) print ( 'Saving gyro offsets for {}' . format ( self . current_imuid ) ) self . calibration_data [ self . current_imuid ] [ self . GYROX_OFFSET ] = str ( totals [ 0 ] ) self . calibration_data [ self . current_imuid ] [ self . GYROY_OFFSET ] = str ( totals [ 1 ] ) self . calibration_data [ self . current_imuid ] [ self . GYROZ_OFFSET ] = str ( totals [ 2 ] ) self . calibration_data [ self . current_imuid ] [ self . GYRO_TIMESTAMP ] = datetime . now ( ) . isoformat ( ) self . write_calibration_data ( ) self . update_data_display ( self . calibration_data [ self . current_imuid ] ) self . calibration_state = self . CAL_NONE
Performs a basic gyroscope bias calculation. 

        Takes a list of (x, y, z) samples and averages over each axis to calculate
        the bias values, and stores them in the calibration data structure for the 
        currently connected SK8