[![](https://raw.githubusercontent.com/MomsFriendlyRobotCompany/ins_nav/master/docs/pics/header.jpg)](https://github.com/MomsFriendlyRobotCompany/ins_nav)
# ins_nav
[![Actions Status](https://github.com/MomsFriendlyRobotCompany/ins_nav/workflows/pytest/badge.svg)](https://github.com/MomsFriendlyRobotCompany/ins_nav/actions)
![PyPI - License](https://img.shields.io/pypi/l/ins_nav.svg)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ins_nav.svg)
![PyPI - Format](https://img.shields.io/pypi/format/ins_nav.svg)
![PyPI](https://img.shields.io/pypi/v/ins_nav.svg)
This library is written independent of any specific IMU. The idea is you pass in the appropriate
measurements and error terms from your IMU and get the desired output.
**This is still under heavy development**
## Reference Frames
* [ECI: Earth-centered Inertial](https://en.wikipedia.org/wiki/Earth-centered_inertial) is an
inertial frame where Newton's laws of motion apply. It has its origin at the center of the
Earth with:
- x-axis in the direction of the vernal equinox
- z-axis is parallel to the rotation of the Earth
- y-axis completes the right-handed coordinate system
* [ECEF: Earth-centered, Earth-fixed](https://en.wikipedia.org/wiki/ECEF) has the same origin
as ECI, but rotates with the Earth and the x-axis points towards the zero/prime
meridian. The ECEF frame rotates at 7.2921E-5 rads/sec with respect to the ECI
frame
* [LLA(H): Latitude, Longitude, Altitude(Height)](tbd) is similar to the ECEF frame, but
is the frame historically used for GPS navigation
## WGS84
```python
wgs = WGS84()
# here are a bunch of useful constants in WGS84 class
wgs.rf = 298.257223563
wgs.f = 1/self.rf
wgs.a = 6378137.0
wgs.b = self.a - self.a * self.f
wgs.e = np.sqrt(1 - (self.b ** 2 / self.a ** 2))
wgs.r = (2*self.a + self.b) / 3
wgs.rotation_period = 23*3600 + 56*60 + 4.09053
wgs.rate = 7.2921157e-5 # Rotation rate of Earth [rad/s]
wgs.sf = 1.2383e-3 # Schuller frequency
# translate ecef(x,y,z) <=> llh(lat,lon,alt)
wgs.ecef2llh(loc)
wgs.llh2ecef(loc)
wgs.gravity(lat) # gravity changes by latitude[deg]
wgs.radius(lat) # Earth's radius changes by latitude[deg]
wgs.haversine(a,b) # calculates distance between locations a and b
```
## Navigation Frames
While ECEF can be used to navigate the globe, often, you only need to travel 100's of meters
or kilometers. Thus a local navigational frame that is tangental to the curvature of the
Earth is more useful (and intuitive). Two common ones are:
* [ENU: East North Up](https://en.wikipedia.org/wiki/Axes_conventions#Ground_reference_frames:_ENU_and_NED)
a local navigation frame, where *up* and the z-axis align, but clockwise right turns
are negative
* [NED: North East Down](https://en.wikipedia.org/wiki/North_east_down) a local navigation
frame, where *up* and the z-axis are opposite, but the direction of right (clockwise)
turns are in the positive direction and is the standard vehicle roll-pitch-yaw frame
```python
ref = (40,-90,100) # origin of local frame (lat[deg], lon[deg], altitude[m])
frame = NavigationalFrame(ref)
# allof these will calculate position relative to your local
# frame origin
loc = [x,y,z]
frame.ecef2ned(loc)
frame.ecef2enu(loc)
frame.ned2ecef(loc)
frame.enu2ecef(loc)
frame.enu2ned(loc)
frame.ned2enu(loc)
```
# Other Good Navigation Libraries
- [lat_lon_parser](https://pypi.org/project/lat-lon-parser/) allows you to convert between
measurements formats like `-45 deg 12' 36.0 sec`, `45.21 W`, and `-45.21` easily
- [nvector](https://www.navlab.net/nvector) has a lot of capability
- [navpy](https://github.com/NavPy/NavPy) appears to be simple grad student work but code is well referenced (BSD)
- [navigation](https://github.com/ngfgrant/navigation) does GPS navigation and way
points
# The MIT License (MIT)
**Copyright (c) 2016 Kevin J. Walchko**
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Raw data
{
"_id": null,
"home_page": "https://pypi.org/project/ins_nav/",
"name": "ins-nav",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "library,robotics,robot,ins,inertial,navigation,ahrs,imu",
"author": "walchko",
"author_email": "walchko@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/7a/ac/6d105a01ddccad02c47adbf401e0532deb25d6f089339201278530afe042/ins_nav-2023.7.2.tar.gz",
"platform": null,
"description": "[![](https://raw.githubusercontent.com/MomsFriendlyRobotCompany/ins_nav/master/docs/pics/header.jpg)](https://github.com/MomsFriendlyRobotCompany/ins_nav)\n\n# ins_nav\n\n[![Actions Status](https://github.com/MomsFriendlyRobotCompany/ins_nav/workflows/pytest/badge.svg)](https://github.com/MomsFriendlyRobotCompany/ins_nav/actions)\n![PyPI - License](https://img.shields.io/pypi/l/ins_nav.svg)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ins_nav.svg)\n![PyPI - Format](https://img.shields.io/pypi/format/ins_nav.svg)\n![PyPI](https://img.shields.io/pypi/v/ins_nav.svg)\n\n\nThis library is written independent of any specific IMU. The idea is you pass in the appropriate\nmeasurements and error terms from your IMU and get the desired output.\n\n**This is still under heavy development**\n\n## Reference Frames\n\n* [ECI: Earth-centered Inertial](https://en.wikipedia.org/wiki/Earth-centered_inertial) is an\ninertial frame where Newton's laws of motion apply. It has its origin at the center of the\nEarth with:\n - x-axis in the direction of the vernal equinox\n - z-axis is parallel to the rotation of the Earth\n - y-axis completes the right-handed coordinate system\n* [ECEF: Earth-centered, Earth-fixed](https://en.wikipedia.org/wiki/ECEF) has the same origin\nas ECI, but rotates with the Earth and the x-axis points towards the zero/prime\nmeridian. The ECEF frame rotates at 7.2921E-5 rads/sec with respect to the ECI\nframe\n* [LLA(H): Latitude, Longitude, Altitude(Height)](tbd) is similar to the ECEF frame, but\nis the frame historically used for GPS navigation\n\n## WGS84\n\n```python\nwgs = WGS84()\n\n# here are a bunch of useful constants in WGS84 class\nwgs.rf = 298.257223563\nwgs.f = 1/self.rf\nwgs.a = 6378137.0\nwgs.b = self.a - self.a * self.f\nwgs.e = np.sqrt(1 - (self.b ** 2 / self.a ** 2))\nwgs.r = (2*self.a + self.b) / 3\nwgs.rotation_period = 23*3600 + 56*60 + 4.09053\nwgs.rate = 7.2921157e-5 # Rotation rate of Earth [rad/s]\nwgs.sf = 1.2383e-3 # Schuller frequency\n\n# translate ecef(x,y,z) <=> llh(lat,lon,alt)\nwgs.ecef2llh(loc)\nwgs.llh2ecef(loc)\n\nwgs.gravity(lat) # gravity changes by latitude[deg]\nwgs.radius(lat) # Earth's radius changes by latitude[deg]\nwgs.haversine(a,b) # calculates distance between locations a and b\n```\n\n## Navigation Frames\n\nWhile ECEF can be used to navigate the globe, often, you only need to travel 100's of meters\nor kilometers. Thus a local navigational frame that is tangental to the curvature of the\nEarth is more useful (and intuitive). Two common ones are:\n\n* [ENU: East North Up](https://en.wikipedia.org/wiki/Axes_conventions#Ground_reference_frames:_ENU_and_NED)\na local navigation frame, where *up* and the z-axis align, but clockwise right turns\nare negative\n* [NED: North East Down](https://en.wikipedia.org/wiki/North_east_down) a local navigation\nframe, where *up* and the z-axis are opposite, but the direction of right (clockwise)\nturns are in the positive direction and is the standard vehicle roll-pitch-yaw frame\n\n```python\nref = (40,-90,100) # origin of local frame (lat[deg], lon[deg], altitude[m])\nframe = NavigationalFrame(ref)\n\n# allof these will calculate position relative to your local\n# frame origin\nloc = [x,y,z]\nframe.ecef2ned(loc)\nframe.ecef2enu(loc)\nframe.ned2ecef(loc)\nframe.enu2ecef(loc)\nframe.enu2ned(loc)\nframe.ned2enu(loc)\n```\n\n# Other Good Navigation Libraries\n\n- [lat_lon_parser](https://pypi.org/project/lat-lon-parser/) allows you to convert between\nmeasurements formats like `-45 deg 12' 36.0 sec`, `45.21 W`, and `-45.21` easily\n- [nvector](https://www.navlab.net/nvector) has a lot of capability\n- [navpy](https://github.com/NavPy/NavPy) appears to be simple grad student work but code is well referenced (BSD)\n- [navigation](https://github.com/ngfgrant/navigation) does GPS navigation and way\npoints\n\n# The MIT License (MIT)\n\n**Copyright (c) 2016 Kevin J. Walchko**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library to do inertial navigation",
"version": "2023.7.2",
"project_urls": {
"Homepage": "https://pypi.org/project/ins_nav/",
"Repository": "https://github.com/the-guild-of-calamitous-intent/ins_nav"
},
"split_keywords": [
"library",
"robotics",
"robot",
"ins",
"inertial",
"navigation",
"ahrs",
"imu"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8c839a17f2b46bcf4615d890ec4dd9953c9427825c6d4f6d1c1b2976036b0b05",
"md5": "0e2f6b87be15798fa04dde794ac01693",
"sha256": "86d5823074dd77c81da4ba49de7174f7b1f3a71b9d833535e81e091a12fc4675"
},
"downloads": -1,
"filename": "ins_nav-2023.7.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0e2f6b87be15798fa04dde794ac01693",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 21853,
"upload_time": "2023-09-02T17:13:01",
"upload_time_iso_8601": "2023-09-02T17:13:01.327247Z",
"url": "https://files.pythonhosted.org/packages/8c/83/9a17f2b46bcf4615d890ec4dd9953c9427825c6d4f6d1c1b2976036b0b05/ins_nav-2023.7.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7aac6d105a01ddccad02c47adbf401e0532deb25d6f089339201278530afe042",
"md5": "9c0c4053d52b274ca3659f337e507ccf",
"sha256": "a73ef799e749d4a79979327f8439421098fe267fa5be607ac5c53e994364d917"
},
"downloads": -1,
"filename": "ins_nav-2023.7.2.tar.gz",
"has_sig": false,
"md5_digest": "9c0c4053d52b274ca3659f337e507ccf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 15579,
"upload_time": "2023-09-02T17:13:03",
"upload_time_iso_8601": "2023-09-02T17:13:03.098546Z",
"url": "https://files.pythonhosted.org/packages/7a/ac/6d105a01ddccad02c47adbf401e0532deb25d6f089339201278530afe042/ins_nav-2023.7.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-02 17:13:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "the-guild-of-calamitous-intent",
"github_project": "ins_nav",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ins-nav"
}