Exemplo n.º 1
0
    parser.add_argument('-b', '--num-bees', type=int, default=0)
    parser.add_argument('-c', '--num-casus', type=int, default=3)
    parser.add_argument('-r', '--radius', type=float, default=12)
    args = parser.parse_args()

    simctrl = sim.Control()

    if args.num_bees > 0:
        for i in range(1, args.num_bees + 1):
            name = 'Bee-{:03d}'.format(i)

            pose = (random.uniform(-4, 4), random.uniform(-4, 4),
                    2 * pi * random.random())

            simctrl.spawn('Bee', name, pose)
            print 'Spawned bee', name

    stp = pi / 8.0
    for i in range(0, args.num_casus):
        thetal = pi - (stp * (args.num_casus - 1) / 2) + (i * stp)
        thetar = thetal + pi
        for theta, side in zip([thetal, thetar], 'lr'):
            cname = 'casu-{}0{}'.format(side, i)
            x = (args.radius + 1.0) * cos(theta)
            y = (args.radius + 1.0) * sin(theta)
            pos = (x, y, 0)
            simctrl.spawn('Casu', cname, pos)

    A = arena.CircleArena(radius=args.radius)
    A.spawn(simctrl)
Exemplo n.º 2
0
    #
    # 9 8 7
    # 6 5 4
    # 3 2 1
    # ----/ --
    #   <door>
    #
    #
    # this example will use the ring around CASUs 5, 4, 2, 1

    # define the poses of the CASUs (all "yaw"/rotations are 0)
    yaw = 0
    c5 = "casu-005", (0,  0, yaw)
    c4 = "casu-004", (9,  0, yaw)
    c2 = "casu-002", (0, -9, yaw)
    c1 = "casu-001", (9, -9, yaw)


    # spawn each of the CASU objects
    for cname, cpos in [c5, c4, c2, c1]:
        simctrl.spawn('Casu', cname, cpos)

    # define an arena wall object
    A = arena.CircleArena(radius=11.0, ww=0.5)
    # define a transform (centre of the 4 casus)
    T = arena.Transformation(dx=4.5, dy=-4.5)
    A.transform(T)
    A.spawn(simctrl)

    pass