Ejemplo n.º 1
0
static void
CalculatePirker(DistanceStat &pirker, const DistanceStat &planned,
                const DistanceStat &remaining_effective)
{
  if (planned.IsDefined() && remaining_effective.IsDefined())
    pirker.SetDistance(planned.GetDistance() -
                        remaining_effective.GetDistance());
  else
    pirker.Reset();
}
Ejemplo n.º 2
0
void
DistanceStatComputer::CalcSpeed(DistanceStat &data, fixed time)
{
  if (positive(time) && data.IsDefined())
    data.speed = data.GetDistance() / time;
  else
    data.speed = fixed_zero;
}
Ejemplo n.º 3
0
void
DistanceStatComputer::ResetIncrementalSpeed(DistanceStat &data)
{
  fixed distance = data.IsDefined() ? data.GetDistance() : fixed_zero;
  fixed speed = data.IsDefined() ? data.GetSpeed() : fixed_zero;

  df.Reset(distance, (is_positive ? -1 : 1) * speed);
  v_lpf.Reset((is_positive ? -1 : 1) * speed);
  data.speed_incremental = fixed_zero; // data.speed;
  av_dist.Reset();
}
Ejemplo n.º 4
0
void
IncrementalSpeedComputer::Reset(DistanceStat &data)
{
  fixed distance = data.IsDefined() ? data.GetDistance() : fixed(0);
  fixed speed = data.IsDefined() ? data.GetSpeed() : fixed(0);

  df.Reset(distance, (is_positive ? -1 : 1) * speed);
  v_lpf.Reset((is_positive ? -1 : 1) * speed);
  data.speed_incremental = fixed(0); // data.speed;
  av_dist.Reset();

  last_time = fixed(-1);
}