Ejemplo n.º 1
0
def INIT():
    # (width, height), (offset x, offset y), scale:
    sim = TkSimulator((441, 434), (22, 420), 40.357554)
    # x1, y1, x2, y2 in meters:
    sim.addBox(0, 0, 10, 10)
    # (x, y) meters, brightness usually 1 (1 meter radius):
    sim.addLight(1, 1, 0.5)
    sim.addLight(2, 2, 0.5)
    sim.addLight(3, 3, 0.5)
    sim.addLight(4, 4, 0.5)
    sim.addLight(5, 5, 0.5)
    sim.addLight(6, 6, 0.5)
    sim.addLight(7, 7, 0.5)
    sim.addLight(8, 8, 0.5)
    sim.addLight(9, 9, 0.5)
    sim.addLight(10, 10, 0.5)
    # port, name, x, y, th, bounding Xs, bounding Ys, color
    # (optional TK color name):
    sim.addRobot(
        60002,
        TkPioneer("redRobot", 5, 7, -0.86,
                  ((.225, .225, -.225, -.225), (.175, -.175, -.175, .175)),
                  "red"))
    sim.addRobot(
        60003,
        TkPioneer("blueRobot", 6, 7, -0.86,
                  ((.225, .225, -.225, -.225), (.175, -.175, -.175, .175)),
                  "blue"))
    # add some sensors:
    sim.robots[0].addDevice(PioneerFrontLightSensors())
    sim.robots[1].addDevice(PioneerFrontLightSensors())
    sim.robots[1].addDevice(PioneerFrontSonars())
    return sim
Ejemplo n.º 2
0
def INIT():
    # (width, height), (offset x, offset y), scale:
    sim = TkSimulator((441,434), (22,420), 40.357554)  
    # x1, y1, x2, y2 in meters:
    sim.addBox(0, 0, 10, 10, "green")
    # (x, y) meters, brightness usually 1 (1 meter radius):
    sim.addLight(5, 5, 0.3)
    # port, name, x, y, th, bounding Xs, bounding Ys, color
    # (optional TK color name):
    sim.addRobot(60000, TkPioneer("redRobot",
                                  5, 1, 0,
                                  ((.225, .225, -.225, -.225),
                                   (.175, -.175, -.175, .175)),
                                  "red"))
    sim.addRobot(60001, TkPioneer("blueRobot",
                                  5, 9, pi,
                                  ((.225, .225, -.225, -.225),
                                   (.175, -.175, -.175, .175)),
                                  "blue"))

    sim.addBox(4.8, 0.2, 5.2, 0.6, "black")
    sim.addBox(4.8, 9.4, 5.2, 9.8, "white")

    # add some sensors:
    sim.robots[0].addDevice(PioneerFrontLightSensors())
    sim.robots[0].addDevice(PioneerFrontSonars())
    sim.robots[1].addDevice(PioneerFrontLightSensors())
    sim.robots[1].addDevice(PioneerFrontSonars())
    return sim
Ejemplo n.º 3
0
def INIT():
    # (width, height), (offset x, offset y), scale
    sim = LineSimulation((450,675), (20,650), 32,
                             background="line-images/lineBackground-1.png")  
                             # background="line-images/lineBackground-2.png")  

    # an example of an obstacle on the line
      # x1, y1, x2, y2
    sim.addBox(5, 12, 6, 11)

    sim.addRobot(60000, 
		 # name, x, y, th, boundingBox
                 TkPioneer("RedErratic", 
			   # position for lineBackground-1
		           1, 18.9, 4.0,
			   # position for lineBackground-2
		           # 8.5, 2.35, 1.57,
                           ((.185, .185, -.185, -.185),
                            (.2, -.2, -.2, .2))))

    # add some sensors:
    sim.robots[0].addDevice(PioneerFrontSonars())

    # to create a trail
    # sim.robots[0].display["trail"] = 1

    return sim
Ejemplo n.º 4
0
def INIT():
    sim = TkSimulator((441,434), (22,420), 40.357554)
    
    sim.addBox(0, 0, 10, 10)

    sim.addLight(5, 6, 1)

    sim.addRobot(60000, TkPioneer("RedPioneer",
                                  5, 2, -0.86,
                                  ((.225, .225, -.225, -.225),
                                   (.175, -.175, -.175, .175))))
    # add some sensors:
    sim.robots[0].addDevice(PioneerFrontSonars())
    sim.robots[0].addDevice(PioneerFrontLightSensors())
    return sim
Ejemplo n.º 5
0
def INIT():
    # (width, height), (offset x, offset y), scale:
    sim = TkSimulator((441, 434), (22, 420), 40.357554)
    # x1, y1, x2, y2 in meters:
    sim.addBox(0, 0, 10, 10)
    sim.addBox(3, 4, 7, 4.5)
    # (x, y) meters, brightness usually 1 (1 meter radius):
    sim.addLight(5, 6, 1)
    # port, name, x, y, th, bounding Xs, bounding Ys, color
    # (optional TK color name):
    sim.addRobot(
        60000,
        TkPioneer("RedPioneer", 3, 3, -0.86,
                  ((.225, .225, -.225, -.225), (.175, -.175, -.175, .175))))
    # add some sensors:
    sim.robots[0].addDevice(PioneerFrontSonars())
    sim.robots[0].addDevice(PioneerFrontLightSensors())
    return sim