LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert coordinate system

Okay you are correct, I was not considering the radius (amplitude) since in my case it doesn't change like the phi and theta values, it only needs to follow the phi/theta to the new position.

 

The reason I'm having difficulty is I think it should be easy, but I never was any good at matrix math, nor have I delt with matrix programming, just arrays.

0 Kudos
Message 11 of 23
(2,195 Views)

The other problem is I'm not exactly sure in which direction to go, should I try some sort of matrix calculation, or break apart the values to convert one by one and use a loop like mentioned before? The problem with just re-defining the phi/theta is I lose all my amplitude values, and they need to be preserved in order for the pattern to look like a pattern.

0 Kudos
Message 12 of 23
(2,191 Views)

You need a function which can take an old set of coordinates and produce a new set. This would in general be p'(p, t) and t'(p, t). For linear transforms this can be written as a matrix with 4 unknowns:

 

p' = a*p + b*t

t' = c*p + d*t

 

This is the simple case for rotations in Cartesian coordinates for instance.

 

Nothing happens to your measured values.

 

(p, t, A) -> (p', t', A')

 

 

I agree that spherical coordinates are more complicated, but looking at your data, I think you luck out in the fact that when viewed as a sphere in 3D, your (p, t) coordinates rotate about the same axis as (p', t'). In fact it looks like for (0 < p < 180) and (-90 < t <90), the new coordinates equal the old coordinates. That's half of the sphere already. Once p goes past 180 though, now you need to map the original (-180 < t < -90) and (90 < t < 180) ranges to (-90 < t' < 0) and (0 < t' < 90). This completes the second half of the sphere in new coordinates. Keep thinking about it, and you'll find the answer.

 

Also as mentioned before you can convert half of your sphere to a 2D polar plot by projecting it r = sin(p) and a = atan2(sin(t),cos(t)), where (r, a) are the polar coordinates. You could make 2 polar plots of the whole sphere with the data colored based on the measured values.

0 Kudos
Message 13 of 23
(2,179 Views)

Gabe -Okay I see what you are saying, I tried your vi, the amplitudes are moving. I just needed to re-sort the columns. The only thing is that starting at phi = 180, theta is only from -87 - +87 so I am looking at where those 90s are now in your logic. Thanks for all the help, I'll post my vi when I get it working.

Download All
0 Kudos
Message 14 of 23
(2,163 Views)

You can try to change the "<" and ">" to "<=" and ">=". Part of the issues is that in the original data, there is actually duplicate measurements. Everything at (p = 0) and (p = 180) are the same for instance (0, 180) = (0, -180) = (180, 0) = (-180, 0). Further these all map to one point in the new coordinates (180, 0). In the new coordinates you want all (t' = -90) to be the same regardless of p' and all (t' = 90) to be the same for all p'. This will take some more logic duplicate measurements.

0 Kudos
Message 15 of 23
(2,145 Views)

In order to make any sense of this question, you need to carefully define Theta, Phi, Azimuth, and Tilt.  The reason that this is important is that you are dealing with rotations, which are matrix transformations that do not commute, that is, the order of operations is critical.  For example, when I think of spherical polar coordinates (Theta, Phi), I think about a fixed XYZ reference frame with the objective of aligning the Z axis so that it goes through my chosen point.  I do this by first doing a rotation about the Y axis by Phi (giving me a "latitude") and then rotating about the (still vertical) +Z axis (giving me a "longitude").

 

However, when I think about Azimuth and Tilt, I think about rotations about the object's frame of reference, similar to what some call Roll, Pitch and Yaw, with an "objective" of aligning the X axis with the specified point.  Here, the usual convention is that you first Yaw about the object's (and World) Z axis, then pitch about the object's Y axis, and finally roll about the Object's X axis (which, note, doesn't change the orientation of the X axis).

 

Once you establish your conventions, it is not difficult to write down the equations to do the work, but without knowing how you are defining your angles (for example, does "positive tilt" bring the X axis up or down?) and whether or not you use Azimuth and Tilt as rotations in the object's or world frame of reference.

 

BS

0 Kudos
Message 16 of 23
(2,137 Views)

Okay this has been so confusing for me, now the customer wants to keep the "old" spherical coordinates instead of trying to switch them all around.

 

The terms I have been using were due to what they want. Phi / Theta are what I know from the true spherical coordinates of the antenna chamber. The main beam of the antenna is at Phi=0, Theta=0. That's how I physically oriented the antenna in the chamber.

 

The customer is using these patterns in a planning tool (Forsk Atoll) for a macro cell phone tower site. They use Azimuth and Tilt which is as you said based on the obects frame of reference. Azimuth refering to basically the horizon, Tilt refering to the antenna's downtilt with negative tilt pointing towards the ground.

 

The thing I have to do now since I can skip the coordinate conversion is I need to rotate the beam peak from Phi=0, Theta=0 (+Z) to Phi=0, Theta=90 (+X). Then rotate again about the X axis so the bottom of the antenna is at Phi=0, Theta=180 (-Z).

 

The problem I'm having now is when I try rotating it doesn't seem to work. I put in my data to the 3D Coordinate Conversion.vi to get X,Y,Z then that into 3D Cartesian Coordinate Rotation (Euler).vi, rotate via Euler coordinates, then convert back to spherical and get data that I don't understand.

Download All
0 Kudos
Message 17 of 23
(2,118 Views)

I think I now understand your problem, and the solution is pretty simple.  But before I go proposing what to do, tell me if this is what you want to do:

 

You have an antenna that sends its signal straight up in the air, along the +Z Axis, where there are no listeners.  It is located at some point on the surface of the Earth.  +Z is up, and you decide that North will be +X, and West will be +Y.  Your customer asks you to point the antenna towards the town just northwest (i.e. at an Azimuth of 45 degrees) of your location, and then lower it by 10 degrees so that it "hits the ground" (assuming it's mounted on a tall tower).  Is that what you want to do?

 

BS

0 Kudos
Message 18 of 23
(2,113 Views)

There were a few problems in your vi. See the attached one that is corrected. The amplitudes are measured values at spherical coordinates, they are not the radius coordinate. You can set the radius to 1. The spherical to Cartesian conversion vi has axis1 = radius, axis2 = theta, axis3 = phi. No help from the documentation there. You need to convert degrees to radians and then radians to degrees after rotation for the phi and theta axes. What you will find though is that rotations in the spherical coordinates are simply adding or subtracting angles. But this is a sound approach. Also, you could feed the rotated output (X, Y, Z) coordinates into a 3D graph to visualize and then color the points based on the amplitude.

 

Good luck!

 

P.S. I added the plot... It's cool!

0 Kudos
Message 19 of 23
(2,102 Views)

Bob, Sort of, but I don't know what they want to do with the antenna in the field. I'm just concerned with the measured patterns and making them looked like I measured them in a different orientation. I measured them with the physical bottom at +Y and the main beam at +Z. I need to rotate the pattern so that it looks the same if I oriented the antenna with physical bottom at -Z and main beam at +X. This is so the customers software can understand the patterns because their cant see the main beam since it only looks at +X for it. To their software, +Z is +90° uptilt.

 

Gabe, I knew there had to be problems, but as you said the help isn't much...help. Your additions seem to help and the 3D plot is great because that was going to be my next question. I have been looking through the boards at all the 3D examples but none of them seemed to work for me. Once I get what I should be doing I can run with it. I'm just not familiar with the different types or LabVIEW 3D graphs. I was trying to use 3D Surface and you used 3D Scatter which actually works! The only thing is the feeding the X,Y,Z like you did doesnt make sense to me (the actual plot). I fed my phi, theta, and amp into another one and that actually looks like my pattern (I can see it at the measurement facility with the acquisition software). Now I'm just trying to make sure the rotation did the right thing, what do you think (attached)? 

 

After I get this to work, I want to be able to view the 3D graph as a ball plot (3D Surface?) and get it to look similar to when you view it in the acquisition software (example picture attached).

 

Thanks for all the help by the way, I'm definately learning!

 

Jamie

Download All
0 Kudos
Message 20 of 23
(2,071 Views)