Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Math Help - Pan tilt to tilt bank transform

  1. #1
    Newbie
    Joined
    Jun 2010
    Posts
    8

    Pan 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?
    Pan tilt to tilt bank transform-pantilt.jpg


    Thanks.
    T
    Follow Math Help Forum on Facebook and Google+

  2. #2
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    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,

    \vec{r}=\left[\begin{matrix}x\\ y\\ z\end{matrix}\right],

    you can rotate it about the x-axis through an angle \theta by left-multiplying by a rotation matrix to obtain the rotated vector \vec{r}_{\text{rot}} thus:

    \vec{r}_{\text{rot}}=<br />
\left[\begin{matrix}<br />
1 &0 &0\\ <br />
0 &\cos(\theta) &-\sin(\theta)\\<br />
0 &\sin(\theta) &\cos(\theta)\end{matrix}\right]\left[\begin{matrix}x\\ y\\ z\end{matrix}\right].

    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?
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jun 2010
    Posts
    8

    Better 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.
    Pan tilt to tilt bank transform-pantiltbank.jpg
    Thanks again,
    T
    Follow Math Help Forum on Facebook and Google+

  4. #4
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    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 \hat{i} axis be along the red rod, oriented positively from left to right. Let the \hat{j} axis be along the blue rod, oriented positively up. By the right-hand rule, then, we must have the \hat{k} 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 0 radians, and the tilt is also at 0 radians, then the camera would then be pointed straight up, in the +\hat{j} direction. Is all this clear?

    In the tilt/bank picture, we will utilize the same coordinate system. That is, the \hat{i} axis is along the red rod, oriented positively from left to right. The \hat{j} axis is vertical (where the yellow rod would be if it were vertical), and positive up. And the \hat{k} 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 0 radians, and the bank were at 0 radians, the camera would be pointed in the positive \hat{i} direction. Is that clear?

    The problem then becomes: given an \alpha pan rotation followed by a \beta tilt rotation, all applied to the unit \hat{j} vector, resulting in the arbitrary unit vector \hat{r}: produce the same vector by applying first a \gamma tilt rotation, followed by a \delta bank rotation, all applied to the unit \hat{i} vector. Is this correct?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Jun 2010
    Posts
    8

    Pan tilt description

    Hi Ackbeet,
    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?
    Yup, I'm with you.

    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?
    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 positive 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.

    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?
    I'm not sure I understand the application to the unit 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.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    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: \langle x,y,z\rangle that describes the initial orientation of the panel? Here's my guess at what you meant: with the yellow rod pointed in the -\hat{k} direction, a vector normal to the working plane of the solar panel would point in the \frac{\langle 0,1,-1\rangle}{\sqrt{2}} direction. Is that correct?
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Jun 2010
    Posts
    8

    New 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.


    Pan tilt to tilt bank transform-pantiltbank.jpg

    Thanks again,
    T
    Follow Math Help Forum on Facebook and Google+

  8. #8
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    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.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Jun 2010
    Posts
    8

    OK, 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
    Follow Math Help Forum on Facebook and Google+

  10. #10
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    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 \alpha, and the tilt angle is \beta, and if in the tilt/bank case the tilt angle is \gamma and the bank angle is \delta, then the following equations hold:

    \sin(\delta)=\sin(\alpha)\sin(\beta), and
    \cos(\gamma)=\frac{\cos(\beta)}{\sqrt{1-\sin^{2}(\alpha)\sin^{2}(\beta)}}.

    Try that on for size. As I said above, I'll post the justification when I have the time.
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Newbie
    Joined
    Jun 2010
    Posts
    8
    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
    Follow Math Help Forum on Facebook and Google+

  12. #12
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2

    Justification

    Ok, here goes:

    According to the wiki on matrix rotations in 3D, the following matrix rotates the positive \hat{j} through an angle \theta=\pi/2 to the positive \hat{k}:

    R_{x}(\theta)=\left[\begin{matrix}1 & 0 & 0 \cr 0 & \cos (x) & -\sin (x) \cr 0 & \sin (x) & \cos (x) \cr\end{matrix}\right].

    You can check that this works. Also, the following matrix rotates the positive \hat{k} through an angle \theta=\pi/2 to the positive \hat{i}:

    R_{y}(\theta)=\left[\begin{matrix}\cos (x) & 0 & \sin (x) \cr 0 & 1 & 0 \cr -\sin (x) & 0 & \cos (x) \cr\end{matrix}\right].

    Finally, the following matrix rotates the positive \hat{i} through an angle \theta=\pi/2 to the positive \hat{j}:

    R_{z}(\theta)=\left[\begin{matrix}\cos (x) & -\sin (x) & 0 \cr \sin (x) & \cos (x) & 0 \cr 0 & 0 & 1 \cr\end{matrix}\right].

    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: R_{x}(-\beta) and R_{y}(\alpha). Similarly, in the tilt/bank case, you have the following rotations: R_{z}(\delta) and R_{x}(-\gamma).

    Query: is the pan/tilt case giving us R_{x}(-\beta)R_{y}(\alpha)\hat{j}, or R_{y}(\alpha)R_{x}(-\beta)\hat{j}? 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 \alpha=\pi/2 and \beta=\pi/2, you can check that the correct order is R_{y}(\alpha)R_{x}(-\beta)\hat{j}. Similarly, for the tilt/bank case, the correct order is R_{x}(-\gamma)R_{z}(\delta)\hat{j}. We now simply set

    R_{y}(\alpha)R_{x}(-\beta)\hat{j}=R_{x}(-\gamma)R_{z}(\delta)\hat{j}.

    This gives us the following system of simultaneous equations:

    \left[\begin{matrix}<br />
-\sin(\alpha)\sin(\beta)\\ \cos(\beta)\\ -\cos(\alpha)\sin(\beta)<br />
\end{matrix}\right]=\left[\begin{matrix}<br />
-\sin(\delta)\\ \cos(\gamma)\cos(\delta)\\ -\cos(\delta)\sin(\gamma)<br />
\end{matrix}\right].

    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.
    Follow Math Help Forum on Facebook and Google+

  13. #13
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    One further note: for computational efficiency, you might consider coding up this transformation as follows:

    \sin(\delta)=\sin(\alpha)\sin(\beta), and
    \cos(\gamma)=\frac{\cos(\beta)}{\sqrt{1-\sin^{2}(\delta)}}=\frac{\cos(\beta)}{\cos(\delta)  }.

    The idea here is, you use the first equation to compute \delta, and then you have what you need to compute \gamma from the second equation.
    Follow Math Help Forum on Facebook and Google+

  14. #14
    Newbie
    Joined
    Jun 2010
    Posts
    8
    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
    Follow Math Help Forum on Facebook and Google+

  15. #15
    Newbie
    Joined
    Jun 2010
    Posts
    8

    Confirmation

    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
    Follow Math Help Forum on Facebook and Google+

Page 1 of 2 12 LastLast

Similar Math Help Forum Discussions

  1. Calculate tilt stiffness
    Posted in the Advanced Applied Math Forum
    Replies: 0
    Last Post: November 26th 2011, 09:17 AM
  2. Replies: 3
    Last Post: May 24th 2009, 04:49 AM
  3. Bank Robbery
    Posted in the Math Challenge Problems Forum
    Replies: 2
    Last Post: October 21st 2008, 05:58 AM
  4. A bank account...
    Posted in the Business Math Forum
    Replies: 3
    Last Post: June 1st 2008, 12:37 AM
  5. Bank problem
    Posted in the Math Topics Forum
    Replies: 3
    Last Post: November 10th 2007, 08:30 PM

Search Tags


/mathhelpforum @mathhelpforum