# Introduction
## Abstract
This library is primarily derived from the contributions of Geir Istad and has been released as a pip-installable package. The main objective of this library is to streamline operations involving vectors and quaternions, particularly in the context of working with Inertial Measurement Units (IMUs).
## Library Structure and Functions
* Quaternion:
* **get_product**: Computes and returns the product of the current quaternion with another quaternion.
* **get_conjugate**: Calculates and returns the conjugate of the quaternion.
* **get_magnitude**: Determines and provides the magnitude of the quaternion.
* **normalize**: Normalizes the quaternion to ensure unit length.
* **get_normalized**: Retrieves the normalized form of the quaternion.
* XYZVector:
* **get_magnitude**: Computes and returns the magnitude of the vector.
* **normalize**: Normalizes the vector to maintain unit length.
* **get_normalized**: Retrieves the normalized version of the vector.
* **rotate**: Rotates the vector based on a given quaternion.
* **get_rotated**: Returns the vector after rotation, as per the specified quaternion.
## About Rotation
In many scenarios, particularly in the context of Inertial Measurement Unit (IMU) applications, the rotation of a vector using a quaternion is a common requirement. For instance, the acceleration data acquired from an IMU is typically represented in a "body-frame," aligning with the IMU's axes.
However, in the realm of Inertial Navigation Systems (INS), having access to a world-frame acceleration vector is essential for accurate navigation. The illustration below illustrates the orientation of the world-frame and body-frame axes:
<p align="center"><img src="https://ars.els-cdn.com/content/image/3-s2.0-B9780128131893000162-f16-01-9780128131893.jpg"></p>
The rotation of a vector using a quaternion is achieved through the following formula:
$$A_p=q\times A\times q^*$$
where $q^*$ represents the conjugate of the quaternion q, and $A_p$ denotes the rotated original vector $A$.
## Example
Let's consider the scenario where the accelerometer outputs $(0, g, 0)$, with $g$ representing the gravitational acceleration. Assuming the quaternion corresponding to this vector (obtained from the IMU) is $(0.7071, 0.7071, 0, 0)$.
Upon rotating the acceleration vector using the provided quaternion, the resulting vector would be $(0, 0, g)$, now aligned towards the Earth (assuming the z-axis points towards the Earth).
Raw data
{
"_id": null,
"home_page": "https://github.com/OmidAlek/quat",
"name": "quat",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, quaternion, vector, XYZVector, IMU, DMP",
"author": "Majid Alekasir",
"author_email": "<majid.alekasir@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/df/3a/1be655cf1961678f1b66f77cbd64a9d8263f343effc4d0aeed8fa95ddefa/quat-1.0.0.tar.gz",
"platform": null,
"description": "\r\n# Introduction\r\n\r\n## Abstract\r\n\r\nThis library is primarily derived from the contributions of Geir Istad and has been released as a pip-installable package. The main objective of this library is to streamline operations involving vectors and quaternions, particularly in the context of working with Inertial Measurement Units (IMUs).\r\n\r\n\r\n\r\n## Library Structure and Functions\r\n\r\n* Quaternion:\r\n\r\n * **get_product**: Computes and returns the product of the current quaternion with another quaternion.\r\n\r\n * **get_conjugate**: Calculates and returns the conjugate of the quaternion.\r\n\r\n * **get_magnitude**: Determines and provides the magnitude of the quaternion.\r\n\r\n * **normalize**: Normalizes the quaternion to ensure unit length.\r\n\r\n * **get_normalized**: Retrieves the normalized form of the quaternion.\r\n\r\n* XYZVector:\r\n\r\n * **get_magnitude**: Computes and returns the magnitude of the vector.\r\n\r\n * **normalize**: Normalizes the vector to maintain unit length.\r\n\r\n * **get_normalized**: Retrieves the normalized version of the vector.\r\n\r\n * **rotate**: Rotates the vector based on a given quaternion.\r\n\r\n * **get_rotated**: Returns the vector after rotation, as per the specified quaternion.\r\n\r\n\r\n\r\n## About Rotation\r\n\r\nIn many scenarios, particularly in the context of Inertial Measurement Unit (IMU) applications, the rotation of a vector using a quaternion is a common requirement. For instance, the acceleration data acquired from an IMU is typically represented in a \"body-frame,\" aligning with the IMU's axes.\r\n\r\nHowever, in the realm of Inertial Navigation Systems (INS), having access to a world-frame acceleration vector is essential for accurate navigation. The illustration below illustrates the orientation of the world-frame and body-frame axes:\r\n\r\n\r\n\r\n<p align=\"center\"><img src=\"https://ars.els-cdn.com/content/image/3-s2.0-B9780128131893000162-f16-01-9780128131893.jpg\"></p>\r\n\r\n\r\n\r\nThe rotation of a vector using a quaternion is achieved through the following formula:\r\n\r\n\r\n\r\n$$A_p=q\\times A\\times q^*$$\r\n\r\n\r\n\r\nwhere $q^*$ represents the conjugate of the quaternion q, and $A_p$ denotes the rotated original vector $A$.\r\n\r\n\r\n\r\n## Example\r\n\r\nLet's consider the scenario where the accelerometer outputs $(0, g, 0)$, with $g$ representing the gravitational acceleration. Assuming the quaternion corresponding to this vector (obtained from the IMU) is $(0.7071, 0.7071, 0, 0)$.\r\n\r\n\r\n\r\nUpon rotating the acceleration vector using the provided quaternion, the resulting vector would be $(0, 0, g)$, now aligned towards the Earth (assuming the z-axis points towards the Earth).\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple library for working with quaternions and vectors.",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/OmidAlek/quat"
},
"split_keywords": [
"python",
" quaternion",
" vector",
" xyzvector",
" imu",
" dmp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0aaa32d00b90603c2146a6385076e249320cddf3ca17a50773a72b5654f42600",
"md5": "d7ee25e2621fad3e4a2915b951a0f2d4",
"sha256": "c0c80943f89f2da22d1888cb732e9e7d6c19b1eeefdbeb6d26d1e2d51a63098c"
},
"downloads": -1,
"filename": "quat-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d7ee25e2621fad3e4a2915b951a0f2d4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3874,
"upload_time": "2024-05-09T19:23:48",
"upload_time_iso_8601": "2024-05-09T19:23:48.122204Z",
"url": "https://files.pythonhosted.org/packages/0a/aa/32d00b90603c2146a6385076e249320cddf3ca17a50773a72b5654f42600/quat-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "df3a1be655cf1961678f1b66f77cbd64a9d8263f343effc4d0aeed8fa95ddefa",
"md5": "f647d00ac37f3daa88e28f66d7af460b",
"sha256": "7de1a9c25b40648b837ada6ba2efea67e031722971fe1e5266bc0716721c8abb"
},
"downloads": -1,
"filename": "quat-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "f647d00ac37f3daa88e28f66d7af460b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4002,
"upload_time": "2024-05-09T19:23:49",
"upload_time_iso_8601": "2024-05-09T19:23:49.774105Z",
"url": "https://files.pythonhosted.org/packages/df/3a/1be655cf1961678f1b66f77cbd64a9d8263f343effc4d0aeed8fa95ddefa/quat-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-09 19:23:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "OmidAlek",
"github_project": "quat",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "quat"
}