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

Catch from Corvus that the path error was being squared. However need to make

sure to take care of sign by removing one of those multiplcations.
This commit is contained in:
James Cotton 2012-05-26 15:24:50 -05:00
parent 5a67b8cc29
commit bd8125e41e

View File

@ -68,8 +68,11 @@ void path_progress(float * start_point, float * end_point, float * cur_point, st
status->error = normal[0] * diff_north + normal[1] * diff_east;
// Compute direction to correct error
status->correction_direction[0] = -status->error * normal[0];
status->correction_direction[1] = -status->error * normal[1];
status->correction_direction[0] = (status->error > 0) ? -normal[0] : normal[0];
status->correction_direction[1] = (status->error > 0) ? -normal[1] : normal[1];
// Now just want magnitude of error
status->error = fabs(status->error);
// Compute direction to travel
status->path_direction[0] = path_north / sqrtf(dist_path2);