Exemplo n.º 1
0
    def test_values_1(self):
        expected = [[0.0, 0.0, 0.0], [0.0, 0.5, 0.5], [0.0, 0.0, 0.0]]
        colors = [[G, G, G], [G, R, R], [G, G, G]]

        robot = Robot(world=colors)
        robot.sensor = 1.0
        robot.movement = 1.0
        p = robot._p(len(colors), len(colors[0]))
        actual = robot.localize(p=p, measurements=[R], motions=[[0, 0]])
        self.assertAlmostEqual(expected, actual)
Exemplo n.º 2
0
    def test_values_2(self):
        expected = [[0.06666, 0.06666, 0.06666], [0.06666, 0.26666, 0.26666],
                    [0.06666, 0.06666, 0.06666]]

        colors = [[G, G, G], [G, R, R], [G, G, G]]

        robot = Robot(world=colors)
        robot.sensor = 0.8
        robot.movement = 1.0
        actual = robot.localize(measurements=[R], motions=[[0, 0]])
        self.assertAlmostEqual(expected, actual, places=4)
Exemplo n.º 3
0
 def test_values_2(self):
     expected = [[0.06666, 0.06666, 0.06666],
                 [0.06666, 0.26666, 0.26666],
                 [0.06666, 0.06666, 0.06666]]
     
     colors=[[G, G, G],
             [G, R, R],
             [G, G, G]]
     
     robot = Robot(world=colors)
     robot.sensor = 0.8
     robot.movement = 1.0
     actual = robot.localize(measurements=[R], motions=[[0, 0]])
     self.assertAlmostEqual(expected, actual, places=4)
Exemplo n.º 4
0
 def test_values_1(self):
     expected = [[0.0, 0.0, 0.0],
                 [0.0, 0.5, 0.5],
                 [0.0, 0.0, 0.0]]
     colors=[[G, G, G],
             [G, R, R],
             [G, G, G]]
     
     robot = Robot(world=colors)
     robot.sensor = 1.0
     robot.movement = 1.0
     p = robot._p(len(colors), len(colors[0]))
     actual = robot.localize(p=p, measurements=[R], motions=[[0, 0]])
     self.assertAlmostEqual(expected, actual)
Exemplo n.º 5
0
    def test_values_5(self):
        expected = [[0.02898, 0.02898, 0.02898], [0.07246, 0.28985, 0.46376],
                    [0.02898, 0.02898, 0.02898]]

        colors = [[G, G, G], [G, R, R], [G, G, G]]

        robot = Robot(world=colors)
        robot.sensor = 0.8
        robot.movement = 0.5
        p = robot._p(len(colors), len(colors[0]))
        actual = robot.localize(p=p,
                                measurements=[R, R],
                                motions=[[0, 0], [0, 1]])
        self.assertAlmostEqual(expected, actual, places=4)
Exemplo n.º 6
0
    def test_values_3(self):
        expected = [[0.03333, 0.03333, 0.03333], [0.13333, 0.13333, 0.53333],
                    [0.03333, 0.03333, 0.03333]]

        colors = [[G, G, G], [G, R, R], [G, G, G]]

        robot = Robot(world=colors)
        robot.sensor = 0.8
        robot.movement = 1.0
        p = robot._p(len(colors), len(colors[0]))
        actual = robot.localize(p=p,
                                measurements=[R, R],
                                motions=[[0, 0], [0, 1]])
        self.assertAlmostEqual(expected, actual, places=4)
Exemplo n.º 7
0
    def test_values_5(self):
        expected = [[0.02898, 0.02898, 0.02898],
                    [0.07246, 0.28985, 0.46376],
                    [0.02898, 0.02898, 0.02898]]

        colors = [[G, G, G],
                  [G, R, R],
                  [G, G, G]]
        
        robot = Robot(world=colors)
        robot.sensor = 0.8
        robot.movement = 0.5
        p = robot._p(len(colors), len(colors[0]))
        actual = robot.localize(p=p, 
                                measurements=[R, R], 
                                motions=[[0, 0], [0, 1]])
        self.assertAlmostEqual(expected, actual, places=4)
Exemplo n.º 8
0
    def test_values_3(self):
        expected = [[0.03333, 0.03333, 0.03333],
                    [0.13333, 0.13333, 0.53333],
                    [0.03333, 0.03333, 0.03333]]

        colors = [[G, G, G],
                  [G, R, R],
                  [G, G, G]]
        
        robot = Robot(world=colors)
        robot.sensor = 0.8
        robot.movement = 1.0
        p = robot._p(len(colors), len(colors[0]))
        actual = robot.localize(p=p, 
                                measurements=[R, R], 
                                motions=[[0, 0], [0, 1]])
        self.assertAlmostEqual(expected, actual, places=4)
Exemplo n.º 9
0
    def test_values_7(self):
        expected = [[0.01105, 0.02464, 0.06799, 0.04472, 0.024651],
                    [0.00715, 0.01017, 0.08696, 0.07988, 0.00935],
                    [0.00739, 0.00894, 0.11272, 0.35350, 0.04065],
                    [0.00910, 0.00715, 0.01434, 0.04313, 0.03642]]

        colors = [[R, G, G, R, R], [R, R, G, R, R], [R, R, G, G, R],
                  [R, R, R, R, R]]

        robot = Robot(world=colors)
        robot.sensor = 0.7
        robot.movement = 0.8
        p = robot._p(len(colors), len(colors[0]))
        actual = robot.localize(p=p,
                                measurements=[G, G, G, G, G],
                                motions=[[0, 0], [0, 1], [1, 0], [1, 0],
                                         [0, 1]])
        self.assertAlmostEqual(expected, actual, places=4)
Exemplo n.º 10
0
    def test_values_7(self):
        expected = [[0.01105, 0.02464, 0.06799, 0.04472, 0.024651],
                    [0.00715, 0.01017, 0.08696, 0.07988, 0.00935],
                    [0.00739, 0.00894, 0.11272, 0.35350, 0.04065],
                    [0.00910, 0.00715, 0.01434, 0.04313, 0.03642]]

        colors = [[R, G, G, R,R],
                  [R, R, G, R, R],
                  [R, R, G, G, R],
                  [R, R, R, R, R]]
        
        robot = Robot(world=colors)
        robot.sensor = 0.7
        robot.movement = 0.8
        p = robot._p(len(colors), len(colors[0]))
        actual = robot.localize(p=p, 
                                measurements=[G, G, G, 
                                              G, G], 
                                motions=[[0, 0], [0, 1], [1, 0], [1, 0], 
                                         [0, 1]])
        self.assertAlmostEqual(expected, actual, places=4)