Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 760991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:47:04+00:00 2026-05-14T15:47:04+00:00

I am working on an iPhone app where we are trying to calculate the

  • 0

I am working on an iPhone app where we are trying to calculate the acceleration of a moving car. Similar apps have accomplished this (Dynolicious), but the difference is that this app is designed to be used during general city driving, not on a drag strip.

This leads us to one big concern that Dynolicious was luckily able to avoid: hills. Yes, hills.

There are two important stages to this: calibration, and actual driving.

Our initial run was simple and suffered the consequences. During the calibration stage, I took the average force on the phone, and during running, I just subtracted the average force from the current force to get the current acceleration this frame. The problem with this is that the typical car receives much more force than just the forward force – everything from turning to potholes was causing the values to go out of sync with what was really happening.

The next run was to add the condition that the iPhone must be oriented in such a way that the screen was facing toward the back of the car. Using this method, I attempted to follow only force on the z-axis, but this obviously lead to problems unless the iPhone was oriented directly upright, because of gravity.

Some trigonometry later, and I had managed to work gravity out of the equation, so that the car was actually being read very, very well by the iPhone.

Until I hit a slope. As soon as the angle of the car changed, suddenly I was receiving accelerations and decelerations that didn’t make sense, and we were once again going out of sync.

Talking with someone a lot smarter than me at math lead to a solution that I have been trying to implement for longer than I would like to admit. It’s steps are as follows:

1) During calibration, measure gravity as a vector instead of a size. Store that vector.
2) When the car initially moves forward, take the vector of motion and subtract gravity. Use this as the forward momentum. (Ignore, for now, the user cases where this will be difficult and let’s concentrate on the math 🙂
3) From the forward vector and the gravity vector, construct a plane.
4) Whenever a force is received, project it onto said plane to get rid of sideways force/etc.
5) Then, use that force, the known magnitude of gravity, and the known direction of forward motion to essentially solve a triangle to get the forward vector.

The problem that is causing the most difficulty in this new system is not step 5, which I have gotten to the point where all the numbers look as they should. The difficult part is actually the detection of the forward vector. I am selecting vectors whose magnitude exceeds gravity, and from there, averaging them and subtracting gravity. (I am doing some error checking to make sure that I am not using a force just because the iPhone accelerometer was off by a bit, which happens more frequently than I would like). But if I plot these vectors that I am using, they actually vary by an angle of about 20-30 degrees, which can lead to some strong inaccuracies. The end result is that the app is even more inaccurate now than before.

So basically – all you math and iPhone brains out there – any glaring errors? Any potentially better solutions? Any experience that could be useful at all?

Award: offering a bounty of $250 to the first answer that leads to a solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:47:05+00:00Added an answer on May 14, 2026 at 3:47 pm

    You need a gyro. Otherwise there are multiple configurations of an accelerating car on a hill that can give rise to exactly the same readings on an accelerometer. They will be completely impossible to distinguish. That’s why inertial navigation systems combine a gyro and accelerometer.

    The reason you can’t do this was given by Einstein! Using a local measurement, you can’t distinguish between gravity and acceleration. You do have some useful non-local information – the assumption that gravity here, and gravity a few yards over there, have the same value. But you can’t compare gravity in two different locations without a means to carry out what’s called “parallel transport”. This is what a gyro does.

    Forget the $250, but I think you should give me a beer for the amount of R&D time I’m saving you. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to display my iphone/Ipad app on my iPad but getting this
I am working on an iphone game with in app purchases. I'm trying to
I am working on an iPhone app with Apple Push Notification integration. I have
I'm working on an iphone app and want to have a page showing multiple
I am working on an iPhone app, in which I have to enlist all
I am working on a iPhone app and trying to add a German localization.
I am working on iPhone App similar to Pimp My text available here: http://itunes.apple.com/us/app/pimp-my-text-send-color-text/id489972714?mt=8
I am working on an iPhone app and I am trying to make something
I have been working on an iPhone app that has a feature of uploading
I'm currently working on an iPhone app and I have a library from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.