Пример #1
0
        public static String FormatSI(double value, String unit)
        {
            int i = (int)RTUtil.Clamp(Math.Floor(Math.Log10(value)) / 3,
                                      0, DistanceUnits.Length - 1);

            value /= Math.Pow(1000, i);
            return(value.ToString("F2") + DistanceUnits[i] + unit);
        }
Пример #2
0
        private void Actuate(FlightCtrlState fcs)
        {
            fcs.mainThrottle = RTUtil.Clamp(mCPU.Memory[0] / 1024.0f, 0.0f, 1.0f);
            fcs.yaw          = RTUtil.Clamp(mCPU.Memory[1] / 1024.0f, -1.0f, 1.0f);
            fcs.pitch        = RTUtil.Clamp(mCPU.Memory[2] / 1024.0f, -1.0f, 1.0f);
            fcs.roll         = RTUtil.Clamp(mCPU.Memory[3] / 1024.0f, -1.0f, 1.0f);

            // Does this even work in stock Progcom? Written data gets
            fcs.X = RTUtil.Clamp(mCPU.Memory[52] / 1024.0f, -1.0f, 1.0f);
            fcs.Y = RTUtil.Clamp(mCPU.Memory[53] / 1024.0f, -1.0f, 1.0f);
            fcs.Z = RTUtil.Clamp(mCPU.Memory[54] / 1024.0f, -1.0f, 1.0f);
        }