Ejemplo n.º 1
0
        /* ************************************************************************************************
        * Function Name: GetReactionWheels
        * Input: none
        * Output: None
        * Purpose: This function will grab a list of gyroscopes installed on the scope's craft. The name
        * is leftover from a previous functionality, of which the function use to return a list of all
        * reactionwheels, including command modules and gyroscopes.
        *
        * This was heavily refactored on 11/3/2014 by Raven.
        * ************************************************************************************************/
        private void GetReactionWheels()
        {
            ReactionWheels.Clear();

            foreach (Part p in FlightGlobals.ActiveVessel.Parts)
            {
                CactEyeGyro mrw = p.GetComponent <CactEyeGyro>();
                if (mrw != null)
                {
                    if (!ReactionWheels.Contains(mrw))
                    {
                        ReactionWheels.Add(mrw);
                        GyroSensitivity = mrw.GyroSensitivity;
                    }
                }
            }

            Debug.Log("CactEye 2: Found " + ReactionWheels.Count().ToString() + " Gyro units.");

            if (ReactionWheels.Count <CactEyeGyro>() > 0)
            {
                GyroEnabled = true;
                ReactionWheelPitchTorques = ReactionWheels.Select(CactEyeGyro => CactEyeGyro.PitchTorque).ToList();
                ReactionWheelYawTorques   = ReactionWheels.Select(CactEyeGyro => CactEyeGyro.YawTorque).ToList();
                ReactionWheelRollTorques  = ReactionWheels.Select(CactEyeGyro => CactEyeGyro.RollTorque).ToList();
            }
            else
            {
                GyroEnabled = false;
            }
        }
Ejemplo n.º 2
0
        /* ************************************************************************************************
        * Function Name: GetReactionWheels
        * Input: none
        * Output: None
        * Purpose: This function will grab a list of gyroscopes installed on the scope's craft. The name
        * is leftover from a previous functionality, of which the function use to return a list of all
        * reactionwheels, including command modules and gyroscopes.
        *
        * This was heavily refactored on 11/3/2014 by Raven.
        * ************************************************************************************************/
        private void GetReactionWheels()
        {
            ReactionWheels.Clear();

            foreach (Part p in FlightGlobals.ActiveVessel.Parts)
            {
                CactEyeGyro mrw = p.GetComponent <CactEyeGyro>();
                if (mrw != null)
                {
                    if (!ReactionWheels.Contains(mrw))
                    {
                        ReactionWheels.Add(mrw);
                        GyroSensitivity = mrw.GyroSensitivity;
                    }
                }
            }

            Debug.Log("CactEye 2: Found " + ReactionWheels.Count.ToString() + " Gyro units.");

            if (ReactionWheels.Count > 0)
            {
                GyroEnabled = true;
                ReactionWheelPitchTorques = new List <float>();
                ReactionWheelRollTorques  = new List <float>();
                ReactionWheelYawTorques   = new List <float>();

                for (int i = 0; i < ReactionWheels.Count; i++)
                {
                    ReactionWheelPitchTorques.Add(ReactionWheels[i].PitchTorque);
                    ReactionWheelRollTorques.Add(ReactionWheels[i].RollTorque);
                    ReactionWheelYawTorques.Add(ReactionWheels[i].YawTorque);
                }
            }
            else
            {
                GyroEnabled = false;
            }
        }