1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

bugfix to path library

This commit is contained in:
Corvus Corax 2012-05-28 14:48:08 +02:00
parent 089aa54a59
commit 51a4e82642

View File

@ -94,14 +94,18 @@ static void path_endpoint( float * start_point, float * end_point, float * cur_p
dist_diff = sqrtf( diff_north * diff_north + diff_east * diff_east );
dist_path = sqrtf( path_north * path_north + path_east * path_east );
if(dist_path < 1e-6 || dist_diff < 1e-6 ) {
if(dist_diff < 1e-6 ) {
status->fractional_progress = 1;
status->error = 0;
status->path_direction[0] = status->path_direction[1] = 0;
return;
}
status->fractional_progress = 1 - dist_diff / dist_path;
if(dist_path < 1e-6) {
status->fractional_progress = 0;
} else {
status->fractional_progress = 1 - dist_diff / dist_path;
}
status->error = dist_diff;
// Compute direction to travel