예제 #1
0
bool
TaskAdvance::IsStateReady(const TaskPoint &tp,
                          const AircraftState &state,
                          const bool x_enter,
                          const bool x_exit) const
{
  switch (tp.GetType()) {
  case TaskPointType::UNORDERED:
    gcc_unreachable();

  case TaskPointType::START:
    return x_exit;

  case TaskPointType::AAT: {
    const AATPoint &ap = (const AATPoint &)tp;
    return IsAATStateReady(ap.HasEntered(), ap.IsCloseToTarget(state));
  }

  case TaskPointType::AST: {
    const ASTPoint &ip = (const ASTPoint &)tp;
    return ip.GetScoreExit()
      ? x_exit
      : ip.HasEntered();
  }

  case TaskPointType::FINISH:
    return false;
  }

  gcc_unreachable();
}
예제 #2
0
void
TaskPointRenderer::Draw(const TaskPoint &tp, Layer layer)
{
  const OrderedTaskPoint &otp = (const OrderedTaskPoint &)tp;
  const AATPoint &atp = (const AATPoint &)tp;

  switch (tp.GetType()) {
  case TaskPointType::UNORDERED:
    if (layer == LAYER_LEG && location.IsValid())
      DrawTaskLine(location, tp.GetLocationRemaining());

    if (layer == LAYER_SYMBOLS)
      DrawBearing(tp);

    index++;
    break;

  case TaskPointType::START:
    index = 0;

    DrawOrdered(otp, layer);
    if (layer == LAYER_SYMBOLS) {
      DrawBearing(tp);
      DrawTarget(tp);
    }

    break;

  case TaskPointType::AST:
    index++;

    DrawOrdered(otp, layer);
    if (layer == LAYER_SYMBOLS) {
      DrawBearing(tp);
      DrawTarget(tp);
    }
    break;

  case TaskPointType::AAT:
    index++;

    DrawOrdered(otp, layer);
    if (layer == LAYER_SYMBOLS) {
      DrawIsoline(atp);
      DrawBearing(tp);
      DrawTarget(tp);
    }
    break;

  case TaskPointType::FINISH:
    index++;

    DrawOrdered(otp, layer);
    if (layer == LAYER_SYMBOLS) {
      DrawBearing(tp);
      DrawTarget(tp);
    }
    break;
  }
}
예제 #3
0
    virtual void Visit(const TaskPoint& tp) override {
        switch (tp.GetType()) {
        case TaskPointType::UNORDERED:
            printf("# got a tp\n");
            break;

        case TaskPointType::FINISH:
            printf("# got an ftp\n");
            ozv.Visit(((const FinishPoint &)tp).GetObservationZone());
            break;

        case TaskPointType::START:
            printf("# got an stp\n");
            ozv.Visit(((const StartPoint &)tp).GetObservationZone());
            break;

        case TaskPointType::AAT:
            printf("# got an aat\n");
            ozv.Visit(((const AATPoint &)tp).GetObservationZone());
            break;

        case TaskPointType::AST:
            printf("# got an ast\n");
            ozv.Visit(((const ASTPoint &)tp).GetObservationZone());
            break;
        }
    }
예제 #4
0
void
TaskPointConstVisitor::Visit(const TaskPoint &tp)
{
  switch (tp.GetType()) {

  case TaskPoint::ROUTE:
    assert(1); // not supported yet
    break;

  case TaskPoint::UNORDERED:
    Visit((const UnorderedTaskPoint &)tp);
    break;

  case TaskPoint::START:
    Visit((const StartPoint &)tp);
    break;

  case TaskPoint::AST:
    Visit((const ASTPoint &)tp);
    break;

  case TaskPoint::AAT:
    Visit((const AATPoint &)tp);
    break;

  case TaskPoint::FINISH:
    Visit((const FinishPoint &)tp);
    break;
  }
}
예제 #5
0
static fixed
GetSafetyHeight(const TaskPoint &tp)
{
  switch (tp.GetType()) {
  case TaskPointType::FINISH:
    return task_behaviour.safety_height_arrival;

  default:
    return task_behaviour.route_planner.safety_height_terrain;
  }
}
예제 #6
0
GlideResult
TaskMacCreadyTravelled::SolvePoint(const TaskPoint &tp,
                                   const AircraftState &aircraft,
                                   fixed minH) const
{
  assert(tp.GetType() != TaskPointType::UNORDERED);
  const OrderedTaskPoint &otp = (const OrderedTaskPoint &)tp;

  return TaskSolution::GlideSolutionTravelled(otp, aircraft,
                                              settings, glide_polar, minH);
}
예제 #7
0
bool
SmartTaskAdvance::CheckReadyToAdvance(const TaskPoint &tp,
                                      const AircraftState &aircraft,
                                      const bool x_enter, const bool x_exit)
{
  const bool state_ready = IsStateReady(tp, aircraft, x_enter, x_exit);

  if (armed)
    request_armed = false;

  switch (tp.GetType()) {
  case TaskPointType::UNORDERED:
    gcc_unreachable();

  case TaskPointType::START: {
    const StartPoint &sp = (const StartPoint &)tp;
    if (sp.DoesRequireArm()) {
      if (armed) {
        state = TaskAdvance::START_ARMED;
      } else {
        state = TaskAdvance::START_DISARMED;
        if (sp.IsInSector(aircraft))
          request_armed = true;
      }
      return armed && state_ready;
    } else {
      state = TaskAdvance::AUTO;
      return state_ready;
    }
  }

  case TaskPointType::AAT:
    if (armed) {
      state = TaskAdvance::TURN_ARMED;
    } else {
      state = TaskAdvance::TURN_DISARMED;
      if (state_ready)
        request_armed = true;
    }
    return armed && state_ready;

  case TaskPointType::AST: {
    state = TaskAdvance::AUTO;
    return state_ready;
  }

  case TaskPointType::FINISH:
    return false;
  }

  gcc_unreachable();
}
예제 #8
0
  void Visit(const TaskPoint &tp) override {
    switch (tp.GetType()) {
    case TaskPointType::UNORDERED:
      AddWaypoint(((const UnorderedTaskPoint &)tp).GetWaypointPtr(), true);
      break;

    case TaskPointType::START:
    case TaskPointType::AST:
    case TaskPointType::AAT:
    case TaskPointType::FINISH:
      AddWaypoint(((const OrderedTaskPoint &)tp).GetWaypointPtr(), true);
      break;
    }
  }
bool
TaskAdvanceLegacy::mode_ready(const TaskPoint &tp) const
{
  switch (mode) {
  case ADVANCE_MANUAL:
    return false;
  case ADVANCE_AUTO:
    return true;
  case ADVANCE_ARM:
    return m_armed;
  case ADVANCE_ARMSTART:
    return m_armed || tp.GetType() != TaskPoint::START;
  };
  return false;
}
예제 #10
0
GlideResult
TaskMacCreadyRemaining::SolvePoint(const TaskPoint &tp,
                                   const AircraftState &aircraft,
                                   fixed minH) const
{
    GlideState gs = GlideState::Remaining(tp, aircraft, minH);

    if (!include_travel_to_start && active_index == 0 &&
            tp.GetType() == TaskPointType::START &&
            !((const OrderedTaskPoint &)tp).HasEntered())
        /* ignore the travel to the start point */
        gs.vector.distance = fixed(0);

    return MacCready::Solve(settings, glide_polar, gs);
}
예제 #11
0
void
RenderTaskPoint::Draw(const TaskPoint &tp, Layer layer)
{
    const OrderedTaskPoint &otp = (const OrderedTaskPoint &)tp;
    const AATPoint &atp = (const AATPoint &)tp;

    switch (tp.GetType()) {
    case TaskPoint::UNORDERED:
        if (layer == LAYER_LEG)
            DrawTaskLine(location, tp.GetLocationRemaining());

        if (layer == LAYER_SYMBOLS)
            DrawBearing(tp);

        index++;
        break;

    case TaskPoint::START:
        index = 0;

        DrawOrdered(otp, layer);
        if (layer == LAYER_SYMBOLS) {
            DrawBearing(tp);
            DrawTarget(tp);
        }

        break;

    case TaskPoint::AST:
        index++;

        DrawOrdered(otp, layer);
        if (layer == LAYER_SYMBOLS) {
            DrawBearing(tp);
            DrawTarget(tp);
        }
        break;

    case TaskPoint::AAT:
        index++;

        DrawOrdered(otp, layer);
        if (layer == LAYER_SYMBOLS) {
            DrawIsoline(atp);
            DrawBearing(tp);
            DrawTarget(tp);
        }
        break;

    case TaskPoint::FINISH:
        index++;

        DrawOrdered(otp, layer);
        if (layer == LAYER_SYMBOLS) {
            DrawBearing(tp);
            DrawTarget(tp);
        }
        break;

    case TaskPoint::ROUTE:
        /* unreachable */
        assert(false);
        break;
    }
}