calculate the distance between the waypoint in APM 2.22 coding

hi,

after I learned coding in apm 2.22.i find that formula to calculate the distance between waypoint  is:

  if(loc1->lat == 0 || loc1->lng == 0)

  return -1;

  if(loc2->lat == 0 || loc2->lng == 0)

  return -1;

  float dlat = (float)(loc2->lat - loc1->lat);

  float dlong= ((float)(loc2->lng - loc1->lng)) * scaleLongDown;


wp_distance= (sqrt [ (latitude2-latitude1)^2 + (longitude2-longitude1)^2 ) ] ) * 0.01113195;


my question is:

function "scaleLongDown" is used for what, and how its value? 

Where the value " 0.01113195" obtained from ? and what it use for?

what units used for " wp_distance" obtained ? (kilometer or meter or degree or what?)


thanks.


Tags: 2.22, APM, coding, distance, navigation, tracking, waypoint

Views: 73

Reply to This

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service