# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['nxp_imu']

package_data = \
{'': ['*']}

install_requires = \
['importlib-metadata', 'smbus2']

setup_kwargs = {
    'name': 'nxp-imu',
    'version': '0.6.2',
    'description': 'python library to use the Adafruit NXP 9-Dof IMU',
    'long_description': '![](https://raw.githubusercontent.com/MomsFriendlyRobotCompany/nxp_imu/master/docs/pics/imu-iso.jpg)\n\n# NXP IMU\n\n\n[![image](https://img.shields.io/pypi/pyversions/nxp_imu.svg)](https://github.com/MomsFriendlyRobotCompany/nxp_imu)\n[![image](https://img.shields.io/pypi/wheel/nxp_imu.svg)](https://github.com/MomsFriendlyRobotCompany/nxp_imu)\n[![image](https://img.shields.io/pypi/v/nxp_imu.svg)](https://github.com/MomsFriendlyRobotCompany/nxp_imu)\n[![Downloads](https://img.shields.io/pypi/dm/nxp_imu.svg)](https://img.shields.io/pypi/dm/nxp_imu.svg)\n[![Actions Status](https://github.com/MomsFriendlyRobotCompany/nxp_imu/workflows/Python/badge.svg)](https://github.com/MomsFriendlyRobotCompany/nxp_imu/actions)\n![GitHub](https://img.shields.io/github/license/MomsFriendlyRobotCompany/nxp_imu)\n\n\nPython drivers for [Adafruit Precision NXP\n9-DOF](https://www.adafruit.com/product/3463). This is basically a\npython version of Adafruit\\\'s\n[FXOS8700](https://github.com/adafruit/Adafruit_FXOS8700) and their\n[FXAS21002C](https://github.com/adafruit/Adafruit_FXAS21002C) written in\nC++ for the Arduino.\n\n## NXP Precision 9DoF\n\nThe board consists of two separate ICs, described below:\n\n**FXOS8700 3-Axis Accelerometer/Magnetometer**\n\n-   2-3.6V Supply\n-   ±2 g/±4 g/±8 g adjustable acceleration range\n-   ±1200 µT magnetic sensor range\n-   Output data rates (ODR) from 1.563 Hz to 800 Hz\n-   14-bit ADC resolution for acceleration measurements\n-   16-bit ADC resolution for magnetic measurements\n\n**FXAS21002 3-Axis Gyroscope**\n\n-   2-3.6V Supply\n-   ±250/500/1000/2000°/s configurable range\n-   Output Data Rates (ODR) from 12.5 to 800 Hz\n-   16-bit digital output resolution\n-   192 bytes FIFO buffer (32 X/Y/Z samples)\n\n## Setup\n\n![](https://raw.githubusercontent.com/MomsFriendlyRobotCompany/nxp_imu/master/docs/pics/imu-front.jpg)\n\n![](https://raw.githubusercontent.com/MomsFriendlyRobotCompany/nxp_imu/master/docs/pics/imu-back.jpg)\n\n[Adafruit setup\ntutorial](https://learn.adafruit.com/nxp-precision-9dof-breakout?view=all)\n\n## Usage\n\nVerifying it is there:\n\n```\nsudo i2cdetect -y 1\n     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f\n00:          -- -- -- -- -- -- -- -- -- -- -- -- --\n10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1f\n20: -- 21 -- -- -- -- -- -- -- -- -- -- -- -- -- --\n30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n70: -- -- -- -- -- -- -- --    \n```\n\nSee the `examples` folder, but to have the IMU run at 4G and 2000\ndegrees per second:\n\n```python\n#!/usr/bin/env python3\n\nfrom nxp_imu import IMU, Rate\nimport time\n\n# verbose will print some start-up info on the IMU sensors\nimu = IMU(gs=4, dps=2000, verbose=True)\n\n# setting a bias correction for the accel only, the mags/gyros\n# are not getting a bias correction\nimu.setBias((0.1,-0.02,.25), None, None)\n\n# grab data at 10Hz\nrate = Rate(10)\n\nwhile True:\n    header = 67\n    print(\'-\'*header)\n    print("| {:17} | {:20} | {:20} |".format("Accels [g\'s]", " Magnet [uT]", "Gyros [dps]"))\n    print(\'-\'*header)\n    for _ in range(10):\n        a, m, g = imu.get()\n        print(\'| {:>5.2f} {:>5.2f} {:>5.2f} | {:>6.1f} {:>6.1f} {:>6.1f} | {:>6.1f} {:>6.1f} {:>6.1f} |\'.format(\n            a[0], a[1], a[2],\n            m[0], m[1], m[2],\n            g[0], g[1], g[2])\n        )\n        time.sleep(0.50)\n    print(\'-\'*header)\n    print(\' uT: micro Tesla\')\n    print(\'  g: gravity\')\n    print(\'dps: degrees per second\')\n    print(\'\')\n\n    rate.sleep()\n```\n\n## Examples\n\n```\npi@nav examples $ ./test.py\n\n========================================\nFXOS8700\n  Accelerometer:\n    Addr: 0x1F\n    Range: +/- 2 G\n  Magnetometer:\n    Range: +/- 1200\n  Temperature: 0 C\n========================================\nFXAS21002C Gyro\n  Addr: 0x21\n  Range: +/- 250dps\n  Temperature: 10 C\n-----------------------------------------------\n| Accels [g\'s]         | Orient(r,p,h) [deg]  |\n-----------------------------------------------\n|    0.0   -0.0    1.0 |   -0.0   -0.0    3.0 |\n|    0.0   -0.0    1.0 |   -0.0   -0.0    2.9 |\n|    0.0   -0.0    1.0 |   -0.0   -0.0    2.9 |\n|    0.0   -0.0    1.0 |   -0.0   -0.0    2.9 |\n|    0.0   -0.0    1.0 |   -0.0   -0.0    2.9 |\n|    0.0   -0.0    1.0 |   -0.0   -0.0    2.9 |\n|    0.0   -0.0    1.0 |   -0.0   -0.0    2.9 |\n|    0.0   -0.0    1.0 |   -0.0   -0.0    2.9 |\n|    0.0   -0.0    1.0 |   -0.0   -0.0    2.9 |\n|    0.0   -0.0    1.0 |   -0.0   -0.0    2.9 |\n-----------------------------------------------\n  r: roll\n  p: pitch\n  h: heading\n  g: gravity\ndeg: degree\n\n========================================\nFXOS8700\n  Accelerometer:\n    Addr: 0x1F\n    Range: +/- 4 G\n  Magnetometer:\n    Range: +/- 1200\n  Temperature: 25 C\n========================================\nFXAS21002C Gyro\n  Addr: 0x21\n  Range: +/- 2000dps\n  Temperature: 10 C\n-------------------------------------------------------------------\n| Accels [g\'s]      |  Magnet [uT]         | Gyros [dps]          |\n-------------------------------------------------------------------\n|  0.04 -0.04  1.02 |  -21.5   -4.7    8.3 |    0.8   -1.4   -0.2 |\n|  0.04 -0.04  1.03 |  -21.6   -5.3    8.3 |    1.2   -1.1   -0.4 |\n|  0.04 -0.04  1.02 |  -21.9   -4.4   10.5 |    0.4   -0.9   -0.1 |\n|  0.04 -0.04  1.02 |  -21.5   -4.8    9.9 |    1.3   -1.2    0.1 |\n|  0.04 -0.04  1.02 |  -22.4   -4.9    8.7 |    1.2   -0.8   -0.2 |\n|  0.04 -0.04  1.02 |  -21.7   -5.4    8.5 |    0.2   -1.6    0.0 |\n|  0.04 -0.04  1.03 |  -21.9   -4.7    8.1 |    1.2   -1.2   -0.4 |\n|  0.04 -0.04  1.02 |  -22.2   -4.4   10.0 |    1.5   -1.5   -0.1 |\n|  0.04 -0.04  1.02 |  -22.2   -5.7    9.1 |    0.5   -1.2   -0.4 |\n|  0.04 -0.04  1.02 |  -22.3   -5.0    8.0 |    0.7   -1.4   -0.6 |\n-------------------------------------------------------------------\n uT: micro Tesla\n  g: gravity\ndps: degrees per second\n\nDone ...\n```\n## Decination Angle\n\nRemeber, depending on where you are on the Earth, true North changes\nbecause the Earth is *not* a perfect sphere. You can get the declination\nangle for your location from: http://www.magnetic-declination.com/\n\n## Documents\n\nThe `/docs` folder has the datasheets for both the accel/magnetometer\nand the gyros.\n\n# MIT License\n\n**Copyright (c) 2017 Kevin J. Walchko**\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n"Software"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n',
    'author': 'walchko',
    'author_email': 'walchko@users.noreply.github.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://pypi.org/project/nxp_imu/',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.6',
}


setup(**setup_kwargs)
