Giter Site home page Giter Site logo

k3ru-sailco / sensor-fusion Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5 KB

Create Android device like orientation sensor by fusing together noisy magnetometer and accelerometer data.

Go 100.00%
accelerometer device-orientation magnetometer orientation-sensor sensor-fusion android-sensor-manager

sensor-fusion's Introduction

sensor-fusion

Create a virtual orientation event by fusing gravity and magnetometer sensor data together. This is a port of the respective methods from the Android Device SensorManager to Go for use with spoofed or synthetic events.

This replicates how an android device typically gets its 3 orientation angles.

The downside to the use of this method is that the orientation events are not as exact as combined sensor would be due to the fact that the magnetometer and gravity sensor are inherently noisey/inaccurate.

More information regarding this topic can be found on a blog post made by Paul Lawitzki on Android sensor fusion, and applying a complimentrary filter to reduce or eradicate gyroscope drift and the aforementioned magnetometer and gravity drift. This post also served as a great reference while porting similar methods to Go.

Usage

    package main

    import "log"

    var (
	/*
		MAG and GRAV are each an individual
		slice of values representing a magnetometer and
		accelerometer event respectively.
	*/
	MAGNETOMETER_EVENT = []float64{}
	GRAVITY_EVENT      = []float64{}
    )

    func Example() {
	rotationMatrix := make([]float64, 9)
	inclinationMatrix := make([]float64, 9)
	if getRotationMatrix(rotationMatrix, inclinationMatrix, GRAVITY_EVENT, MAGNETOMETER_EVENT) {
		orientation := getOrientation(rotationMatrix)
		log.Println(orientation)
	}
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.