Hi All,

I am trying to transform pan & tilt degrees into tilt & bank degrees for a solar tracking application. (see photo)

My trig skills have waned over the years. Can anyone here help?

Attachment 18060

Thanks.

T

Printable View

- July 1st 2010, 06:44 AMTrackerPan tilt to tilt bank transform
Hi All,

I am trying to transform pan & tilt degrees into tilt & bank degrees for a solar tracking application. (see photo)

My trig skills have waned over the years. Can anyone here help?

Attachment 18060

Thanks.

T - July 10th 2010, 05:00 PMAckbeet
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 angle by 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? - July 10th 2010, 08:58 PMTrackerBetter picture
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.

Attachment 18165

Thanks again,

T - July 12th 2010, 05:09 AMAckbeet
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 the axis 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, the axis 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 an pan 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? - July 12th 2010, 07:17 AMTrackerPan tilt description
Hi Ackbeet,

Quote:

Let's assign some variables to things. In the pan/tilt picture, let the http://www.mathhelpforum.com/math-he...bfab68f5af.png axis be along the red rod, oriented positively from left to right. Let the http://www.mathhelpforum.com/math-he...5354331dbb.png axis be along the blue rod, oriented positively up. By the right-hand rule, then, we must have the http://www.mathhelpforum.com/math-he...a73184980c.png 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 http://www.mathhelpforum.com/math-he...f9f98764da.png radians, and the tilt is also at http://www.mathhelpforum.com/math-he...f9f98764da.png radians, then the camera would then be pointed straight up, in the http://www.mathhelpforum.com/math-he...da0d61d3fd.png direction. Is all this clear?

Quote:

In the tilt/bank picture, we will utilize the same coordinate system. That is, the http://www.mathhelpforum.com/math-he...bfab68f5af.png axis is along the red rod, oriented positively from left to right. The http://www.mathhelpforum.com/math-he...5354331dbb.png axis is vertical (where the yellow rod would be if it were vertical), and positive up. And the http://www.mathhelpforum.com/math-he...a73184980c.png 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 http://www.mathhelpforum.com/math-he...f9f98764da.png radians, and the bank were at http://www.mathhelpforum.com/math-he...f9f98764da.png radians, the camera would be pointed in the positive http://www.mathhelpforum.com/math-he...bfab68f5af.png direction. Is that clear?

Quote:

The problem then becomes: given an http://www.mathhelpforum.com/math-he...5149852f08.png pan rotation followed by a http://www.mathhelpforum.com/math-he...59ed813421.png tilt rotation, all applied to the unit http://www.mathhelpforum.com/math-he...5354331dbb.png vector, resulting in the arbitrary unit vector http://www.mathhelpforum.com/math-he...20124ae381.png: produce the same vector by applying first a http://www.mathhelpforum.com/math-he...ae65c1de79.png tilt rotation, followed by a http://www.mathhelpforum.com/math-he...e15357ad29.png bank rotation, all applied to the unit http://www.mathhelpforum.com/math-he...bfab68f5af.png vector. Is this correct?

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. - July 12th 2010, 09:35 AMAckbeet
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? - July 12th 2010, 10:21 AMTrackerNew Picture
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.

Attachment 18177

Thanks again,

T - July 12th 2010, 11:59 AMAckbeet
Ok. I'm going to need to think about this one some more. My initial idea isn't working. I'll get back to you.

- July 12th 2010, 01:19 PMTrackerOK, I'll wait
See how you are the only one to try to help and I have no choice, I guess I'll wait.

Thanks,

T - July 13th 2010, 09:28 AMAckbeet
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. - July 13th 2010, 09:47 AMTracker
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 - July 13th 2010, 10:09 AMAckbeetJustification
Ok, here goes:

According to the wiki on matrix rotations in 3D, the following matrix rotates the positive through an angle to the positive :

You can check that this works. Also, the following matrix rotates the positive through an angle to the positive :

Finally, the following matrix rotates the positive through 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 us or 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. - July 13th 2010, 11:14 AMAckbeet
One further note: for computational efficiency, you might consider coding up this transformation as follows:

and

The idea here is, you use the first equation to compute , and then you have what you need to compute from the second equation. - July 13th 2010, 02:56 PMTracker
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 - July 26th 2010, 04:45 PMTrackerConfirmation
Hey there,

It has been a while but the tracker is done and has been tested. It works beautifully. Thank you once again for a job well done!

Tracker