Esempio n. 1
0
    /// <summary>
    /// Called on drone position reception. Also dispatch a PositionEvent
    /// Don't forget to call the base method if you override this
    /// </summary>
    /// <param name="position">The position given by the Kalman Filter (In the Unity3d base).</param>
    protected void OnPosition(Vector3 position)
    {
        if (UseAsInput) // If used as input, apply a low pass filter to improve position accuracy, as delay is not as important
        {
            _realPosition = _positionEstimationLowPassFilter.AddValue(position);
        }
        else
        {
            _realPosition = position;
        }

        _realPositionChanged = true;
        if (PositionEvent != null)
        {
            PositionEvent(this, position);
        }
    }