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 8154475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:21:54+00:00 2026-06-06T16:21:54+00:00

I’m currently working on a tilt compensated linear accelerometer on an android phone. What

  • 0

I’m currently working on a tilt compensated linear accelerometer on an android phone. What i basically want to reach is the acceleration, which is in the earth frame, rather than sensor frame. I also want make my vector gravity free. X-axis of the accelerometer will be alligned seperately with the x-axis of a land vehicle. Therefore yaw compensation (angle between the x axis of the phone and magnetic north) is not wanted.

For this we have 2 sensor readings:

1) 3×3 rotation matrix R (rotation from earth frame to sensor frame)

2) 3×1 acceleration vector a = (x,y,z)^T from sensor frame

To manually remove gravity from a_transposed we can simply define a gravity vector in earth frame:

g = (0,0,9.81)^T

I can now multiply gravity with rotation matrix R and substract it from a vector. As a result a’ is the gravity free acceleration vector.

a’ = a – (R * g)
(at this step a’ has the same values as the software sensor LINEAR_ACCELERATION in API)

Until here everything works fine.

Now i want to rotate my linear acceleration vector a’ in the earth frame without taking Z-axis rotation in to account. In order to do so first i calculate the inverse of the rotation matrix R, which is equal to the tranpose of it:

R^(-1) = R^T

Then i multiply a’ with R^(-1) and rotate it back to earth frame.

a’ = R^(-1) * a’

At this step I have a tilt compensated linear acceleration data, if my phone is facing magnetic north, because i have also rotated around z axis, which is not needed. I have to rerotate it around z-axis to get the final right result. For this purpose i have calculated the euler angle (rotation around z axis) from the rotation matrix, which is yaw. And rotated my vector once in the opposite direction by using the yaw angle. This should be the final correction step but there is a cost using euler angles.

This method does not work if i hold the phone directly upwards, beacause if the roll angle is equal to 90 degrees and it causes a gimbal lock. My calculated yaw angle is then unknown and my back-rotation fails.

My question is how to modify/change the rotation matrix so that i can only rotate around x and y axis by ignoring z axis, without using euler angles?

i have alread checked but it didnt helped me:
How do I remove axis from a rotation matrix?

  • 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-06-06T16:21:56+00:00Added an answer on June 6, 2026 at 4:21 pm
    a_geo = R^-1*( a_phone - R*g ) = R^-1*a_phone - g
    

    so all you did so far is project your unbiased acceleration in local geographical frame (N,E,D or something). If what you want is a projection on horizontal plane, you simply annihilate the 3rd coordinate, lets say your indices are 1 based, like matlab or fortran:

    a_horiz=a_geo; a_horiz[3]=0;
    

    Or expressed with a matrix,

    a_horiz = [1,0,0;
               0,1,0;
               0,0,0] * a_geo;
    

    You can project this back to your phone axis,

    R*a_horiz;
    

    But it’s not clear if it’s really what you want… I guess you want to just apply a heading rotation and have some kind of horizontal forward acceleration and horizontal lateral (starboard) acceleration. I don’t know any easy trick… Just extract the heading (as you noted only possible if your phone x axis is not vertical)

    psi = atan2( R(1,2) , R(1,1) );
    

    Then rotate your horizontal acceleration

    a_horiz_car = [ cos(psi) ,  sin(psi) , 0;
                   -sin(psi) ,  cos(psi) , 0;
                    0        ,        0  , 1] * a_horiz;
    

    Only first two coordinates are interesting, so you could use 2×2 matrix.

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

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.