How can i create xyz coordinant from pan-tilt system angles.

8 views (last 30 days)
Hello guys, I have 3 data, First servo angle for pan, second servo angle for tilt and measurement from the laser. If I can able to get xyz points, so I can use it as meshing point to 3D mapping by using software such as CloudCompare or MeshLab.
  2 Comments
Jim Riggs
Jim Riggs on 2 Nov 2018
Hard to understand what you want. Try drawing a picture to illustrate the problem.
Aui
Aui on 5 Nov 2018
Edited: KSSV on 5 Nov 2018
Dear Jim, https://www.youtube.com/watch?v=kJW9Uy4j-6k My project is as same as the project in this video.
I have 2 angle from servos and 1 data from laser meter. For mapping i need to get xyz coordinant from the datas
I hope you understand me now.

Sign in to comment.

Accepted Answer

Jim Riggs
Jim Riggs on 7 Nov 2018
It seems that you want to convert from spherical coordinates to Cartesian coordinates. You have pan angle (azimuth) and a tile angle (elevation), and the "1 data from laser meters" I assume that this is the range (or radius) in meters.
Matlab has a function which will perform this conversion called sph2cart:
[x,y,z] = sph2cart(azimuth,elevation,radius);
This function performs the following transformation:
x = radius .* cos(elevation) .* cos(azimuth);
y = radius .* cos(elevation) .* sin(azimuth);
z = radius .* sin(elevation);
  5 Comments
Jim Riggs
Jim Riggs on 7 Nov 2018
Edited: Jim Riggs on 7 Nov 2018
I am not sure what you are asking. If you have pan/tilt/range measurements, you can convert them directly to X/Y/Z coordinates. Just make sure that your pan/tilt angles are in radians when you call the sph2cart function. Or, you can write your own function using the three equations, above, and use the sind and cosd functions to operate in your data in degrees.
function [x, y, z] = my_sph2cart(pan,tilt,range)
x = range .* cosd(tilt) .* cosd(pan);
y = range .* cosd(tilt) .* sind(pan);
z = range .* sind(tilt);
end

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!