예제 #1
0
    protected void RegulateAngle(float target_pitch_angle, float target_roll_angle)
    {
        if (Application.isEditor)
        {
            for (int i = 0; i < 2; i++)
            {
                selfLevelers[i].CopySettings(selfLevelerFactory);
            }
        }
        float pitch_val = Gyroscope.Angle2OneMinusOne(gyroscope.GetRotation().x) * 180f;
        float slp       = selfLevelers[0].Regulate(target_pitch_angle - pitch_val);
        float roll_val  = Gyroscope.Angle2OneMinusOne(gyroscope.GetRotation().z) * 180f;
        float slr       = selfLevelers[1].Regulate(target_roll_angle + roll_val);

        RotPitch(slp);
        RotRoll(slr);
    }
예제 #2
0
        public void test_Angle2OMO_359()
        {
            float result = Gyroscope.Angle2OneMinusOne(359f);

            Assert.AreEqual(result, -0.00555562973f);
        }
예제 #3
0
        public void test_Angle2OMO_179()
        {
            float result = Gyroscope.Angle2OneMinusOne(179f);

            Assert.AreEqual(result, 0.994444489f);
        }
예제 #4
0
        public void test_Angle2OMO_181()
        {
            float result = Gyroscope.Angle2OneMinusOne(181f);

            Assert.AreEqual(result, -0.99444437f);
        }
예제 #5
0
        public void test_Angle2OMO_0()
        {
            float result = Gyroscope.Angle2OneMinusOne(0f);

            Assert.AreEqual(result, 0f);
        }