Example #1
0
        private void EvaluateVehicleFacingAngle()
        {
            // Get direction from sensors
            double degreesToCorrect;

            // Get roll speed from sensors
            double rollToCorrect = GetRollRate();

            // First we correct the roll
            RollThrusterGroup.correctCurrentSpin(rollToCorrect);

            // Now we assess attitude
            degreesToCorrect = GetAttitudeSensorData();

            // Now correct any spin needed
            RollThrusterGroup.applyRollCorrection(degreesToCorrect);
        }
        public bool SelfTest()
        {
            /* Test cases to test against:
             *  RollCorrection
             *  - 0 roll delta = 0 total corrective duration, and no firing
             *  - 1 roll delta = turn on engines, apply .2 seconds of corrective wait
             *  - -1 roll deltr = turn on engines to -1, apply .2 seconds of corrective wait
             *  - 10 roll delta = turn engines on to 1, apply 2 seconds of corrective wait
             *  - -10 roll delta = turn engines on to -1, apply 2 seconds of corrective wait
             *
             *  correctSpin
             *  - 0 roll  = 0 total corrective duration, and no firing
             *  - 1 rpm  = turn on engines, apply .1 seconds of corrective wait
             *  - -1 rpm  = turn on engines to -1, apply .1 seconds of corrective wait
             *  - 10 rpm  = turn engines on to 1, apply 1 seconds of corrective wait
             *  - -10 rpm  = turn engines on to -1, apply 1 seconds of corrective wait
             */
            bool         returnVal    = true;
            RollThruster testThruster = new RollThruster();

            if (returnVal == true)
            {
                returnVal = (testThruster.applyRollCorrection(0) == 0);
            }
            if (returnVal == true)
            {
                returnVal = (testThruster.applyRollCorrection(1) == .2);
            }
            if (returnVal == true)
            {
                returnVal = (testThruster.applyRollCorrection(-1) == .2);
            }
            if (returnVal == true)
            {
                returnVal = (testThruster.applyRollCorrection(10) == 2);
            }
            if (returnVal == true)
            {
                returnVal = (testThruster.applyRollCorrection(-10) == 2);
            }



            if (returnVal == true)
            {
                returnVal = (testThruster.correctCurrentSpin(0) == 0);
            }
            if (returnVal == true)
            {
                returnVal = (testThruster.correctCurrentSpin(1) == .1);
            }
            if (returnVal == true)
            {
                returnVal = (testThruster.correctCurrentSpin(-1) == .1);
            }
            if (returnVal == true)
            {
                returnVal = (testThruster.correctCurrentSpin(10) == 1);
            }
            if (returnVal == true)
            {
                returnVal = (testThruster.correctCurrentSpin(-10) == 1);
            }

            return(returnVal);
        }