Finding an angle from quaternions or rotations on planes?
9 views (last 30 days)
Show older comments
Hello everyone!
For a project I'm working on I have acquired data using three sensors, placed as displayed in the picture on the human body. Each sensor is able to sample Roll, Pitch and Yaw (rotation on xy, xz and yz planes) but also quaternions (with a matrix containing q0,q1,q2 and q3).
The goal of the project is to calculate the angle of the knee and the hip (also shown in the picture). Intuitively the solution should be to somehow calculate the difference of some data between the sensor on the upper leg and lower leg for the knee joint angle and from the upper leg and pelvis for the hip angle.
I've tried two metods using MATLAB:
- calculating the difference between q0 of one sensor and q0 of the other, q1 and q1 and so on, and then using "quat2eur" to convert them into eulerian angles, but it didn't work
- "resetting" roll, pitch and yaw when the subject is in standing position (first picture), and then calculate the difference between sensors of roll, pitch and yaw.
Both methods don't seem to have a reasonable graph as a result, does anyone have any ideas? I feel like I'm close to the solution but I'm missing something, perhaps because I don't have a lot of experience with the subject.
Thank you so much in advance for your time!
Vittorio
2 Comments
James Tursa
on 28 May 2018
You need to tell us precisely what the sensors are measuring. I.e., from what frame to what other frame?
Mo
on 3 Jun 2018
Edited: James Tursa
on 4 Jun 2018
I used 2 sensors (thigh and shank) and have a matrix (100*4) of the quaternion for each sensor. I have seen this method (see below) to calculate the relative angle between two quaternions but cannot use it for my matrix.
An=A/norm(A);
Bn=B/norm(B);
QuatDiff=quatmultiply(quatconj(An),Bn);
ang=2*atan2(norm(QuatDiff(2:4)),QuatDiff(1));
_________________________________________
A= sensor A quaternion and B=sensor B quaternion
Answers (1)
Mo
on 3 Jun 2018
I used 2 sensors (thigh and shank) and have a matrix (100*4) of the quaternion for each sensor. I have seen this method (see below) to calculate the relative angle between two quaternions but cannot use it for my matrix.
An=A/norm(A); Bn=B/norm(B); QuatDiff=quatmultiply(quatconj(An),Bn); ang=2*atan2(norm(QuatDiff(2:4)),QuatDiff(1)); _________________________________________ A= sensor A quaternion and B=sensor B quaternion
0 Comments
See Also
Categories
Find more on Specialized Messages in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!