diff --git a/src/MissionManager/FixedWingLandingComplexItem.cc b/src/MissionManager/FixedWingLandingComplexItem.cc index ffccbcf03870d2b4550a98f3019bb072d60bc9df..0ef549d8a2f264c07adc393b66c3eefbe894755d 100644 --- a/src/MissionManager/FixedWingLandingComplexItem.cc +++ b/src/MissionManager/FixedWingLandingComplexItem.cc @@ -227,10 +227,15 @@ void FixedWingLandingComplexItem::_recalcLoiterCoordFromFacts(void) convertGeoToNed(_landingCoordinate, tangentOrigin, &north, &east, &down); + // Heading is from loiter to land, so we need to rotate angle 180 degrees and go the opposite direction + double heading = _landingHeadingFact.rawValue().toDouble(); + heading += 180.0; + heading *= -1.0; + QPointF originPoint(east, north); north += _loiterToLandDistanceFact.rawValue().toDouble(); QPointF loiterPoint(east, north); - QPointF rotatedLoiterPoint = _rotatePoint(loiterPoint, originPoint, _landingHeadingFact.rawValue().toDouble()); + QPointF rotatedLoiterPoint = _rotatePoint(loiterPoint, originPoint, heading); convertNedToGeo(rotatedLoiterPoint.y(), rotatedLoiterPoint.x(), down, tangentOrigin, &_loiterCoordinate);