{"id":18369917,"url":"https://github.com/cawfree/react-native-sensor-fusion","last_synced_at":"2025-06-29T17:04:06.562Z","repository":{"id":57339942,"uuid":"219159743","full_name":"cawfree/react-native-sensor-fusion","owner":"cawfree","description":"Robust absolute positioning in React Native.","archived":false,"fork":false,"pushed_at":"2023-05-14T20:24:43.000Z","size":8,"stargazers_count":30,"open_issues_count":2,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-01T14:49:30.306Z","etag":null,"topics":["3d","filter","kalman","native","position","react","react-native","sensor"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cawfree.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-11-02T13:44:55.000Z","updated_at":"2024-01-22T02:08:45.000Z","dependencies_parsed_at":"2023-12-21T17:30:15.373Z","dependency_job_id":null,"html_url":"https://github.com/cawfree/react-native-sensor-fusion","commit_stats":{"total_commits":10,"total_committers":3,"mean_commits":"3.3333333333333335","dds":0.5,"last_synced_commit":"3b539ea4d1d13b64b6d7af9cd4a414ae114d1c75"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cawfree/react-native-sensor-fusion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Freact-native-sensor-fusion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Freact-native-sensor-fusion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Freact-native-sensor-fusion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Freact-native-sensor-fusion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cawfree","download_url":"https://codeload.github.com/cawfree/react-native-sensor-fusion/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Freact-native-sensor-fusion/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262632322,"owners_count":23340213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","filter","kalman","native","position","react","react-native","sensor"],"created_at":"2024-11-05T23:33:37.569Z","updated_at":"2025-06-29T17:04:06.542Z","avatar_url":"https://github.com/cawfree.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/cawfree"],"categories":[],"sub_categories":[],"readme":"# react-native-sensor-fusion\nRobust absolute 3D positioning in React Native, using [sensor fusion](https://en.wikipedia.org/wiki/Sensor_fusion) to exploit the superior characterstics of the device Accelerometer, Gyroscope and Magnetometer, whilst mitigating against their negative qualities.\n\nPhysical data acquisition is implemented using [react-native-sensors](https://github.com/react-native-sensors/). The noise in sampled data is filtered from the input signals using the high quality [kalmanjs](https://github.com/wouterbulten/kalmanjs), and sensor fusion is calculated using [ahrs](https://github.com/psiphi75/ahrs).\n\n## 🚀 Getting Started\n\nUsing [`npm`]():\n\n```sh\nnpm install --save react-native-sensor-fusion\n```\n\nUsing [`yarn`]():\n\n```sh\nyarn add react-native-sensor-fusion\n```\n\n## ✍️ Example\n\n```javascript\nimport React from 'react';\nimport { Text } from 'react-native';\nimport SensorFusionProvider, { useSensorFusion, useCompass, toDegrees } from 'react-native-sensor-fusion';\n\nconst Indicator = () =\u003e {\n  const { ahrs } = useSensorFusion();  \n  const { x, y, z, w } = ahrs.toVector();\n  return (\n    \u003cText\n      children={toDegrees(z)}\n    /\u003e\n  );\n\nconst Indicator = () =\u003e {\n  const { ahrs } = useSensorFusion();\n  const { heading, pitch, roll } = ahrs.getEulerAngles();\n  const compass = useCompass();\n  return (\n    \u003cText\u003e\n      Heading: {toDegrees(heading)}°{'\\n'}\n      Pitch: {toDegrees(pitch)}°{'\\n'}\n      Roll: {toDegrees(roll)}°{'\\n'}\n      Compass: {toDegrees(compass)}°{'\\n'}\n    \u003c/Text\u003e\n  );\n};\n\nexport default () =\u003e (\n  \u003cSensorFusionProvider\u003e\n    \u003cIndicator /\u003e\n  \u003c/SensorFusionProvider\u003e\n);\n```\n\n## 📌 Prop Types\n\n-----\nProp                  | Type     | Default                   | Required | Description\n--------------------- | -------- | ------------------------- | -------- | -----------\nsampleInterval|number|60|No|The frequency to sample the device sensors in Hz.\nalgorithm|string|'Mahony'|No|Choose from the `Madgwick` or `Mahony` filter.\nbeta|number|0.4|No|The filter noise value, smaller values have smoother estimates, but have higher latency. This only works for the `Madgwick` filter.\nkp|number|0.5|No|The filter noise values for the `Mahony` filter (Proportional).\nki|number|0|No|The filter noise values for the `Mahony` filter (Integral).\n\n## ✌️ License\n[MIT](https://opensource.org/licenses/MIT)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.buymeacoffee.com/cawfree\"\u003e\n    \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy @cawfree a coffee\" width=\"232\" height=\"50\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcawfree%2Freact-native-sensor-fusion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcawfree%2Freact-native-sensor-fusion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcawfree%2Freact-native-sensor-fusion/lists"}