It looks like what you're doing is reversing the order of rotations. Is that correct? I think of rotations in terms of matrix multiplication. If you have a 3-dimensional vector,
you can rotate it about the x-axis through an angleby left-multiplying by a rotation matrix to obtain the rotated vector
thus:
The other rotations you can see here.
Now, in your case, it looks like in the pan tilt case, you're applying a z rotation followed by an x or y rotation (depending on your orientation). In the tilt bank case, it's a little hard to see exactly what you're doing. The picture is a bit hard to decipher. Your pan tilt is like this, correct? Can you possibly draw a clearer picture of the tilt bank case?
Thanks Ackbeet,
I was wondering if this one was going to get answered.
Attached is a better picture of what I am trying to transform. On the left is the normal pan and tilt similar to the pan tilt camera you linked. The top red tilt axis is rotated about the vertical pan axis (blue). The red axis rotates atop the blue axis in the direction indicated. On the right, the red tilt axis is rotated in the direction indicated and the yellow bank axis is attached to the red tilt axis so that it is rotated with it. The bank axis then rotates about it's own axis. This is actually already built and I am attempting to do the transform to track the sun given pan and tilt degrees.
I knew the transform involved doing a matrix but 20 years of not using it has left me in the lurch on this one.
The solar panel sits atop the bank axis and a combination of the tilt and bank axes will allow the tracker to follow the sun via the NREL software. Any help is appreciated. I'm trying to get this into a formula form so I can feed pan and tilt into it and dump out tilt and bank degrees.
Thanks again,
T
Thanks for the second picture. It's definitely clearer than the first.
Let's assign some variables to things. In the pan/tilt picture, let theaxis be along the red rod, oriented positively from left to right. Let the
axis be along the blue rod, oriented positively up. By the right-hand rule, then, we must have the
axis be coming out of the picture towards us, and orthogonal to both the previous axes. Let us suppose you have a camera mounted on the red rod. I'm going to assume that, if the pan is at
radians, and the tilt is also at
radians, then the camera would then be pointed straight up, in the
direction. Is all this clear?
In the tilt/bank picture, we will utilize the same coordinate system. That is, theaxis is along the red rod, oriented positively from left to right. The
axis is vertical (where the yellow rod would be if it were vertical), and positive up. And the
axis is coming out of the picture. In this picture, we would need to have the camera mounted on the yellow rod so that if the tilt were at
radians, and the bank were at
radians, the camera would be pointed in the positive
direction. Is that clear?
The problem then becomes: given anpan rotation followed by a
tilt rotation, all applied to the unit
vector, resulting in the arbitrary unit vector
: produce the same vector by applying first a
tilt rotation, followed by a
bank rotation, all applied to the unit
vector. Is this correct?
Hi Ackbeet,
Yup, I'm with you.Let's assign some variables to things. In the pan/tilt picture, let theaxis be along the red rod, oriented positively from left to right. Let the
axis be along the blue rod, oriented positively up. By the right-hand rule, then, we must have the
axis be coming out of the picture towards us, and orthogonal to both the previous axes. Let us suppose you have a camera mounted on the red rod. I'm going to assume that, if the pan is at
radians, and the tilt is also at
radians, then the camera would then be pointed straight up, in the
direction. Is all this clear?
Think so, but I'm not sure that is where I am going with this. The solar panel is attached to the cylindical part of the yellow rod. Normally facing +/-45° from positiveIn the tilt/bank picture, we will utilize the same coordinate system. That is, theaxis is along the red rod, oriented positively from left to right. The
axis is vertical (where the yellow rod would be if it were vertical), and positive up. And the
axis is coming out of the picture. In this picture, we would need to have the camera mounted on the yellow rod so that if the tilt were at
radians, and the bank were at
radians, the camera would be pointed in the positive
direction. Is that clear?
with the yellow rod in the orientation displayed. There are mechanical limits on the system that prevent the bank axis from rotating past 45°. With the orientation as you are describing, there are infinite solutions to the tilt equation when the panel faces positive
. Maybe I am getting ahead of myself though.
I'm not sure I understand the application to the unitThe problem then becomes: given anpan rotation followed by a
tilt rotation, all applied to the unit
vector, resulting in the arbitrary unit vector
: produce the same vector by applying first a
tilt rotation, followed by a
bank rotation, all applied to the unit
vector. Is this correct?
vector. This is due the the first rotating body being on that axis? My gut says this is a correct description of the problem but my head is still having trouble wrapping around it. In the end the panel or camera should be facing the same direction for both systems as long as it it within the mechanical limits. The formula is the same either way.
It is amazing how much one can forget. It's like I'm learning it all over again.
Thank you for the assistance, I'd love to borrow your brain for a couple of days.
T.
Ah. Your last post explains why I didn't launch into any computations yet. I was expecting there to be some mechanical limitations on your system. When we finally get an equation that does what you want, you're going to have to put in checks on the results to make sure they are in the feasible region.
I don't suppose you could draw the default position of your solar panel into the picture, could you? Or maybe, you could give a vector triple:that describes the initial orientation of the panel? Here's my guess at what you meant: with the yellow rod pointed in the
direction, a vector normal to the working plane of the solar panel would point in the
direction. Is that correct?
Hi again,
See the attached modified pic. I hope that clears it all up. I knew going in that the mechanical limitations would not allow a sun up to sun down track of the sun and have already coded the program to stop the tracking process when the limits are reached. The sun in my location at the summer solstice on the pan and tilt pans over 180 degress. I never would have thought that but it is true.
The panel mounted to the round side of the bank axis has it's normal in facing straight up in the picture.
Thanks again,
T
I've got the answer, and I'm pretty sure it's correct. I'll post the punch-line now, and give the justification later, when I have time to type it up (it's a bit long). This has been a very fun problem. Thanks for posting it!
In the pan/tilt case, if the pan angle is, and the tilt angle is
, and if in the tilt/bank case the tilt angle is
and the bank angle is
, then the following equations hold:
and
Try that on for size. As I said above, I'll post the justification when I have the time.
Hey Ackbeet,
This was much more elegant than I had imagined it would be. I'm going to test it over the next couple of days and see how it does. I'll let you know. You are the man. Next time I have a completely baffling problem, I know who to call.
Thank you for all of your hard work.
T
Ok, here goes:
According to the wiki on matrix rotations in 3D, the following matrix rotates the positivethrough an angle
to the positive
:
You can check that this works. Also, the following matrix rotates the positivethrough an angle
to the positive
:
Finally, the following matrix rotates the positivethrough an angle
to the positive
:
In comparing these rotations to the rotations in your latest picture, it is evident that in the pan/tilt case, you have the following two rotations:and
Similarly, in the tilt/bank case, you have the following rotations:
and
![]()
Query: is the pan/tilt case giving usor
It is not self-evident which one is correct. Note that these two are not the same, since matrix multiplication is not commutative. However, by plugging in a simple base case of
and
, you can check that the correct order is
Similarly, for the tilt/bank case, the correct order is
We now simply set
This gives us the following system of simultaneous equations:
The solution I gave in post #10 satisfies all three of these equations.
So there's my solution, leaving out a few steps in the middle here and there.
You're very welcome for this solution. I enjoyed it!
Have a good one.
Ok, I ran some test data though excel with columns added for the above calculations.
I'm checking to make sure I didn't botch the transfer into Excel.
Here is the tilt calculation:
=DEGREES(ASIN(SIN(RADIANS(D2))*SIN(RADIANS(F2))))
Where D column contains the Pan Degrees and F column contains the tilt degrees.
Here is the bank calculation:
=DEGREES(ACOS(COS(RADIANS(F2))/COS(RADIANS(L2))))
Where F column contains the tilt degrees and L column contains the result of the tilt calculation.
In hindsight, I probably should have given you a data set to work with.
If I run a column of tilt data at a constant 21 degree tilt and a column of pan information from 0 to 180 I get a nice smooth translation with 90° being solar zenith. Next I'll go to MIDC: Solar Position Algorithm (SPA) Calculator for some real data to run through it.
Thanks again,
T