Does anybody in the group know of a utility that could convert relative coordinates in feet / meters to absolute coordinates by providing a set of long/lat coordinates and a origin / staring coordinate
You need to be a member of diydrones to add comments!
I wrote a couple MATLAB functions a while ago that do what I think you're talking about. If you create a local coordinate system with x-direction east, y-direction north, and z-direction up. Flat earth coordinates are probably accurate enough for your UAV for a couple kilometers.
This function will return the x and y position in meters (East and North), given an origin (likely your base station or some fixed point around where you fly) and the UAV position. function [ x, y ] = longlat2xy( long_pos, lat_pos, origin_long, origin_lat)
long_diff = long_pos - origin_long;
lat_diff = lat_pos - origin_lat;
x_meters_per_degree = 1000*km_per_deg(origin_lat);
y_meters_per_degree = 1000*111.320;
x = x_meters_per_degree*long_diff;
y = y_meters_per_degree*lat_diff;
This function just returns the number of kilometers per degree change in longitude (which varies with latitude) function output = km_per_deg( latitude_in_degrees )
latitude_in_radians = deg2rad(latitude_in_degrees);output = (111.320 + 0.373*sin(latitude_in_radians)^2)*cos(latitude_in_radians);
Replies
This function will return the x and y position in meters (East and North), given an origin (likely your base station or some fixed point around where you fly) and the UAV position.
function [ x, y ] = longlat2xy( long_pos, lat_pos, origin_long, origin_lat)
long_diff = long_pos - origin_long;
lat_diff = lat_pos - origin_lat;
x_meters_per_degree = 1000*km_per_deg(origin_lat);
y_meters_per_degree = 1000*111.320;
x = x_meters_per_degree*long_diff;
y = y_meters_per_degree*lat_diff;
This function just returns the number of kilometers per degree change in longitude (which varies with latitude)
function output = km_per_deg( latitude_in_degrees )
latitude_in_radians = deg2rad(latitude_in_degrees);output = (111.320 + 0.373*sin(latitude_in_radians)^2)*cos(latitude_in_radians);
I hope you find this useful.