• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TaskAccessor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TaskAccessor的典型用法代码示例。如果您正苦于以下问题:C++ TaskAccessor类的具体用法?C++ TaskAccessor怎么用?C++ TaskAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TaskAccessor类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: switch

void
TaskAutoPilot::update_mode(const TaskAccessor& task,
                           const AircraftState& state)
{
    switch (acstate) {
    case Cruise:
        /* XXX this condition is probably broken */
        if (awp > 0 && !negative(task.remaining_alt_difference())) {
            acstate = FinalGlide;
            on_mode_change();
        } else {
            if (state.altitude<=target_height(task)) {
                acstate = Climb;
                on_mode_change();
            }
        }
        break;
    case FinalGlide:
        if (task.remaining_alt_difference()<-fixed_20) {
            acstate = Climb;
            on_mode_change();
        }
        break;
    case Climb:
        /* XXX this condition is probably broken */
        if (awp > 0 && !negative(task.remaining_alt_difference())) {
            acstate = FinalGlide;
            on_mode_change();
        } else if (state.altitude>=fixed_1500) {
            acstate = Cruise;
            on_mode_change();
        }
        break;
    };
}
开发者ID:,项目名称:,代码行数:35,代码来源:


示例2: fixed

bool
TaskAutoPilot::far_from_target(const TaskAccessor& task, const AIRCRAFT_STATE& state)
{
  // are we considered close to the target?

  if (task.is_empty())
    return w[0].distance(state.Location)>state.Speed;

  bool d_far = (task.leg_stats().remaining.get_distance() > fixed(100));

  if (!task.is_ordered())
    // cheat for non-ordered tasks
    return d_far;

  bool entered = task.has_entered(awp);

  if (current_has_target(task))
    return d_far || !entered;

  fixed dc = w[0].distance(state.Location);
  if (awp==0) {
    return (dc>state.Speed);
  }
  return (dc>state.Speed) || !entered;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:25,代码来源:TaskAutoPilot.cpp


示例3: switch

void
TaskAutoPilot::update_mode(const TaskAccessor& task,
                           const AIRCRAFT_STATE& state)
{
  switch (acstate) {
  case Cruise:
    if ((awp>0) &&
        (task.distance_to_final()<= state.Speed)) {
      acstate = FinalGlide;
      on_mode_change();
    } else {
      if (state.NavAltitude<=target_height(task)) {
        acstate = Climb;
        on_mode_change();
      }
    }
    break;
  case FinalGlide:
    if (task.remaining_alt_difference()<-fixed_20) {
      acstate = Climb;
      on_mode_change();
    }
    break;
  case Climb:
    if ((awp>0) &&
        (task.distance_to_final()<= state.Speed)) {
      acstate = FinalGlide;
      on_mode_change();
    } else if (state.NavAltitude>=fixed_1500) {
      acstate = Cruise;
      on_mode_change();
    }
    break;
  };
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:35,代码来源:TaskAutoPilot.cpp


示例4:

bool
TaskAutoPilot::has_finished(TaskAccessor& task)
{
    if (task.is_finished())
        return true;

    if (task.is_ordered()) {
        return awp>= task.size();
    } else {
        return awp>= 1;
    }
}
开发者ID:,项目名称:,代码行数:12,代码来源:


示例5: GeoVector

GeoPoint
TaskAutoPilot::get_start_location(const TaskAccessor& task, bool previous)
{
    if (!previous && (task.is_ordered())) {
        // set start location to 200 meters directly behind start
        // (otherwise start may fail to trigger)
        Angle brg = w[0].Bearing(w[1]);
        return GeoVector(fixed(200), brg).EndPoint(w[1]);
    } else {
        return w[0];
    }
}
开发者ID:,项目名称:,代码行数:12,代码来源:


示例6: fixed

bool
TaskAutoPilot::far_from_target(const TaskAccessor& task, const AircraftState& state)
{
    // are we considered close to the target?

    if (task.is_empty() || !task.leg_stats().remaining.IsDefined())
        return w[0].Distance(state.location)>state.ground_speed;

    bool d_far = (task.leg_stats().remaining.GetDistance() > fixed(100));

    if (!task.is_ordered())
        // cheat for non-ordered tasks
        return d_far;

    bool entered = awp >= task.size() || task.has_entered(awp);

    if (current_has_target(task))
        return d_far || !entered;

    fixed dc = w[0].Distance(state.location);
    if (awp==0) {
        return (dc>state.ground_speed);
    }
    return (dc>state.ground_speed) || !entered;
}
开发者ID:,项目名称:,代码行数:25,代码来源:


示例7: min

void
TaskAutoPilot::update_cruise_bearing(const TaskAccessor& task,
                                     const AircraftState& state,
                                     const fixed timestep)
{
    const ElementStat &stat = task.leg_stats();
    Angle bct = stat.solution_remaining.cruise_track_bearing;
    Angle bearing;

    if (current_has_target(task)) {
        bearing = stat.solution_remaining.vector.bearing;

        if (parms.enable_bestcruisetrack && (stat.solution_remaining.vector.distance>fixed_1000)) {
            bearing = bct;
        }

    } else {
        bearing = state.location.Bearing(target(task));
    }

    if (positive(state.wind.norm) && positive(state.true_airspeed)) {
        const fixed sintheta = (state.wind.bearing-bearing).sin();
        if (fabs(sintheta)>fixed(0.0001)) {
            bearing +=
                Angle::Radians(asin(sintheta * state.wind.norm / state.true_airspeed));
        }
    }
    Angle diff = (bearing-heading).AsDelta();
    fixed d = diff.Degrees();
    fixed max_turn = parms.turn_speed*timestep;
    heading += Angle::Degrees(max(-max_turn, min(max_turn, d)));
    if (positive(parms.bearing_noise)) {
        heading += heading_deviation()*timestep;
    }
    heading = heading.AsBearing();
}
开发者ID:,项目名称:,代码行数:36,代码来源:


示例8: min

void
TaskAutoPilot::update_cruise_bearing(const TaskAccessor& task,
                                     const AIRCRAFT_STATE& state,
                                     const fixed timestep)
{
  const ElementStat stat = task.leg_stats();
  Angle bct = stat.solution_remaining.CruiseTrackBearing;
  Angle bearing;

  if (current_has_target(task)) {
    bearing = stat.solution_remaining.Vector.Bearing;

    if (parms.enable_bestcruisetrack && (stat.solution_remaining.Vector.Distance>fixed_1000)) {
      bearing = bct;
    }

  } else {
    bearing = state.Location.bearing(target(task));
  }

  if (positive(state.wind.norm) && positive(state.TrueAirspeed)) {
    const fixed sintheta = (state.wind.bearing-bearing).sin();
    if (fabs(sintheta)>fixed(0.0001)) {
      bearing +=
        Angle::radians(asin(sintheta * state.wind.norm / state.TrueAirspeed));
    }
  }
  Angle diff = (bearing-heading).as_delta();
  fixed d = diff.value_degrees();
  fixed max_turn = parms.turn_speed*timestep;
  heading += Angle::degrees(max(-max_turn, min(max_turn, d)));
  if (positive(parms.bearing_noise)) {
    heading += heading_deviation()*timestep;
  }
  heading = heading.as_bearing();
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:36,代码来源:TaskAutoPilot.cpp



注:本文中的TaskAccessor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TaskContext类代码示例发布时间:2022-05-31
下一篇:
C++ Task类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap