I try to get 1 angle (e.g. Dorsi Plantar Flextion Angle) from alsolute orentation sensors which output is (Quaternion, Euler angles, Rotation vector,Linear acceleration, Gravity, Heading).
Sensor is 'Bosch BNO055'
May be I would use Euler angles from 3 sensors.
What I want to ask is Is there a formula or process that calculate one angle from 3 Euler angles?
Thanks ahead.
Related
I am currently working on block-breaking in a Minecraft clone. In order to do so, I want use the camera's Euler angles to determine the direction vector of the camera's ray.
I have 2 angles: pitch and yaw.
Pitch rotates along the X axis and is positive when the player looks down, and negative when the player looks up. It cannot be greater than 90 degrees (looking straight down) and cannot be smaller than -90 degrees (looking straight up)
Yaw rotates along the Y axis. It can be a negative number and a positive number, depending on how many times the player turned and in which direction. For example, the player spawns in (yaw = 0) and instantly spins counter-clockwise 360 degrees. In such a case, yaw = -360.
As stated in the question, I am using OpenGL, so when yaw = 0, the player is looking down the negative Z-axis.
How can I generate a direction vector (must be a unit-vector) using only the Euler angles with the restrictions described above?
From your description of Pitch and Yaw, I am assuming that you are using a left-hand reference (pitch=0 and yaw=0 gives a camera vector (0.0, 0.0, 1.0).
The Pitch parameter moves the camera vector in the YZ plane :
Y = cos(pitchInRadians)
Z = sin(pitchInRadians)
The Yaw parameter moves the camera vector in the XZ plane :
X = sin(yawInRadians)
Z = cos(yawInRadians)
Combining the two would give you your final camera vector :
Cv = (sin(yaw), cos(pitch), sin(pitch)*cos(yaw))
As you should have noted, the angles are in radians. Since your post mentions angles in degrees, you will have to convert your degree angles to radians first :
radians = (degrees * PI) /180
I have an object rotates around the y axis in 2 dimension image, i want to know the angle of rotation around y axis, if i already have the initial point(X,Y) and the point(X',Y) after rotation.
I have tried to follow the 3 dimension rotation equations (https://www.siggraph.org/education/materials/HyperGraph/modeling/mod_tran/3drota.htm) to evaluate the value of rotation angle no matter the direction of rotation,but i do not know the Z value from the 2 dimension to evaluate the rotation angle from the equations.
I figure out that i can't know the accurate rotation angles because i don't have full information about the location of points after and before rotation , i just have a projection of points(after and before the rotation)(x,y) in 2D image(plan) as "Nico Schertler" said in the comments, so i found an approximate solution which is to map the 2D object to similar 3D model for the same object and simulate the same motion on the 3D object to know approximated information about angles, in my case i want to know the rotation angles of a human head (head pose) so i mapped some 2D head features point to another 3D model and after deep diving into mathematics i got approximated rotation matrix as it shown here (http://www.learnopencv.com/head-pose-estimation-using-opencv-and-dlib/)
I have a huge set of normalized position vectors. The vector-set is recorded by a special measurement device, while the device is rotate around two axes. Every position vector is also a combination of gravitational values for X, Y, and Z at a defined time. My assignment is to get the rotational speed of the both axes.
The coordinate system of the measurement device is rotated by circa 45° around the z-axis in relation to the coordinate system of machine.
The z-axis of the measurement device parallel to the z-axis of the machine.
I have tried to convert the carthesian coordinates to spherical coordinates. For this i used the Qt-Framework and MATLAB. As a result I got 2 angles and a radius. In my opinion the radius is not important. But the 2 angles don’t fit my problem, because I need the rotational speed of machine around the machine Z-axis and the X-axis. At this point it is important to know that the rotational speed is so slow that gravity-vector pointed always with 1g in to the ground. The X-,Y-, and Z-values of the measurement device represents the orientation subject to the gravity-vector . For example if the Z-axis pointed to the Ground the value is nearly 1. And if the axis is parallel to the ground (also orthogonal to the gravity-vecot) the value is nearly zero.
If the machine only rotates around the Z-axis I can get the period of one rotation very easy. The plot of the Y-values and X-values subject to the time is a sine or cosine. So I can get period by searching for the zero point, the maxima or the minima.
rotation around the z-axis
But this solution fit only the 1axis-problem. If the machine rotates additional around the X-axis the measured X-, Y-, and Z-values are combinations of both rotations. I have no idea how I can fix my problem.
rotation around the machines z-axis and x-axis: the rotation starts after 55s!
Another idea is the inverse kinematic but for this I need the dimensions of the machine and the exact point where the measurement device is mounted.
rotation around 1 axis
Dataset rotation around 1 axis
rotation around 2 axis
Dataset rotation around 2 axes
How can I start or go ahead?
I have tried to visualize the rotational process with this picture.
I tried to put this in as a comment, but there is a length limit there. So, some clarifying questions / intermediate conclusions:
Thanks for the figures! So it looks from your 4th figure above, the one showing 2-axis x-y-z sine waves, and from your diagram of the machine, like you have three coordinate systems: The first is the earth frame, call it x1,y1,z1, as you show it in "machine picture" diagram. The second frame call it x2,y2,z2 rotates about both the x1 and the x2 axes (they remain parallel). The third frame x3,y3,z3 is the one that rotates about the z2 (=z3) axis. Your accelerometers are fixed in the x3,y3,z3 coordinate frame.
Your single-axis data set has z3=z2 aligned with earth z1, and spins about z, so that x3 and y3 spin around sampling gravity in quadrature sine waves.
In your second data set, the outer gimbal x1=x2 rotates at a constant rate, giving rise to the perfect sine wave on the z accelerometer, while the inner z3=z2 gimbal also spins perhaps at a constant rate, but now the accelerometers on x3 and y3 have their amplitudes modulated by multiplying by the cosine of the x1/x2 rotation angle.
Does all this sound right?
One other thing we always need to know when estimating velocity from position measurements is some kind of model or concept of how your system changes in time: Can we assume some maximum angular acceleration? Or can we assume that once the rotation(s) come up to speed, that they are constant? That will become especially important in trying to stitch the z2/z3 gimbal angle over the times when the x1/x2 angle passes through +/-pi/2 radians, where the z2/z3 angle becomes momentarily unobservable because the x and y accelerometers are orthogonal to the gravity vector and will just show noise. It will also help us to decide if the x1/x2 gimbal went up to pi/2 and back down again, or kept turning in the same direction to > pi/2, because both motions look the same on the z accelerometer, and the z2/z3 angle is unobservable there.
Simple answer:
Use two-argument arctangent.
The roll angle is atan2(ay, ax).
The pitch angle is atan2(az, sqrt(ax*ax + ay*ay)).
Then time-difference these to get angle rates.
This oversimplified solution has a number of problems, but it's a good place to start.
Probably the key you need is this: You must transform the x and y accelerations from measurement coordinates to machine coordinates before estimating the pitch about the machine x axis. This requires you to first know the roll angle (about the machine z axis). In matlab sytax,
[x_machine; y_machine] = [cos(roll) -sin(roll); sin(roll) cos(roll)] * [x_meas; y_meas].
z_machine = z_meas, always.
Given x,y,z in machine coordinates, you can directly estimate the pitch angle and rate about the machine x axis:
pitch = atan2(z_machine, -y_machine) (right hand rule about the machine x axis; positive acceleration pointing down);
pitch_rate = -asin((xyz_i cross xyz_i-1)_x) / dt_i,
where in English, the rate is computed from the arcsine of the x_machine component of the cross product of the latest machine coordinate acceleration vector with the previous one, divided by the time between them (1/8 of a second in your case).
The same approach works for estimating roll and roll rate (about the machine z axis):
roll = atan2(-x_meas, -y_meas) * cos(pitch) / abs(cos(pitch));
roll_rate = -asin((xyz_meas_i cross xyz_meas_i-1)_z) * cos(pitch) / abs(cos(pitch)) / dt_i.
It is a chicken-and-egg problem, where you need to know the pitch and roll to estimate pitch and roll and their rates. So you need to start off with a good guess of the correct pitch and roll angles (to within 15 degrees or so should be fine).
All of the measurements are noisy, so the estimates will be also. The rate estimates especially so. So you will want to filter the estimates in time. Propagate your pitch and roll angle estimates in time using your filtered angle rate estimates.
Also, your roll angle and rate estimates become pure noise as pitch is near +/-pi/2, so you should probably weight down the inputs to the roll filters by something like cos^2(pitch).
I am trying to understand trigonometry and the short answer is that I do not.
I drew a little triangle to mess around with and I asked myself the question, "If I know the length of the hypotenuse and the angle, how do I find the length of the other edges?".
Then I started reading. Apparently, the sine of angle A is supposed to equal the length of the opposite side divided by the length of the hypotenuse. So I figured that, using a right triangle, multiplying the length of the hypotenuse by the sine of the angle would yield the length of the opposing side.
1.414 / 1 = .707blahblah * 1.414 = 1 on my calculator.
But in every programming language I try sin(45.0) equals .8somethingsomething. I tried c++, c#, java, php, and lua.
Is the input not being interpreted as degrees? What unit is being used and how do I convert it? I've been seeing the word Radians, it would be helpful if someone could explain what a Radian is.
Radians are units of angular measure, like degrees, except that while there are 360 degrees in a circle, there are 2*pi (about 6.28) radians in a circle. You can convert degrees to radians by multiplying by pi (3.14159) and dividing by 180.
The formula works if the triangle is a right triangle, and yes, most programming languages expect radians rather than degrees as arguments to functions like sin() and cos().
Regarding the argument in the comments below: if you fix angle <BAC, side AB, and side BC, you can see that there are two possible positions for point C which preserve the the length D2 for side BC. Therefore <BAC, D1, and D2 do not fully determine a triangle.
The input to sin functions generally is expected in radians, not degrees. For example, in the Java documentation for sin it's stated that:
Parameters:
a - an angle, in radians.
Convert the angle in degrees to radians first, by multiplying it by pi/180
A radian is the distance of the radius of a circle along its circumference. Since a circle's circumference is 2 times pi times its radius, there are 2 times pi radians in one complete circle.
Yes, you are correct. Those functions all take their input in radians, not degrees.
You can convert degrees to radians by multiplying the degrees by π/180.
Convert to radians: Radian = degree/180*Pi
In order to convert from degrees to radians, divide the number in degrees by 180 and multiply by pi.
How do I calculate the pitch, yaw, and roll angles for a point in 3D space?
I'm working on a game where the player character must face towards an object that's flying around.
For yaw, use the atan2() of the X and Y coordinates. For the pitch, use the X-Y magnitude and the Z coordinate. Points don't have a roll.