APM waypoint navigation algorithm issue...

Can any body help me to solve an issue...wheather APM2.8.1 firmware uses haversine formula or equirectangular approximation in case of waypoint distance calculation in navigation??

In the distance calculation function below

float get_distance(const struct Location *loc1, const struct Location *loc2) 

the return statement is    return sqrt(sq(dlat) + sq(dlong)) * .01113195;  

can any one tell me what is the significance of 0.1113195 value??

in case of bearing calculation function 

int32_t get_bearing_cd(const struct Location *loc1, const struct Location *loc2)

final bearing value is taken  by calculating in following way

int32_t bearing = 9000 + atan2(-off_y, off_x) * 5729.57795;

can any body plz tell me the significance of the constant value 9000 and 5729.57795 ??

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • thanx Clive
  •  0.01113195 is an approximate coefficient to calculate the length of a degree of latitude:

    ATAN2 returns radians. The 9000 and 5729.57795 converts an angle in radians to a bearing in centi-degrees. This is stored as an int32 to avoid floating point arithmetic.

This reply was deleted.

Activity