i want to level my hexacopter and have problems to calculate the angles for 2 of the axis. i have the x and y angle of my mpu6050 but the axis 3 and 1 is 30 degress away from my x axis and i dont know how to calculate the angle for these 2 axis.
What are the requirements of what you are trying to do? Do you need to program the locations of this axis or just calculate it the position for physical components?
Axis Y / A1 is -60° off Y / A2 and Y / A3 is +60° off Y / A2.
So you can use A2 as your global co-ordinate system, and use radial co-coordinates to quickly get center points A1 / A2 or you can use transformation matrices for Cartesian co-ordinates and map A1 / A3 back to A2 or use geometry.
i want to have the angle of these axis to stabilize my hexacopter with a PID controller. i already built a quadcopter with a good stabilization but the axis of the quadcopter fit to the axis of the mpu6050. Now i need these two extra angles of axis A3 and A1.
I think i need a transformation matrix or geometry but i realy dont know how to calculate it. i found a mathematic solution with a euler rotation matrix but i dont understand it and i hope there is a easier solution for my problem.
If you were to work it out geometrically you would get the same thing.
This works if you have a base/world co-coordinate axis and assume that the radius of the center distances remain the same. Which seems to be the case. Alternatively you could just add the degrees to an angle you already know to the polar co-ordinates. (Which is why it is important to know your 0° and base axis) then convert to Cartesian.
the angles respect to the x/y level of my mpu6050. i have to get the x and y angle to zero with my 3 axes.
we can use the A2 axis as reference axis.
I never worked with matrices and i dont know how a transformation matrix works, but i dont have coordinates of my axis. I only have the angle of my x-axis and my y-axis to the straight level of my multicopter which is reached when the x and y angle is zero.
This works for any point on the A2 axes, and in general is a rotation matrix for the entire co-ordinate system.
Your going to have to provide more information about what the "straight level" is. As well was which co-coordinate system you currently are measuring from it.
i think one reference axes is not enough. i tried to express the situation with vektors. i have the x-> and y-> vektors and i need the a3-> vektor. the x-> and y-> vektors are creating a level in which the vektor a3-> must be contained. the a3-> vektor is 30° away from the y-> vektor.
and what i need is the 26° angle from the a3-> vektor to the A3-axes.
That only serves to make things more confusing. The X & Y axes arn't orthogonal. There is apparently a sum of 90° even before the angle between x-> and a3->. There isn't any indication of what A3 is; is it part of the X/Y co ordinate system or another entirely? (Also x-> is bad format for a vector, 0x would be better as it shows the vector goes from the origin to the point of x.)
I mean I assume that all these vectors are on the X/Y co ordinate system but I can't make heads or tails from that.
And your question is confusing. If you are asking for the angle... well then you have it, you just stated it. If you want how a vector is represented on a different co ordinate system, I already showed how to do that.
I still don't know why this information is needed, or how it is used.
Having more than one reference co-coordinate system doesn't make much sense. If this information is going to be processed by a computer, it needs to do it from a single reference. If you are building something then you want to do it from a single reference. That's why you map things onto your reference co-ordinate system. If that's not your goal that needs to be better explained.
You don't show the naming or numbering of your motors. Let's call them:
FL (Front Left)
FR (Front Right)
L (Left, negative Y axis)
R (Right, positive Y axis)
BL (Back Left)
BR (Back Right)
To pitch up you would add power to the FL and FR motors while reducing power to the BL and BR motors.
To pitch down you would add power to the BL and BR motors while reducing power to the FL and FR motors.
Use the pitch PID to determine how much power to add and subtract.
To roll left, add power to the three right motors while reducing power to the three left motors.
Similarly to roll right.
To yaw CW add power to the three CW motors and reduce power to the three CCW motors.
No fancy math necessary. Yes, more motors change power on roll than on pitch but most of those motors are closer to the roll axis so they exert less leverage. It should be close enough for the PID tuning to compensate.