How Do You Calculate Angles from Acceleration Data in Different Motion States?

  • Thread starter Thread starter IMK
  • Start date Start date
  • Tags Tags
    Accelerometer
Click For Summary
SUMMARY

This discussion focuses on calculating angles from acceleration data using an accelerometer in both static and dynamic states. The user, IMK, presents two sets of data: static measurements at rest and dynamic measurements during horizontal movement. While the static case allows for straightforward calculations using the formula sqrt(x*x+y*y+z*z) and cos-1 for angle determination, the dynamic case presents challenges due to the influence of acceleration on the readings. The consensus suggests that to accurately determine orientation during movement, one must subtract gravitational effects from the static data and analyze the relationships between the x, y, and z components.

PREREQUISITES
  • Understanding of vector mathematics and forces
  • Familiarity with accelerometer data interpretation
  • Knowledge of trigonometric functions, specifically cos-1 and arctan
  • Basic grasp of gravitational effects on acceleration measurements
NEXT STEPS
  • Research methods for filtering accelerometer data to isolate gravitational effects
  • Learn about quaternion mathematics for orientation calculations
  • Explore the use of Kalman filters for sensor fusion in motion tracking
  • Study the principles of angular acceleration measurement using gyroscopes
USEFUL FOR

This discussion is beneficial for engineers, data scientists, and hobbyists working with motion sensors, particularly those interested in robotics, mobile device orientation, and motion analysis.

IMK
Messages
61
Reaction score
0
Hello,

I was wondering is someone can help me please with the mathematics of forces/vectors and acceleration. Now I realize that I have a good deal to learn on the subject but as I am starting out on this venture the challenge is find the right reference,. Hence I need more than just a little help; so to the problem.

I have an accelerometer that I can read the x, y, z g forces from, and I have record two sets of data that can be found below. The first set is the static, and the second set are reading taken when the device was accelerating. The device is tiled over at 45 degrees around the y-axis thus the orientation of the device is x=45, y=0, z=45 for both sets of measurements.

I can calculate the total g force from the device thus:
sqrt(x*x+y*y+z*z) and the angle of an axis thus by the cos-1 thus 0.7 g = 45 degrees.
Now this works for the static case, but does not work for the dynamic (accelerating) case. I have tried to scale the x, y, z g forces by the total g force but the cos-1 produces an incorrect result as the orientation of the device has not changed..

Can you help?

Many thanks in advance IMK

Static Data acceleromter at rest
------------------------
X | Y | Z |
------------------------
45 | 0 | 45 | Device Orientation
------------------------
0.7 | 0.0 | 0.7 | x,y,z g's. Thus sqrt(x*x+y*y+z*z)=1.0 (Scale=1/1=1)
------------------------
0.7*1 | 0.0*1 | 0.7*1 | Scale each g value thus
------------------------
0.7 | 0.0 | 0.7 | cos-1 eg acos( 0.7 ) = 45
------------------------
45 | 0 | 45 | Degress
------------------------

Dynamic Data acceleromter moved horizontally
------------------------
X | Y | Z |
------------------------
45 | 0 | 45 | Device Orientation
------------------------
1.2 | 0.0 | 0.45 | x,y,z g's. Thus sqrt(x*x+y*y+z*z)=1.28 (Scale=1/1=0.78)
------------------------
1.2*.78| 0*0.78|.45*.78| Scale each g value thus
------------------------
0.93 | 0.0 | 0.35 | cos-1 eg acos( n ) = are incorrect ?
------------------------
21 | 0 | 69 | Degress
------------------------
As the orientation of the device has not changed these angles should be:
------------------------
45 | 0 | 45 |
------------------------
 
Physics news on Phys.org
Not sure I can be of any help, but if it is "moving" horizontally, is it accelerating in this direction? I first tared the static measurements off the dynamic ones.

Doing so, I noted that values were twice tha value along the other, suggesting the horizontal angle (arctan=2) with respect to the 2 axes affected. But I truly have no idea of what either one of us is doing.:confused:
 
Oh well sorry to have confused the issue.
I have attached a simple txt file with two sets of test data,
set one is the device rotated around the y-axis at 45 degress,
the other is the device laying flat.
So if anyone can figure it out I would be most greatful.

The question is how do I calculate the orientation of the device when it is moving?

Have a good Easter all the best IMK
 

Attachments

when moving is it free to spin? Big difference in complexity and basically insoluble I believe w/o gyro that can measure angular acceleration, problem is degenerate.
 
Last edited:
denverdoc, many thanks for your reply.

No the device will not be spinning just simply moving from its point of rest in a direction.

Again many thanks for your help, my maths is not great and I have spent a couple of days reading up on this and have not found a formula yet.

All the best IMK
 
Last edited:
well if it is not free to rotate, you have already done that by using your static data, as the orientation should not change if movement purely translational. Now to get direction of movement, I believe what I suggested was correct, that you must first subtract effects of gravitational field registered with static data, and then look at relations between x,y,z as I did. It suggests acceleration occurred at angle of 60 degrees in x-z plane.
 
Last edited:
denverdoc, again many thanks.
I must have mist somthing in your 1st post, I am just on my way out now so I will look at it again on my return.

Many thanks IMK
 
no problem, I'll be around off and on most of the day.
 
Hi,

Is anyone still around from this old post?
 

Similar threads

Replies
6
Views
1K
Replies
12
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
4
Views
7K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
7
Views
2K
Replies
7
Views
3K
Replies
4
Views
2K