Ejemplo n.º 1
0
 def __read_gyroscope(self):
     gyr_reading = DataPoint()
     gyr_reading.sensor_type = 'gyr'
     gyr = self.gyroscope.read_data()
     gyr_reading.x = gyr[0]
     gyr_reading.y = gyr[1]
     gyr_reading.z = gyr[2]
     gyr_reading.time = self.current_millis_frac() - self.started_ms
     return gyr_reading
Ejemplo n.º 2
0
 def __read_compass(self):
     comp_reading = DataPoint()
     comp_reading.sensor_type = 'comp'
     comp = self.compass.read_data()
     comp_reading.x = comp[0]
     comp_reading.y = comp[1]
     comp_reading.z = comp[2]
     comp_reading.time = self.current_millis_frac() - self.started_ms
     return comp_reading
Ejemplo n.º 3
0
 def __read_accelerometer(self):
     acc_reading = DataPoint()
     acc_reading.sensor_type = 'acc'
     acc = self.accelerometer.read_data()
     acc_reading.x = acc[0]
     acc_reading.y = acc[1]
     acc_reading.z = acc[2]
     acc_reading.time = self.current_millis_frac() - self.started_ms
     return acc_reading
Ejemplo n.º 4
0
 def __read_accelerometer(self):
     acc_reading = DataPoint()
     acc_reading.sensor_type = 'acc'
     acc = self.accelerometer.read_data()
     if acc:
         acc_reading.x = acc[0]
         acc_reading.y = acc[1]
         acc_reading.z = acc[2]
     try:
         acc_reading.YZ = math.degrees(
             math.atan(acc_reading.y / acc_reading.z))
     except ZeroDivisionError:
         acc_reading.YZ = 0
     try:
         acc_reading.XZ = math.degrees(
             math.atan(acc_reading.x / acc_reading.z))
     except ZeroDivisionError:
         acc_reading.XZ = 0
     acc_reading.time = self.current_millis_frac() - self.started_ms
     return acc_reading