コード例 #1
0
    public void Test(Map map, Measurements measurements, List <Vector2> moves,
                     int iExpectedX, int iExpectedZ)
    {
        MonteCarloLocalizer loc = new MonteCarloLocalizer();

        loc.Init(map);
        int iX = (int)moves[0].x;
        int iY = (int)moves[0].y;

        loc.Move(iX, iY, 1f);

        loc.Sense(measurements, 1f);

        int mlX, mlZ;

        loc.MostLikelyCell(out mlX, out mlZ);

        if (iExpectedX == mlX && iExpectedZ == mlZ)
        {
            Debug.Log("Correct!");
        }
        else
        {
            Debug.LogError("Oops");
        }
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        LocUnitTester tester = new LocUnitTester();

        tester.TestB();

        loc = new MonteCarloLocalizer();
        loc.Init(mm.map);

        vis = new ProbMapVisualizer();
        vis.Init(25, likelyTM.gameObject);

        //when we move at least full a cell dist, then sense again.
        threshMove = mm.map.dX;
        prevPos    = Vector3.zero;
    }