1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

Cheat. For FW navigation when doing endpoint mode plot path from current

position to endpoint.
This commit is contained in:
James Cotton 2012-06-08 11:44:22 -05:00
parent 980111d246
commit ccee8e09f4

View File

@ -245,20 +245,26 @@ static void updatePathVelocity()
VelocityActualGet(&velocityActual);
struct path_status progress;
path_progress(pathDesired.Start, pathDesired.End, &positionActual.North, &progress);
float groundspeed;
float altitudeSetpoint;
switch (pathDesired.Mode) {
case PATHDESIRED_MODE_PATH:
case PATHDESIRED_MODE_ENDPOINT:
default:
path_progress(pathDesired.Start, pathDesired.End, &positionActual.North, &progress);
groundspeed = pathDesired.StartingVelocity + (pathDesired.EndingVelocity - pathDesired.StartingVelocity) *
bound(progress.fractional_progress,0,1);
altitudeSetpoint = pathDesired.Start[2] + (pathDesired.End[2] - pathDesired.Start[2]) *
bound(progress.fractional_progress,0,1);
break;
case PATHDESIRED_MODE_ENDPOINT:
path_progress(&positionActual.North, pathDesired.End, &positionActual.North, &progress);
groundspeed = pathDesired.StartingVelocity + (pathDesired.EndingVelocity - pathDesired.StartingVelocity) *
bound(progress.fractional_progress,0,1);
altitudeSetpoint = pathDesired.Start[2] + (pathDesired.End[2] - pathDesired.Start[2]) *
bound(progress.fractional_progress,0,1);
break;
default:
break;
}
// calculate velocity - can be zero if waypoints are too close