FEZ Cerbotでライントレース

考え方は簡単なライントレースをスムースに行うを参考にしてください。

FEZ Cerbotでライントレース

タイマーは10ミリ秒でイベントを発生させる。

Program.cs
        void timer_Tick(GT.Timer timer)
        {
            double valLeft = adLeft.Read();
            double valRight = adRight.Read();
            int leftSpeed = (int)(80 * (valLeft - 0.01) / 0.73 + 40);
            int rightSpeed = (int)(80 * (valRight - 0.01) / 1.0 + 40);
            if (leftSpeed > 100) leftSpeed = 100;
            if (rightSpeed > 100) rightSpeed = 100;
            cerbotController.SetMotorSpeed(leftSpeed, rightSpeed);
        }
 1 
 2 
 3 
 4 
 5 左右のセンサーの特性が異なる
 6 最適な値ではない
 7 モーターへの設定値は100が最大
 8 
 9 
10