News for hackers. Stuff that matters.
Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by HelpfulNoob on Sunday December 11, 2016 @03:53PM (#13153123)
Haven't tried anything like this recently so I was curious how accurate it was.

Here are two screenshots: http://imgur.com/a/8IM9s

I am impressed but there is some delay and lagging behind when moving the phone.

Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by folli on Sunday December 11, 2016 @04:11PM (#13153251)
Thanks for giving it a try!

I'm using a low pass filter on the raw sensor data to minimize any jittery input.

The code I'm using is as follows:

  alpha = 0.1;
  output = previous_output + alpha * (new_input-previous_output);
If anyone knows a better way to get a stable and also current read-out, I would be more than interested!
Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by nitrogen on Sunday December 11, 2016 @04:21PM (#13153337)
I haven't implemented one myself, but Kalman filters are frequently used for this. Search HN's history to find several (presumably) good introductions.
Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by rawnlq on Sunday December 11, 2016 @08:32PM (#13154830)
Kalman filters can get really complicated (EKF, UKF, adaptive, etc etc) and needs to be tuned with the correct covariances.

Complementary filters works well enough and is very simple to implement even if you're a noob (e.g., high pass on accelerometer and low pass on gyro).

Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by duerrp on Monday December 12, 2016 @02:51AM (#13156381)
There's a lot of libraries that do the hard work for you though... Anyway, if an EKF is too much effort, you could also try the "Madgwick" filter:

Madgwick, S. O., Harrison, A. J., & Vaidyanathan, R. (2011). Estimation of imu and marg orientation using a gradient descent algorithm. In Proceedings of the IEEE International Conference on Rehabilitation Robotics

Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by folli on Monday December 12, 2016 @03:41AM (#13156585)
The Madgwick filter seems to be popular for gyroscope applications, this might be very helpful. Thanks!
Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by folli on Sunday December 11, 2016 @05:04PM (#13153630)
Awesome! I'll check it out
Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by skeletonjelly on Sunday December 11, 2016 @06:24PM (#13154122)
I'm no expert, but when I had to make a cursor on the screen from Kinect hand location data I used what's called an exponential weighted average using output from an exponential moving average function on the raw data.

http://stackoverflow.com/questions/7947352/exponential-movin...

http://blogs.interknowlogy.com/2011/10/27/kinect-joint-smoot...

Worked pretty well!

Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by folli on Monday December 12, 2016 @02:58AM (#13156408)
That sounds very helpful! I'll give it a close read and see what I can come up with.
Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by 8note on Sunday December 11, 2016 @07:38PM (#13154571)
i think i small windowed median filter would do a good job in this case
Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by folli on Monday December 12, 2016 @02:56AM (#13156401)
I tried a small windowed mean filter, which gave really bad results. I'll try implementing the median filter.
Re:Show HN: Augmented Reality App to Predict the Sun and Moo... by folli on Sunday December 11, 2016 @04:14PM (#13153278)
Also be aware, that the accuracy is solely dependent on the accuracy of your device. If your compass is not correctly calibrated or there is any magnetic interference, the software can't do much.