Пример #1
0
def initialize():
    """Creates and initializes the IMU object

    Returns an IMU object
    """

    # Create IMU object
    imu = IMU()  # To select a specific I2C port, use IMU(n). Default is 1.
    imu.initialize()

    # Enable accelerometer, magnetometer, gyroscope
    imu.enable_accel()
    imu.enable_mag()
    imu.enable_gyro()

    # Change IMU buffer mode to Bypass
    # TODO: Try other modes as well
    imu.accel_mode(0b001)
    imu.gyro_mode(0b001)

    # Specify ranges for accelerometer, magnetometer and gyroscope
    # Accelerometer Options: "2G", "4G", "6G", "8G", "16G"
    # Magnetometer Options: "2GAUSS", "4GAUSS", "8GAUSS", "12GAUSS"
    # Gyroscope Options: "245DPS", "500DPS", "2000DPS"

    imu.accel_range("16G")
    imu.mag_range("2GAUSS")
    imu.gyro_range("2000DPS")

    return imu
Пример #2
0
def initialize():
    """Creates and initializes the IMU object
    Returns an IMU object
    """

    # Create IMU object
    imu = IMU()  # To select a specific I2C port, use IMU(n). Default is 1.
    imu.initialize()

    # Enable accelerometer, magnetometer, gyroscope
    imu.enable_accel()
    imu.enable_mag()
    imu.enable_gyro()

    # Change IMU buffer mode to Bypass
    # TODO: Try other modes as well
    imu.accel_mode(0b001)
    imu.gyro_mode(0b001)

    # Specify ranges for accelerometer, magnetometer and gyroscope
    # Accelerometer Options: "2G", "4G", "6G", "8G", "16G"
    # Magnetometer Options: "2GAUSS", "4GAUSS", "8GAUSS", "12GAUSS"
    # Gyroscope Options: "245DPS", "500DPS", "2000DPS"

    imu.accel_range("16G")
    imu.mag_range("2GAUSS")
    imu.gyro_range("2000DPS")

    return imu
Пример #3
0
      def imu(self):

        imu = IMU()  # To select a specific I2C port, use IMU(n). Default is 1.

        imu.initialize()

        # Enable accelerometer, magnetometer, gyroscope
        imu.enable_accel()
        imu.enable_mag()
        imu.enable_gyro()
        print imu.read_accel()
        print imu.ax, imu.ay, imu.az
        return imu
def sensor_reader ():
    jaylen_data = IMU()
    jaylen_data.initialize()

    #enable sensors here
    jaylen_data.enable_accel()
    jaylen_data.enable_gyro()
    
    #declaring the range of the accelerometer
    jaylen_data.accel_range("8G")

    jaylen_data.read_accel()
    jaylen_data.read_gyro()

    ax = jaylen_data.ax
    ay = jaylen_data.ay
    az = jaylen_data.az

    gx = jaylen_data.gx
    gy = jaylen_data.gy
    gz = jaylen_data.gz

    return ax, ay, az
Пример #5
0
from SF_9DOF import IMU
import time
import numpy as np

# Create IMU object
imu = IMU() # To select a specific I2C port, use IMU(n). Default is 1. 

# Initialize IMU
imu.initialize()

# Enable accel, mag, gyro, and temperature
imu.enable_accel()
imu.enable_mag()
imu.enable_gyro()
imu.enable_temp()

# Set range on accel, mag, and gyro

# Specify Options: "2G", "4G", "6G", "8G", "16G"
imu.accel_range("2G")       # leave blank for default of "2G" 

# Specify Options: "2GAUSS", "4GAUSS", "8GAUSS", "12GAUSS"
imu.mag_range("2GAUSS")     # leave blank for default of "2GAUSS"

# Specify Options: "245DPS", "500DPS", "2000DPS" 
imu.gyro_range("245DPS")    # leave blank for default of "245DPS"

# Loop and read accel, mag, and gyro

class Offset_Gyro:
    def __init__(self):
Пример #6
0
# Create Directory for file if does not exist
if not os.path.exists(DIRECTORY):
    os.makedirs(DIRECTORY)

# Print Program Header
print("\
=======================================\n\
STARTING GESTURE RECORDING TOOL\n\
=======================================")

# Create IMU object
imu = IMU()  # To select a specific I2C port, use IMU(n). Default is 1.

# Initialize IMU
imu.initialize()

# Enable accel, mag, gyro, and temperature
imu.enable_accel()
imu.enable_mag()
imu.enable_gyro()
imu.enable_temp()

# Set range on accel, mag, and gyro

# Specify Options: "2G", "4G", "6G", "8G", "16G"
imu.accel_range("2G")  # leave blank for default of "2G"

# Specify Options: "2GAUSS", "4GAUSS", "8GAUSS", "12GAUSS"
imu.mag_range("2GAUSS")  # leave blank for default of "2GAUSS"
Пример #7
0
def initialize():
    imu = IMU()
    imu.initialize()
    imu.enable_gyro()
    imu.gyro_range("2000DPS")
    return imu