Beispiel #1
0
 private FlightAdjustment FreeStyle()
 {
     var fa = new FlightAdjustment();
     if (_flightVector == null) return fa;
     // TODO:  Rewrite to return an FA instead of powering directly.
     /*
     var quadrant = _flightVector.RelativeQuadrant;
     if (quadrant > 0) quadrant--;
     for (byte propId = 0; propId < 4; propId++)
     {
         var power = propId == quadrant ? (int) _flightVector.Magnitude : 0;
         _propellors[propId].SetPower(power);
     }
      */
     return fa;
 }
Beispiel #2
0
        private void AdjustFlight(FlightAdjustment adjustment)
        {
            const int MAX_ADJUSTMENT = 2;

            // Roll
            var adjAmt = (int) adjustment.Roll / 2;
            if (adjAmt == 0)
            {
                _propellors[1].SetPower(_powerBase);
                _propellors[3].SetPower(_powerBase);
                return;
            }
            if (adjAmt > MAX_ADJUSTMENT) adjAmt = MAX_ADJUSTMENT;
            if (adjAmt < MAX_ADJUSTMENT * (-1)) adjAmt = MAX_ADJUSTMENT * (-1);
            _propellors[1].SetPower(_powerBase + adjAmt);
            _propellors[3].SetPower(_powerBase - adjAmt);

            #if DEBUG
            Debug.Print("#1: " + _propellors[1].GetPowerLevel() + "   #2: " + _propellors[3].GetPowerLevel());
            #endif
            /*
            // Pitch
            var pitchDirection = 0;
            if (adjustment.Pitch > 0) pitchDirection = 1;
            if (adjustment.Pitch < 0) pitchDirection = -1;
            adjAmt = (int) adjustment.Pitch/2*pitchDirection;
            _propellors[1].AdjustPower(adjAmt);
            _propellors[3].AdjustPower(adjAmt * (-1));
             */
        }