-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orientation visualizer understanding problem #13
Comments
Did you watch the video demo? This test is very easy to replicate. Just use that small program running on any Arduino board with 3 pots connected, so you can control the 3 inputs easily. If you imagine the visualization is an airplane instead of a circuit board, you can easily tell the old code is wrong and the new code visualizes roll, pitch & yaw correctly. It issue is a matter of extrinsic vs intrinsic rotation. Background material can be read here: Extrinsic means the rotations are relative to an absolute coordinate system. Intrinsic means the rotations are relative to the object itself. Here's the conversation where the problem was noticed and discussed. Look, I don't have a lot of time to write a lot more for you, and really everything has been said far better on those many pages. But still...
Ok, really quick.... Imagine you're taking a flight within the United States, and imagine a coordinate system where the X axis is West to East, and the Y axis is South to North, as if you had a regular map of the USA on a standard X-Y grid. I believe we can agree when your plane begins its descent to land, that's negative pitch. Roll involves the wings tilting, and pitch involves the nose of the plane pointing upwards vs downwards. This is the key point, pitch and roll are experienced by people on the plane (intrinsic). So, if you're flying from Seattle to San Diego, this (wrong) code in the visualizer actually works fine. As you come in for the landing in San Diego (flying Southward), the plane pointing downward is a rotation about the horizontal X axis.
But imagine instead you're flying from Seattle to New York. As your plane pitches downward to land in NYC, the plane itself is rotating about the Y-axis (the one drawn vertically on your USA map). This wrong code will visualize the wings tilting on your NYC descent, because it always applies pitch as a rotation about the horizontal X axis. As you descend towards New York, the plane's pitch is actually a rotation about the vertical Y axis. The matrix approach correctly visualizes negative pitch as the nose of the plane pointing downward, regardless of where the plane is actually heading (yaw). Hopefully you can understand this. I really can't spend more time explaining. If you still can't see it, I highly recommend you connect any Arduino with 3 pots and run that tiny program to send roll, pitch and yaw. If necessary, edit the code to draw an airplane instead of a circuit board. Or use your imagination that the connectors on the sides of the circuit board visualization are the plane's wings. When you do this, I'm confident you will quickly see the old code is very wrong. |
thanks for the helping out !! |
As you raised a issue here arduino/ArduinoCore-arc32#151
and you have corrected the issue using a matrix i.e
float c1 = cos(radians(roll));
float s1 = sin(radians(roll));
float c2 = cos(radians(pitch));
float s2 = sin(radians(pitch));
float c3 = cos(radians(yaw));
float s3 = sin(radians(yaw));
applyMatrix( c2_c3, s1_s3+c1_c3_s2, c3_s1_s2-c1_s3, 0,
-s2, c1_c2, c2_s1, 0,
c2_s3, c1_s2_s3-c3_s1, c1_c3+s1_s2_s3, 0,
0, 0, 0, 1);
Can you please explain the following matrix in terms simple
rotateY , rotateX, rotateZ functions
Did you also change anything in madgwick libraries ?
please help me to understand the basis of the changes.
The text was updated successfully, but these errors were encountered: