예제 #1
0
def mit_carpet_floor(MiroSystem):
    # Add MIT floor as a box
    MIT_floor_x = 4.5 + 4.8 + 4.5
    MIT_floor_z = 4.5 + 4.8 + 4.5
    MIT_floor_pos = np.array([1.6, -1, -1.9])

    MiroAPI.add_boxShape(MiroSystem, MIT_floor_x, 2, MIT_floor_z, MIT_floor_pos, 'MITfloor.png',scale=[23,18])
예제 #2
0
def trialsurface(MiroSystem, target):
    nx = 10
    dz = 1.4
    diag = 0.2
    eps = 0.008
    
    box_side = diag/np.sqrt(2)
    h = diag/2

    for i in range(nx):
        pos = np.array([target[0] - (nx - 1 - 2*i)*diag/2, target[1]-h, target[2]])
        MiroAPI.add_boxShape(MiroSystem, box_side, box_side, dz, pos, rotZ=45, texture='white concrete.jpg')

    th = 1.2*h
    pos = np.array([target[0], target[1]-h-th/2, target[2]])
    MiroAPI.add_boxShape(MiroSystem, nx*diag+2*eps, th, dz+2*eps, pos, texture='wood_ikea_style.png')

    r = 0.03
    h = target[1]-th-h
    d = 0.1
    # [+, +]
    pos = np.array([target[0] + nx*diag/2 - d, h/2, target[2] + dz/2 -d])
    MiroAPI.add_cylinderShape(MiroSystem, r, h, 2500, pos, 'chrome.png', scale=[2,2])

    # [-, +]
    pos = np.array([target[0] - nx*diag/2 + d, h/2, target[2] + dz/2 -d])
    MiroAPI.add_cylinderShape(MiroSystem, r, h, 2500, pos, 'chrome.png', scale=[2,2])

    # [-, -]
    pos = np.array([target[0] - nx*diag/2 + d, h/2, target[2] - dz/2 +d])
    MiroAPI.add_cylinderShape(MiroSystem, r, h, 2500, pos, 'chrome.png', scale=[2,2])

    # [+, -]
    pos = np.array([target[0] + nx*diag/2 - d, h/2, target[2] - dz/2 +d])
    MiroAPI.add_cylinderShape(MiroSystem, r, h, 2500, pos, 'chrome.png', scale=[2,2])    
def build(MiroSystem, SPEEDMODE=False):
    MiroAPI.add_boxShape(MiroSystem,
                         0.5,
                         1.85,
                         0.5, [1, 6.64 + 1.85 / 2, 6],
                         Fixed=False)
    return
def Plan4_Rum3(MiroSystem):
    MiroAPI.add_boxShape(MiroSystem,
                         4,
                         0.85,
                         3, [-4.5, 6.64, -10.3],
                         rotX=-16,
                         friction=2000)
예제 #5
0
def MC907(rot=[0, 0, 0], pos=[0, 0, 0], Fixed=False):
    size_x = 0.8
    size_y = 0.1
    size_z = 0.9
    density_brick = density['Steel Forged Concrete']  # kg/m^3
    body_brick = MiroAPI.add_boxShape(False,
                                      size_x,
                                      size_y,
                                      size_z,
                                      pos,
                                      texture='white_bricks.jpg',
                                      density=density_brick,
                                      Fixed=Fixed)

    # Generate MiroComponent with above ChBody
    COMPONENT = mc.MiroComponent(body_brick)

    COMPONENT.AddLinkPoint('A', [0, 1, 0],
                           [3 * size_x / 8, size_y / 2, 3 * size_z / 8])
    COMPONENT.AddLinkPoint('B', [0, 1, 0],
                           [-3 * size_x / 8, size_y / 2, 3 * size_z / 8])
    COMPONENT.AddLinkPoint('C', [0, 1, 0],
                           [3 * size_x / 8, size_y / 2, -3 * size_z / 8])
    COMPONENT.AddLinkPoint('D', [0, 1, 0],
                           [-3 * size_x / 8, size_y / 2, -3 * size_z / 8])
    COMPONENT.AddLinkPoint('E', [0, 1, 0], [0, size_y / 2, 0])

    COMPONENT.Rotate(rot)

    return COMPONENT
예제 #6
0
def MC906(rot=[0, 0, 0], pos=[0, 0, 0], Fixed=False):
    size_x = 0.8
    size_y = 0.8
    size_z = 0.6
    density_brick = density['Steel Forged Concrete']  # kg/m^3
    body_brick = MiroAPI.add_boxShape(False,
                                      size_x,
                                      size_y,
                                      size_z,
                                      pos,
                                      texture='white_bricks.jpg',
                                      density=density_brick,
                                      Fixed=Fixed)

    # Generate MiroComponent with above ChBody
    COMPONENT = mc.MiroComponent(body_brick)

    COMPONENT.AddLinkPoint('A', [0, 0, 1], [0, 0.9 * size_y / 2, size_z / 2])
    COMPONENT.AddLinkPoint('B', [0, 0, -1], [0, 0.9 * size_y / 2, -size_z / 2])

    # Bottom mounting sockets
    COMPONENT.AddLinkPoint('C', [0, -1, 0], [0, -size_y / 2, size_z / 4])
    COMPONENT.AddLinkPoint('D', [0, -1, 0], [0, -size_y / 2, -size_z / 4])

    # Top mounting sockets
    COMPONENT.AddLinkPoint('E', [0, 1, 0], [0, size_y / 2, size_z / 4])
    COMPONENT.AddLinkPoint('F', [0, 1, 0], [0, size_y / 2, -size_z / 4])

    COMPONENT.Rotate(rot)

    return COMPONENT
예제 #7
0
def MC1XX(M1, M2, M3, rot=[0, 0, 0], pos=[0, 0, 0], Fixed=False):
    size_x = M1
    size_y = M2
    size_z = M2

    density_brick = density['Aluminium']  # kg/m^3
    body_brick = MiroAPI.add_boxShape(False,
                                      size_x,
                                      size_y,
                                      size_z,
                                      pos,
                                      texture='brushsteel.jpg',
                                      density=density_brick,
                                      Fixed=Fixed)

    # Generate MiroComponent with above ChBody
    COMPONENT = mc.MiroComponent(body_brick)

    COMPONENT.AddLinkPoint('A', [-1, 0, 0], [-size_x / 2, 0, 0])
    COMPONENT.AddLinkPoint('B', [1, 0, 0], [size_x / 2, 0, 0])
    COMPONENT.AddLinkPoint('C', [0, 0, -1], [0, 0, -size_z / 2])
    COMPONENT.AddLinkPoint('D', [0, 0, 1], [0, 0, size_z / 2])
    COMPONENT.AddLinkPoint('E', [0, -1, 0],
                           [-(size_x / 2 - M3), -size_y / 2, 0])
    COMPONENT.AddLinkPoint('F', [0, -1, 0],
                           [(size_x / 2 - M3), -size_y / 2, 0])
    COMPONENT.AddLinkPoint('G', [0, 1, 0], [-(size_x / 2 - M3), size_y / 2, 0])
    COMPONENT.AddLinkPoint('H', [0, 1, 0], [(size_x / 2 - M3), size_y / 2, 0])

    COMPONENT.Rotate(rot)

    return COMPONENT
예제 #8
0
def MC3XX(M1, M2, M3, rot=[0, 0, 0], pos=[0, 0, 0], Fixed=False):
    size_x = M1
    size_y = M3
    size_z = M2

    density_brick = density['PVC']  # kg/m^3
    body_brick = MiroAPI.add_boxShape(False,
                                      size_x,
                                      size_y,
                                      size_z,
                                      pos,
                                      texture='pvc_weave_brown.png',
                                      density=density_brick,
                                      Fixed=Fixed)

    # Generate MiroComponent with above ChBody
    COMPONENT = mc.MiroComponent(body_brick)

    COMPONENT.AddLinkPoint('A', [-1, 0, 0], [-size_x / 2, 0, 0])
    COMPONENT.AddLinkPoint('B', [1, 0, 0], [size_x / 2, 0, 0])
    COMPONENT.AddLinkPoint('C', [0, 0, -1], [0, 0, -size_z / 2])
    COMPONENT.AddLinkPoint('D', [0, 0, 1], [0, 0, size_z / 2])
    COMPONENT.AddLinkPoint('E', [0, -1, 0], [0, -size_y / 2, 0])
    COMPONENT.AddLinkPoint('F', [0, 1, 0], [0, size_y / 2, 0])

    COMPONENT.Rotate(rot)

    return COMPONENT
예제 #9
0
def sponsorFlag(MiroSystem, pos, logo, spin=0):
    foot_h = 0.08
    foot_r = 0.3
    leg_h = 0.4
    leg_r = 0.02
    sign_h = 1.6
    sign_w = 0.6
    sign_t = 0.03

    foot_pos = [pos[0], pos[1]+foot_h/2, pos[2]]
    leg_pos = [pos[0], pos[1]+foot_h+leg_h/2, pos[2]]
    sign_pos = [pos[0], pos[1]+foot_h+leg_h+sign_h/2, pos[2]]

    # Foot
    foot = MiroAPI.add_cylinderShape(MiroSystem, foot_r, foot_h, 1000, foot_pos, texture='black_smere.jpg', Fixed=False, scale=[1,-1])
    # Pole
    leg = MiroAPI.add_cylinderShape(MiroSystem, leg_r, leg_h, 500, leg_pos, texture='black_smere.jpg', Fixed=False, scale=[1,-1])
    # Sign
    sign = MiroAPI.add_boxShape(MiroSystem, sign_w, sign_h, sign_t, sign_pos, density=30, texture=logo, Fixed=False)
    # Hinges
    h1 = [pos[0], pos[1]+foot_h, pos[2]]
    h2 = [pos[0], pos[1]+foot_h+leg_h, pos[2]]
    MiroAPI.LinkBodies_Hinge(foot, leg, h1, [0,1,0], MiroSystem)
    MiroAPI.LinkBodies_Hinge(leg, sign, h2, [0,1,0], MiroSystem)
    if spin:
        MiroAPI.SetBodyAngularFrequency(sign, spin)
예제 #10
0
def measureBox(MiroSystem, pos, dims):
    pos = np.array(pos)
    d = 0.02
    lx = dims[0] + 2*d
    ly = dims[1] + d
    lz = dims[2]
    # Base
    MiroAPI.add_boxShape(MiroSystem, dims[0], d, dims[2], pos+np.array([0,d/2,0]), texture='wood_ikea_style.png')
    # x -
    MiroAPI.add_boxShape(MiroSystem, d, ly, lz, pos+np.array([-(dims[0]+d)/2, (dims[1]+d)/2, 0]), texture='wood_ikea_style.png')
    # x +
    MiroAPI.add_boxShape(MiroSystem, d, ly, lz, pos+np.array([ (dims[0]+d)/2, (dims[1]+d)/2, 0]), texture='wood_ikea_style.png')
    # z -
    MiroAPI.add_boxShape(MiroSystem, lx, ly, d, pos+np.array([ 0, (dims[1]+d)/2,-(dims[2]+d)/2]), texture='wood_ikea_style.png')
    # z +
    MiroAPI.add_boxShape(MiroSystem, lx, ly, d, pos+np.array([ 0, (dims[1]+d)/2, (dims[2]+d)/2]), texture='wood_ikea_style.png')
예제 #11
0
def tabletop(MiroSystem, table_pos, size_table):
    if(size_table[0] < 0.6):
        tex = 'textures/MITstol.jpg'
    else:
        tex = 'textures/MITbord.jpg'
    pos = table_pos + np.array([0,size_table[1]/2 + size_table[3],0])
    return MiroAPI.add_boxShape(MiroSystem, size_table[0], size_table[1], size_table[2], pos, tex, Fixed=FIXED)
예제 #12
0
def back_stage(system):
    coner_pos = np.array([-5.3, 1.55, -8.8])  # Real coner -5.3,1.25,-8.8
    length = 1.3
    in_screen_pos = coner_pos + np.array([1 / np.sqrt(2), 0, 1 / np.sqrt(2)
                                          ]) * length

    size_len = 2.5
    size_width = 0.05
    size_height = 2.5

    MiroAPI.add_boxShape(system,
                         size_len,
                         size_height,
                         size_width,
                         in_screen_pos,
                         texture='tf-logo.jpg',
                         scale=[4, 3],
                         rotY=45)
예제 #13
0
def greenpole(MiroSystem, d, l, spin, tilt, pos, Fixed=True):
    p = np.array(pos)
    return MiroAPI.add_boxShape(MiroSystem,
                                d,
                                l,
                                d,
                                p,
                                'MITentrance.png',
                                rotY=spin,
                                rotZ=tilt,
                                rotOrder=['z', 'y'],
                                scale=[0.5, 50],
                                color=[0.02, 0.1, 0.01],
                                Fixed=Fixed)
예제 #14
0
def QuickEntrance(MiroSystem, pos_south, pos_north):
    h = 3.1

    center = np.array([(pos_south[0] + pos_north[0]) / 2,
                       (pos_south[1] + pos_north[1]) / 2 + h / 2,
                       (pos_south[2] + pos_north[2]) / 2])
    wid = np.abs(pos_south[0] - pos_north[0])

    # Door wall
    MiroAPI.add_boxShape(MiroSystem,
                         wid / 2,
                         h / 2,
                         0.05,
                         center,
                         texture='MITentrance_quick.png')

    # south wall
    p = np.array([pos_south[0] - 0.05, 1.51, pos_south[2] - 0.89 / 2])
    MiroAPI.add_boxShape(MiroSystem,
                         0.1,
                         3.02,
                         0.89,
                         p,
                         texture='MITentrance_quick.png')
예제 #15
0
def MC0XX(M1, M2, M3, rot=[0, 0, 0], pos=[0, 0, 0], Fixed=False):
    size_x = M1
    size_y = M3
    size_z = M2
    density_brick = density['ABS']  # kg/m^3
    body_brick = MiroAPI.add_boxShape(False,
                                      size_x,
                                      size_y,
                                      size_z,
                                      pos,
                                      texture='MITstol.jpg',
                                      density=density_brick,
                                      Fixed=Fixed)

    # Generate MiroComponent with above ChBody
    COMPONENT = mc.MiroComponent(body_brick)

    # Top
    COMPONENT.AddLinkPoint('A', [0, 1, 0], [(size_x / 2 - 0.02), size_y / 2,
                                            (size_z / 2 - 0.02)])
    COMPONENT.AddLinkPoint(
        'B', [0, 1, 0],
        [-(size_x / 2 - 0.02), size_y / 2, (size_z / 2 - 0.02)])
    COMPONENT.AddLinkPoint(
        'C', [0, 1, 0],
        [(size_x / 2 - 0.02), size_y / 2, -(size_z / 2 - 0.02)])
    COMPONENT.AddLinkPoint(
        'D', [0, 1, 0],
        [-(size_x / 2 - 0.02), size_y / 2, -(size_z / 2 - 0.02)])
    # Bottom
    COMPONENT.AddLinkPoint('E', [0, -1, 0], [0, -size_y / 2, 0])
    # Sides
    COMPONENT.AddLinkPoint('F', [0, 0, -1],
                           [-(size_x / 2 - 0.02), 0, -size_z / 2])
    COMPONENT.AddLinkPoint('G', [0, 0, -1],
                           [(size_x / 2 - 0.02), 0, -size_z / 2])
    COMPONENT.AddLinkPoint('H', [0, 0, 1],
                           [-(size_x / 2 - 0.02), 0, size_z / 2])
    COMPONENT.AddLinkPoint('I', [0, 0, 1],
                           [(size_x / 2 - 0.02), 0, size_z / 2])
    COMPONENT.AddLinkPoint('J', [-1, 0, 0], [-size_x / 2, 0, 0])
    COMPONENT.AddLinkPoint('K', [1, 0, 0], [size_x / 2, 0, 0])

    COMPONENT.Rotate(rot)

    return COMPONENT
예제 #16
0
def MSL03(rot=[0, 0, 0]):
    size_x = 0.02
    size_y = 0.02
    size_z = 0.02

    sensor_body = MiroAPI.add_boxShape(False,
                                       size_x,
                                       size_y,
                                       size_z, [0, 0, 0],
                                       texture='MSA01.png',
                                       Fixed=False)

    # Generate MiroComponent based MiroSensor with above ChBody
    SENSOR = mc.MiroSensor_Lidar(sensor_body, 50, 90, 2)

    # Top
    SENSOR.AddLinkPoint('Linkpoint', [0, 1, 0], [0, size_y / 2, 0])
    SENSOR.Rotate(rot)

    return SENSOR
예제 #17
0
def mit_outside_ground(MiroSystem):
    # Add a ground outside as a huge box
    MIT_ground_x = 1000
    MIT_ground_z = 80
    MIT_floor_pos = np.array([300, -1.15, 20])

    MiroAPI.add_boxShape(MiroSystem, MIT_ground_x, 2, MIT_ground_z, MIT_floor_pos, 'grey concrete.jpg',scale=[23,18])

    dims = [4, 0.6, 10]
    pos = [15, -0.15, 25]
    MiroAPI.add_boxShape(MiroSystem, dims[0], dims[1], dims[2], pos, rotX= 0*np.arcsin(dims[1]/dims[2]), rotZ= 1*np.arcsin(dims[1]/dims[0]), texture='grey concrete.jpg',scale=[23,18], rotDegrees=False)

    dims = [4, 0.6, 10]
    pos = [20, -0.15, 25]
    MiroAPI.add_boxShape(MiroSystem, dims[0], dims[1], dims[2], pos, rotX= 0*np.arcsin(dims[1]/dims[2]), rotZ= -1*np.arcsin(dims[1]/dims[0]), texture='grey concrete.jpg',scale=[23,18], rotDegrees=False)
예제 #18
0
def MSO01(rot=[0, 0, 0]):
    size_x = 0.04
    size_y = 0.012
    size_z = 0.024
    # density_brick = 1000   # kg/m^3
    mass_brick = 0.040
    sensor_body = MiroAPI.add_boxShape(False,
                                       size_x,
                                       size_y,
                                       size_z, [0, 0, 0],
                                       texture='MSO01.png',
                                       Fixed=False,
                                       mass=mass_brick)

    # Generate MiroComponent based MiroSensor with above ChBody
    SENSOR = mc.MiroSensor_Odometer(sensor_body)

    # Top
    SENSOR.AddLinkPoint('Linkpoint', [0, 1, 0], [0, size_y / 2, 0])
    SENSOR.Rotate(rot)

    return SENSOR
예제 #19
0
def build(MiroSystem, SPEEDMODE=False):
    H = 3.32
    wall_t = 0.1 * 2
    posW = np.array([0.6, 5 / 2 * H, 5.1])
    posE = np.array([1.6, 3 / 2 * H, -8.9])
    posS = np.array([-5.4, 3 / 2 * H, -1.9])  #3/2 * H

    if (SPEEDMODE):
        MiroAPI.add_boxShape(MiroSystem, 11.8, H, wall_t, posW,
                             'MITwall_West.jpg')
        MiroAPI.add_boxShape(MiroSystem, 2 * 6.9, 3 * H, wall_t, posE,
                             'MITwall_East.jpg', [-4, -3])
        MiroAPI.add_boxShape(MiroSystem, wall_t, 3 * H, 2 * 6.9, posS,
                             'MITwall_South.jpg', [4, 3])

    else:
        MIT_Offices_East.build(MiroSystem, SPEEDMODE)
        MIT_Offices_South.build(MiroSystem, SPEEDMODE)
        MIT_Offices_West.build(MiroSystem, SPEEDMODE)

        MIT_Officewalls(MiroSystem, H, wall_t, posW, posE, posS)
예제 #20
0
def MIT_Officewalls(MiroSystem, H, wall_t, posW, posE, posS):
    corner_windowpane0 = np.array([-5.29, 2 * H + 1.5, 4.99])
    first_windowpane0 = np.array([
        corner_windowpane0[0] + 0.10, corner_windowpane0[1],
        corner_windowpane0[2]
    ])
    corner_windowpane1 = np.array([-0.7, 2 * H + 1.5, 4.99])
    first_windowpane1 = np.array([
        corner_windowpane1[0] + 0.25, corner_windowpane1[1],
        corner_windowpane1[2]
    ])
    corner_windowpane2 = np.array([4.125, 2 * H + 1.5, 4.99])
    first_windowpane2 = np.array([
        corner_windowpane2[0] + 0.25, corner_windowpane2[1],
        corner_windowpane2[2]
    ])

    v_windowpane_size = np.array([0.05, 3, 0.01])  #vertical window pane size

    pos_down = np.array([posW[0], posW[1] - 1.26, posW[2]])
    pos_up = np.array([posW[0], posW[1] + 1.51, posW[2]])

    #concrete part under and over windows
    MiroAPI.add_boxShape(MiroSystem,
                         11.8,
                         0.8,
                         0.2,
                         pos_down,
                         texture='white concrete.jpg',
                         scale=[9, 12])
    MiroAPI.add_boxShape(MiroSystem,
                         11.8,
                         0.3,
                         0.2,
                         pos_up,
                         texture='white concrete.jpg',
                         scale=[9, 12])
    #1st window vertical
    MiroAPI.add_boxShape(MiroSystem,
                         v_windowpane_size[0],
                         v_windowpane_size[1],
                         v_windowpane_size[2],
                         corner_windowpane0,
                         texture='wood_ikea_style.png')

    spacingA = 0.61
    for k in range(0, 8):
        tmp = np.array([spacingA * k, 0, 0])
        MiroAPI.add_boxShape(MiroSystem,
                             v_windowpane_size[0],
                             v_windowpane_size[1],
                             v_windowpane_size[2],
                             tmp + first_windowpane0,
                             texture='wood_ikea_style.png')
        if k == 3:
            MiroAPI.add_boxShape(MiroSystem,
                                 v_windowpane_size[0],
                                 v_windowpane_size[1],
                                 v_windowpane_size[2],
                                 np.array([spacingA / 2, 0, 0]) + tmp +
                                 first_windowpane0,
                                 texture='wood_ikea_style.png')

    #2nd window vertical
    MiroAPI.add_boxShape(MiroSystem,
                         v_windowpane_size[0],
                         v_windowpane_size[1],
                         v_windowpane_size[2],
                         corner_windowpane1,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         v_windowpane_size[0],
                         v_windowpane_size[1],
                         v_windowpane_size[2],
                         first_windowpane1,
                         texture='wood_ikea_style.png')

    spacingB = 0.685
    for k in range(0, 7):
        tmp = np.array([spacingB * k, 0, 0])
        MiroAPI.add_boxShape(MiroSystem,
                             v_windowpane_size[0],
                             v_windowpane_size[1],
                             v_windowpane_size[2],
                             tmp + first_windowpane1,
                             texture='wood_ikea_style.png')

        if k == 1:
            MiroAPI.add_boxShape(MiroSystem,
                                 v_windowpane_size[0],
                                 v_windowpane_size[1],
                                 v_windowpane_size[2],
                                 np.array([spacingB / 2, 0, 0]) + tmp +
                                 first_windowpane1,
                                 texture='wood_ikea_style.png')

        if k == 4:
            MiroAPI.add_boxShape(MiroSystem,
                                 v_windowpane_size[0],
                                 v_windowpane_size[1],
                                 v_windowpane_size[2],
                                 np.array([spacingB / 2, 0, 0]) + tmp +
                                 first_windowpane1,
                                 texture='wood_ikea_style.png')

        if k == 6:
            MiroAPI.add_boxShape(MiroSystem,
                                 v_windowpane_size[0],
                                 v_windowpane_size[1],
                                 v_windowpane_size[2],
                                 np.array([0.25, 0, 0]) + tmp +
                                 first_windowpane1,
                                 texture='wood_ikea_style.png')

    #3rd window vertical
    MiroAPI.add_boxShape(MiroSystem,
                         v_windowpane_size[0],
                         v_windowpane_size[1],
                         v_windowpane_size[2],
                         corner_windowpane2,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         v_windowpane_size[0],
                         v_windowpane_size[1],
                         v_windowpane_size[2],
                         first_windowpane2,
                         texture='wood_ikea_style.png')

    spacingC = 0.685
    for k in range(0, 4):
        tmp = np.array([spacingC * k, 0, 0])
        MiroAPI.add_boxShape(MiroSystem,
                             v_windowpane_size[0],
                             v_windowpane_size[1],
                             v_windowpane_size[2],
                             tmp + first_windowpane2,
                             texture='wood_ikea_style.png')
        if k == 2:
            MiroAPI.add_boxShape(MiroSystem,
                                 v_windowpane_size[0],
                                 v_windowpane_size[1],
                                 v_windowpane_size[2],
                                 np.array([spacingC / 2, 0, 0]) + tmp +
                                 first_windowpane2,
                                 texture='wood_ikea_style.png')

    #horizontal windowpanes
    h_windowpane_size = np.array([0.05, 4.255,
                                  0.01])  #horizontal window pane size

    #2nd window horizontal
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] + 0.6,
                         h_windowpane_size[2], [1.51, 2 * H + 0.015, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] + 0.6,
                         h_windowpane_size[2], [1.51, 2 * H + 0.8, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] + 0.6,
                         h_windowpane_size[2], [1.51, 2 * H + 3 - 0.7, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] + 0.6,
                         h_windowpane_size[2], [1.51, 2 * H + 3, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    # This box is the window
    window_pos = [1.51, 2 * H + 1.5 + 0.4, 4.985 + 0.0025]
    MiroAPI.add_boxShape(MiroSystem,
                         0.0025,
                         3.0 - 0.8,
                         h_windowpane_size[1] + 0.6 - 0.015,
                         window_pos,
                         rotY=90,
                         color=[0.5, 0.6, 0.7, 0.4])

    #1st window horizontal
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] + 0.36,
                         h_windowpane_size[2], [-3, 2 * H + 0.015, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] + 0.36,
                         h_windowpane_size[2], [-3, 2 * H + 0.8, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] + 0.36,
                         h_windowpane_size[2], [-3, 2 * H + 3 - 0.7, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] + 0.36,
                         h_windowpane_size[2], [-3, 2 * H + 3, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    # This box is the window
    window_pos = [-3, 2 * H + 1.5 + 0.4, 4.985 + 0.0025]
    MiroAPI.add_boxShape(MiroSystem,
                         0.0025,
                         3.0 - 0.8,
                         h_windowpane_size[1] + 0.36 - 0.015,
                         window_pos,
                         rotY=90,
                         color=[0.5, 0.6, 0.7, 0.4])

    #3rd window horizontal
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] / 2 + 0.3,
                         h_windowpane_size[2], [5.25, 2 * H + 0.015, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] / 2 + 0.3,
                         h_windowpane_size[2], [5.25, 2 * H + 0.8, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] / 2 + 0.3,
                         h_windowpane_size[2], [5.25, 2 * H + 3 - 0.7, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    MiroAPI.add_boxShape(MiroSystem,
                         h_windowpane_size[0],
                         h_windowpane_size[1] / 2 + 0.3,
                         h_windowpane_size[2], [5.25, 2 * H + 3, 4.985],
                         rotZ=90,
                         texture='wood_ikea_style.png')
    # This box is the window
    window_pos = [5.25, 2 * H + 1.5 + 0.4, 4.985 + 0.0025]
    MiroAPI.add_boxShape(MiroSystem,
                         0.0025,
                         3.0 - 0.8,
                         h_windowpane_size[1] / 2 + 0.3 - 0.015,
                         window_pos,
                         rotY=90,
                         color=[0.5, 0.6, 0.7, 0.4])

    test_posS = np.array([posS[0] + 0.105, -0.16 + 0.025, posS[2]])
    test_posE = np.array([posE[0], -0.16 + 0.025, posE[2] + 0.11])

    make_window(v_windowpane_size[0], v_windowpane_size[1],
                v_windowpane_size[2], h_windowpane_size[0],
                h_windowpane_size[1], h_windowpane_size[2], test_posS, 'south',
                0.685, MiroSystem)

    make_window(v_windowpane_size[0], v_windowpane_size[1],
                v_windowpane_size[2], h_windowpane_size[0],
                h_windowpane_size[1], h_windowpane_size[2], test_posE, 'east',
                0.685, MiroSystem)
예제 #21
0
 def AddToSystem(self, system):
     MiroAPI.add_boxShape(system, self.width, self.height, 0.05, self.position, 'textures/notifboard.png', rotX=self.tilt_angle, rotY=self.turn_angle, rotDegrees=False)
     self.bulb = MiroAPI.add_sphereShape(system, self.radius, self.position+self.bulb_pos, 'textures/notifbulb.png', rotX=self.tilt_angle+np.pi/2, rotY=self.turn_angle, rotDegrees=False)
예제 #22
0
def revolute_door(MiroSystem, d, l, spin, pos):
    # Revolving door bottom ring
    pos_down = np.array([pos[0], 0.0, pos[2]])
    disk_bot = MiroAPI.add_cylinderShape(MiroSystem,
                                         l,
                                         0.01,
                                         1000,
                                         pos_down,
                                         'MITentrance_floor.png',
                                         Collide=False)

    # Revolving door top ring
    pos_up = np.array([pos[0], pos[1] + 0.1 / 2 + d / 2, pos[2]])
    disk_top = MiroAPI.add_cylinderShape(MiroSystem, l, 0.1, 1000, pos_up,
                                         'MITentrance.png')

    l = l - 0.03
    eps = 0.004
    top = pos[1] - eps
    mid = pos[1] / 2 + d / 4
    bot = d / 2 + eps
    dh = np.array([0, d / 2, 0])

    # middle pole
    pos[1] = mid
    mid_pole = greenpole(MiroSystem,
                         d,
                         top - bot - d,
                         spin,
                         0,
                         pos,
                         Fixed=FIXED)

    # top cross
    pos[1] = top
    top_x = greenpole(MiroSystem, d, 2 * (l - d), spin, 90, pos, Fixed=FIXED)
    top_y = greenpole(MiroSystem,
                      d,
                      2 * (l - d),
                      spin + 90,
                      90,
                      pos,
                      Fixed=FIXED)

    if not FIXED:
        dir1 = [np.cos(np.deg2rad(spin)), 0, np.sin(np.deg2rad(spin))]
        dir2 = [
            np.cos(np.deg2rad(spin + 90)), 0,
            np.sin(np.deg2rad(spin + 90))
        ]
        MiroAPI.LinkBodies_Hinge(top_x, top_y, pos, dir1, MiroSystem)
        MiroAPI.LinkBodies_Hinge(top_x, top_y, pos, dir2, MiroSystem)
        MiroAPI.LinkBodies_Hinge(top_x, mid_pole, pos - dh, dir1, MiroSystem)
        MiroAPI.LinkBodies_Hinge(top_x, disk_top, pos + dh, [0, 1, 0],
                                 MiroSystem)
        MiroAPI.LinkBodies_Hinge(top_y, disk_top, pos + dh, [0, 1, 0],
                                 MiroSystem)

    # bottom cross
    pos[1] = bot
    bot_x = greenpole(MiroSystem, d, 2 * (l - d), spin, 90, pos, Fixed=FIXED)
    bot_y = greenpole(MiroSystem,
                      d,
                      2 * (l - d),
                      spin + 90,
                      90,
                      pos,
                      Fixed=FIXED)

    if not FIXED:
        MiroAPI.LinkBodies_Hinge(bot_x, bot_y, pos, dir1, MiroSystem)
        MiroAPI.LinkBodies_Hinge(bot_x, bot_y, pos, dir2, MiroSystem)
        MiroAPI.LinkBodies_Hinge(bot_x, mid_pole, pos + dh, dir1, MiroSystem)
        MiroAPI.LinkBodies_Hinge(bot_x, disk_top, pos - dh, [0, -1, 0],
                                 MiroSystem)
        MiroAPI.LinkBodies_Hinge(bot_y, disk_top, pos - dh, [0, -1, 0],
                                 MiroSystem)

    cross = [[top_x, bot_x], [top_y, bot_y]]
    p = np.array([pos[0], mid, pos[2]])
    for phi in [0, 90, 180, 270]:
        angle = spin + phi
        dp = np.array([
            np.cos(np.deg2rad(angle)) * (l - d / 2), 0,
            -np.sin(np.deg2rad(angle)) * (l - d / 2)
        ])
        rod = greenpole(MiroSystem,
                        d,
                        top - bot + d,
                        angle,
                        0,
                        p + dp,
                        Fixed=FIXED)
        if not FIXED:
            dh = np.array([0, (top - bot + d) / 2, 0])
            top_bar = cross[round(phi / 90) % 2][0]
            bot_bar = cross[round(phi / 90) % 2][1]
            MiroAPI.LinkBodies_Hinge(top_bar, rod, p + dp + dh, -dp,
                                     MiroSystem)
            MiroAPI.LinkBodies_Hinge(bot_bar, rod, p + dp - dh, -dp,
                                     MiroSystem)

    # side walls
    wid = 0.4
    thick = 0.02
    angle = -13
    height = top - bot + d + 2 * eps
    p = np.array([pos[0] - (l + 0.03 + thick / 2), mid, pos[2]])
    p[0] = p[0] - np.sin(np.deg2rad(angle)) * wid / 2
    p[2] = p[2] - np.cos(np.deg2rad(angle)) * wid / 2
    MiroAPI.add_boxShape(MiroSystem,
                         thick,
                         height,
                         wid,
                         p,
                         'MITentrance.png',
                         rotY=angle,
                         color=[0.02, 0.1, 0.01])

    p[2] = p[2] + np.cos(np.deg2rad(angle)) * wid
    MiroAPI.add_boxShape(MiroSystem,
                         thick,
                         height,
                         wid,
                         p,
                         'MITentrance.png',
                         rotY=-angle,
                         color=[0.02, 0.1, 0.01])

    p[0] = p[0] + np.sin(np.deg2rad(angle)) * wid + 2 * (l + 0.03 + thick / 2)
    MiroAPI.add_boxShape(MiroSystem,
                         thick,
                         height,
                         wid,
                         p,
                         'MITentrance.png',
                         rotY=angle,
                         color=[0.02, 0.1, 0.01])

    p[2] = p[2] - np.cos(np.deg2rad(angle)) * wid
    MiroAPI.add_boxShape(MiroSystem,
                         thick,
                         height,
                         wid,
                         p,
                         'MITentrance.png',
                         rotY=-angle,
                         color=[0.02, 0.1, 0.01])
예제 #23
0
def FullEntrance(MiroSystem, pos_south, pos_north):
    d = 0.08
    l = 3.02

    # Pole in front of doors
    p = np.array([pos_south[0] + 2.89, 1.51, pos_south[2] - 0.6])
    MiroAPI.add_boxShape(MiroSystem,
                         2 * d,
                         l,
                         2 * d,
                         p,
                         texture='white concrete.jpg',
                         scale=[4, 12])

    # Emergency exit sign
    p = np.array([pos_south[0] + 2.89, 2.7, pos_south[2] - 0.6 - d - 0.01])
    MiroAPI.add_boxShape(MiroSystem,
                         0.568 * 0.7,
                         0.285 * 0.7,
                         0.02,
                         p,
                         texture='exit.png')

    # Inner doorframe
    greenpole(MiroSystem, d, l, 0, 0,
              [pos_south[0] + (1 / 2) * d, 1.51, pos_south[2]])
    greenpole(MiroSystem, d, l, 0, 0,
              [pos_south[0] + 0.68, 1.51, pos_south[2]])
    greenpole(MiroSystem, d, l, 0, 0,
              [pos_south[0] + 2.72, 1.51, pos_south[2]])
    greenpole(MiroSystem, d, l, 0, 0,
              [pos_south[0] + 3.06, 1.51, pos_south[2]])
    greenpole(MiroSystem, d, l, 0, 0,
              [pos_south[0] + 5.10, 1.51, pos_south[2]])
    greenpole(MiroSystem, d, l, 0, 0,
              [pos_south[0] + 5.44, 1.51, pos_south[2]])
    greenpole(MiroSystem, d, l, 0, 0,
              [pos_south[0] + 6.58, 1.51, pos_south[2]])
    greenpole(MiroSystem, d, l, 0, 0,
              [pos_north[0] - (1 / 2) * d, 1.51, pos_north[2]])

    # Horizontal parts
    greenpole(MiroSystem, d, (pos_north[0] - pos_south[0]), 0, 90, [
        (pos_north[0] + pos_south[0]) / 2, 2.5 + d / 2, pos_north[2] - d / 20
    ])
    greenpole(MiroSystem, d, (pos_north[0] - pos_south[0]), 0, 90, [
        (pos_north[0] + pos_south[0]) / 2, 3.0 - d / 2, pos_north[2] - d / 20
    ])

    # Small bits on floor
    for s in [[(1 / 2) * d, 0.68], [2.72, 3.06], [5.10, 5.44],
              [6.58, pos_north[0] - pos_south[0] - (1 / 2) * d]]:
        greenpole(MiroSystem, d, (s[1] - s[0] - d), 0, 90,
                  [pos_south[0] + (s[1] + s[0]) / 2, d / 2, pos_north[2]])

    # Revolving doors
    revolute_door(MiroSystem, d, 0.98, 15,
                  [pos_south[0] + 1.70, 2.4 - d / 2, pos_south[2]])
    revolute_door(MiroSystem, d, 0.98, 50,
                  [pos_south[0] + 4.08, 2.4 - d / 2, pos_south[2]])

    # Side door, inner
    normal_door(MiroSystem, d, 1.1 - d, 232,
                [pos_south[0] + 6.58 - d, 2.5 - d / 2, pos_south[2]])

    ########### INNER PART STOPS HERE ###########
    width = pos_north[0] - pos_south[0] + 3.04
    depth = 5
    inner_depth = 2.8
    p = np.array(
        [pos_south[0] - 2 + width / 2, -0.08, pos_south[2] + depth / 2])
    MiroAPI.add_boxShape(MiroSystem, width, 0.16, 5, p, 'MIT_stone_floor.jpg')
    p = np.array([p[0], 3.08, p[2]])
    MiroAPI.add_boxShape(MiroSystem, width, 0.16, 5, p, 'MIT_stone_floor.jpg')

    # Outer door frames
    z = pos_south[2] + inner_depth
    greenpole(MiroSystem, d, l, 0, 0, [pos_south[0] + 0.00 + d / 2, 1.51, z])
    greenpole(MiroSystem, d, l, 0, 0, [pos_south[0] + 0.33, 1.51, z])
    greenpole(MiroSystem, d, l, 0, 0, [pos_south[0] + 1.51, 1.51, z])
    greenpole(MiroSystem, d, l, 0, 0, [pos_south[0] + 1.59, 1.51, z])
    greenpole(MiroSystem, d, l, 0, 0, [pos_south[0] + 2.77, 1.51, z])
    greenpole(MiroSystem, d, l, 0, 0, [pos_south[0] + 3.25, 1.51, z])
    greenpole(MiroSystem, d, l, 0, 0, [pos_south[0] + 4.43, 1.51, z])
    greenpole(MiroSystem, d, l, 0, 0, [pos_south[0] + 4.51, 1.51, z])
    greenpole(MiroSystem, d, l, 0, 0, [pos_south[0] + 5.69, 1.51, z])
    greenpole(MiroSystem, d, l, 0, 0, [pos_south[0] + 6.02 - d / 2, 1.51, z])

    # Outer doors
    normal_door(MiroSystem, d, 1.1 - d, -42,
                [pos_south[0] + 0.33 + d, 2.5 - d / 2, z])  # south outward
    normal_door(MiroSystem, d, 1.1 - d, 180,
                [pos_south[0] + 2.77 - d, 2.5 - d / 2, z])  # south inward

    normal_door(MiroSystem, d, 1.1 - d, -0,
                [pos_south[0] + 3.25 + d, 2.5 - d / 2, z])  # north outward
    normal_door(MiroSystem, d, 1.1 - d, 180,
                [pos_south[0] + 5.69 - d, 2.5 - d / 2, z])  # north inward

    greenpole(MiroSystem, d, 6.02, 0, 90,
              [pos_south[0] + 3.01, 2.5 + d / 2, z - d / 20])
    greenpole(MiroSystem, d, 6.02, 0, 90,
              [pos_south[0] + 3.01, 3.0 - d / 2, z - d / 20])

    # Small bits on floor
    for s in [[d / 2, 0.33], [2.77, 3.25], [5.69, 6.02 - d / 2]]:
        greenpole(MiroSystem, d, (s[1] - s[0] - d), 0, 90,
                  [pos_south[0] + (s[1] + s[0]) / 2, d / 2, z])

    # south wall
    p = np.array(
        [pos_south[0] - 0.05, 1.51, pos_south[2] + inner_depth / 2 - 0.89 / 2])
    MiroAPI.add_boxShape(MiroSystem,
                         0.1,
                         3.02,
                         inner_depth + 0.89,
                         p,
                         'yellow_brick.jpg',
                         scale=[7, 9])

    # north wall
    np.array([pos_north[0] + 0.05, 1.51, pos_south[2] + inner_depth / 2])
    MiroAPI.add_boxShape(MiroSystem,
                         0.1,
                         3.02,
                         inner_depth,
                         p,
                         'yellow_brick.jpg',
                         scale=[6, 9])

    # WEST WALL
    w = 2
    dw = 0.96

    p = np.array([pos_north[0] + w / 2 - dw, 1.51, z])
    MiroAPI.add_boxShape(MiroSystem,
                         w,
                         3.02,
                         0.16,
                         p,
                         'yellow_brick.jpg',
                         scale=[2, 9],
                         color=[0.6, 0.4, 0.0])

    p = np.array([pos_south[0] - dw, 1.51, z])
    MiroAPI.add_boxShape(MiroSystem,
                         w,
                         3.02,
                         0.16,
                         p,
                         'yellow_brick.jpg',
                         scale=[2, 9],
                         color=[0.6, 0.4, 0.0])

    # Cement pillars outside
    r = 0.12
    p = np.array(
        [pos_south[0] - 1, 1.51, z - r + (depth - inner_depth) * (3 / 4)])
    MiroAPI.add_cylinderShape(MiroSystem,
                              r,
                              3.02,
                              1000,
                              p,
                              'white concrete.jpg',
                              color=[0.8, 0.8, 0.8])

    p = np.array([
        pos_north[0] + 1 - 0.96, 1.51, z - r + (depth - inner_depth) * (3 / 4)
    ])
    MiroAPI.add_cylinderShape(MiroSystem,
                              r,
                              3.02,
                              1000,
                              p,
                              'white concrete.jpg',
                              color=[0.8, 0.8, 0.8])

    p = np.array([pos_south[0] + 1.6, 1.51, z - r + (depth - inner_depth)])
    MiroAPI.add_cylinderShape(MiroSystem,
                              r,
                              3.02,
                              1000,
                              p,
                              'white concrete.jpg',
                              color=[0.8, 0.8, 0.8])

    p = np.array(
        [pos_north[0] - 1.6 - 0.96, 1.51, z - r + (depth - inner_depth)])
    MiroAPI.add_cylinderShape(MiroSystem,
                              r,
                              3.02,
                              1000,
                              p,
                              'white concrete.jpg',
                              color=[0.8, 0.8, 0.8])
예제 #24
0
def make_window(size_vx, size_vy, size_vz, size_hx, size_hy, size_hz, mid_pos,
                wall, spacing, MiroSystem):  #size_hx, size_hy, size_hz
    #wall sets orientation of window, set wall = 'south' or 'east'
    # pos sets position
    #and spacing sets the spacing between windowpanes
    H = 3.32
    W = 4.6
    dists = np.array([97, 207, 358, 436, 510, 654, 802, 876, 951, 1102, 1213])
    dists = dists - (dists[-1] + dists[0]) / 2
    dists = dists / dists[-1] * (W - 3 * 0.16) / 2
    test = 0.085

    if wall == 'south':
        #concrete part under and over windows
        for fl in range(3):
            bot_pos = mid_pos + np.array(
                [-0.104, 0.15 + fl * 3.32 + 0.8 / 2, 0])
            top_pos = mid_pos + np.array(
                [-0.104, 0.15 + fl * 3.32 + 3.33 - 0.3 / 2, 0])
            MiroAPI.add_boxShape(MiroSystem,
                                 0.2,
                                 0.8,
                                 W * 3,
                                 bot_pos,
                                 texture='white concrete.jpg',
                                 scale=[9, 12])
            MiroAPI.add_boxShape(MiroSystem,
                                 0.2,
                                 0.3,
                                 W * 3,
                                 top_pos,
                                 texture='white concrete.jpg',
                                 scale=[9, 12])
        for wid in range(3):
            left_pos = mid_pos + np.array(
                [-0.102, 1.5 * 3.32, -6.78 + wid * W])
            right_pos = mid_pos + np.array(
                [-0.102, 1.5 * 3.32, -6.78 + W - 0.25 + wid * W])
            MiroAPI.add_boxShape(MiroSystem,
                                 0.2,
                                 3.32 * 3,
                                 0.25,
                                 left_pos,
                                 texture='white concrete.jpg',
                                 scale=[9, 12])
            MiroAPI.add_boxShape(MiroSystem,
                                 0.2,
                                 3.32 * 3,
                                 0.25,
                                 right_pos,
                                 texture='white concrete.jpg',
                                 scale=[9, 12])

        for i in range(1, 6, 2):
            lvl_height = np.array([0, i / 2 * H, 0])
            for j in [-1, 0, 1]:
                lvl_width = np.array([0, 0, j * W])

                # This box is the windows.
                MiroAPI.add_boxShape(MiroSystem,
                                     0.0025,
                                     3.0 - 0.8,
                                     W - 3 * 0.16,
                                     mid_pos + lvl_width + lvl_height +
                                     np.array([-0.0025, 0.4, 0]),
                                     color=[0.5, 0.6, 0.7, 0.6])

                for k in range(0, len(dists)):
                    tmp = np.array([-0.005, 0, dists[k]])
                    result_pos = mid_pos + lvl_width + lvl_height + tmp
                    MiroAPI.add_boxShape(MiroSystem,
                                         size_vx,
                                         size_vy,
                                         size_vz,
                                         result_pos,
                                         rotY=90,
                                         texture='wood_ikea_style.png')
                for n in [-1, 1]:
                    hzt_pos = np.array([0, 3 / 2, 0])
                    r_hzt_pos = mid_pos + n * hzt_pos + lvl_height + lvl_width
                    MiroAPI.add_boxShape(MiroSystem,
                                         size_hx,
                                         size_hy - test,
                                         size_hz,
                                         r_hzt_pos,
                                         rotX=90,
                                         rotZ=90,
                                         texture='wood_ikea_style.png')
                    if n == -1:
                        MiroAPI.add_boxShape(MiroSystem,
                                             size_hx,
                                             size_hy - test,
                                             size_hz,
                                             r_hzt_pos +
                                             np.array([0, 0.8 * n * (-1), 0]),
                                             rotX=90,
                                             rotZ=90,
                                             texture='wood_ikea_style.png')
                    else:
                        MiroAPI.add_boxShape(MiroSystem,
                                             size_hx,
                                             size_hy - test,
                                             size_hz,
                                             r_hzt_pos +
                                             np.array([0, 0.7 * n * (-1), 0]),
                                             rotX=90,
                                             rotZ=90,
                                             texture='wood_ikea_style.png')
    if wall == 'east':
        for fl in range(3):
            bot_pos = mid_pos + np.array(
                [0, 0.15 + fl * 3.32 + 0.8 / 2, -0.104])
            top_pos = mid_pos + np.array(
                [0, 0.15 + fl * 3.32 + 3.32 - 0.3 / 2, -0.104])
            MiroAPI.add_boxShape(MiroSystem,
                                 W * 3,
                                 0.8,
                                 0.2,
                                 bot_pos,
                                 texture='white concrete.jpg',
                                 scale=[9, 12])
            MiroAPI.add_boxShape(MiroSystem,
                                 W * 3,
                                 0.3,
                                 0.2,
                                 top_pos,
                                 texture='white concrete.jpg',
                                 scale=[9, 12])
        for wid in range(3):
            left_pos = mid_pos + np.array([-6.8 + wid * W, 1.5 * 3.32, -0.102])
            right_pos = mid_pos + np.array(
                [-6.8 + W - 0.25 + wid * W, 1.5 * 3.32, -0.102])
            MiroAPI.add_boxShape(MiroSystem,
                                 0.25,
                                 3.32 * 3,
                                 0.2,
                                 left_pos,
                                 texture='white concrete.jpg',
                                 scale=[9, 12])
            MiroAPI.add_boxShape(MiroSystem,
                                 0.25,
                                 3.32 * 3,
                                 0.2,
                                 right_pos,
                                 texture='white concrete.jpg',
                                 scale=[9, 12])

        for i in range(1, 6, 2):
            lvl_height = np.array([0, i / 2 * H, 0])
            for j in [-1, 0, 1]:
                lvl_width = np.array([j * W, 0, 0])

                # This box is the windows.
                if j != -1 or i != 5:
                    MiroAPI.add_boxShape(MiroSystem,
                                         0.0025,
                                         3.0 - 0.8,
                                         W - 3 * 0.16,
                                         mid_pos + lvl_width + lvl_height +
                                         np.array([0, 0.4, -0.0025]),
                                         rotY=90,
                                         color=[0.5, 0.6, 0.7, 0.6])

                for k in range(0, len(dists)):
                    tmp = np.array([dists[k], 0, 0])
                    result_pos = mid_pos + lvl_width + lvl_height + tmp
                    MiroAPI.add_boxShape(MiroSystem,
                                         size_vz,
                                         size_vy,
                                         size_vx,
                                         result_pos,
                                         rotY=90,
                                         texture='wood_ikea_style.png',
                                         Collide=(j != -1 or i != 5))
                for n in [-1, 1]:
                    hzt_pos = np.array([0, 3 / 2, -0.005])
                    r_hzt_pos = mid_pos + n * hzt_pos + lvl_height + lvl_width
                    MiroAPI.add_boxShape(MiroSystem,
                                         size_hx,
                                         size_hy - test,
                                         size_hz,
                                         r_hzt_pos,
                                         rotZ=90,
                                         texture='wood_ikea_style.png')
                    if n == -1:
                        MiroAPI.add_boxShape(MiroSystem,
                                             size_hx,
                                             size_hy - test,
                                             size_hz,
                                             r_hzt_pos +
                                             np.array([0, 0.8 * n * (-1), 0]),
                                             rotZ=90,
                                             texture='wood_ikea_style.png')
                    else:
                        MiroAPI.add_boxShape(MiroSystem,
                                             size_hx,
                                             size_hy - test,
                                             size_hz,
                                             r_hzt_pos +
                                             np.array([0, 0.7 * n * (-1), 0]),
                                             rotZ=90,
                                             texture='wood_ikea_style.png')
예제 #25
0
def screen(system, SPEEDMODE=False):
    size_length = 4
    size_width = 0.01
    size_height = size_length / (4 / 3)

    # Screen
    grouplogo_file = '../GroupLogo_local.png'
    if not os.path.isfile('GroupLogo_local.png'):
        grouplogo_file = '../GroupLogo.png'
    alpha = np.pi / 10
    beta = np.pi / 4
    corner_pos = np.array([-5.3, 3.55, -8.8])
    delta_tilt = np.array([
        np.sin(alpha) / np.sqrt(2),
        np.cos(alpha),
        np.sin(alpha) / np.sqrt(2)
    ]) * size_height / 2
    screen_pos = corner_pos + np.array([1 / np.sqrt(8), 0, 1 / np.sqrt(8)
                                        ]) * size_length + delta_tilt
    MiroAPI.add_boxShape(system,
                         size_length,
                         size_height,
                         size_width,
                         screen_pos,
                         texture=grouplogo_file,
                         scale=[-4, -3],
                         rotX=alpha,
                         rotY=beta,
                         rotDegrees=False)

    # Top cylinder
    r = 0.08
    roll_pos = screen_pos + delta_tilt * (
        (1.9 * r + size_height) / size_height)
    MiroAPI.add_cylinderShape(system,
                              0.08,
                              4.15,
                              1000,
                              roll_pos,
                              texture=False,
                              rotAngle=90,
                              rotAxis=[1, 0, 1])

    if not SPEEDMODE:
        # Hanging bars
        bar_h = 0.05
        roller_mid = screen_pos + delta_tilt * (
            (3.9 * r + size_height) / size_height) + np.array(
                [0, bar_h / 2, 0])
        dz = np.array([0, 0, 0.25])
        dx = np.array([0.25, 0, 0])

        offset = np.array([1 / np.sqrt(2), 0, -1 / np.sqrt(2)]) * 1.8
        MiroAPI.add_boxShape(system,
                             bar_h,
                             bar_h,
                             1.2,
                             roller_mid + offset - dz,
                             texture=False)
        MiroAPI.add_boxShape(system,
                             1.2,
                             bar_h,
                             bar_h,
                             roller_mid - offset - dx,
                             texture=False)
예제 #26
0
def UNbox(MiroSystem, pos, goal_nr, skew):
    pos[1] = pos[1]+0.2
    MiroAPI.add_boxShape(MiroSystem, 0.4, 0.4, 0.4, pos, density=8, rotY=skew, texture='UN_'+str(goal_nr)+'.png', Fixed=False)
예제 #27
0
def MIT_door(MiroSystem, pos, rot = 0):
    b = 1.0
    h = 2.1

    pos = [pos[0], pos[1]+h/2, pos[2]]
    MiroAPI.add_boxShape(MiroSystem, b, h, 0.16, pos, rotY=rot, texture='MIT_door.png', Collide=False)
예제 #28
0
def chair_back(MiroSystem, pos_back, size_back_x,size_back_y, size_back_z):
    return MiroAPI.add_boxShape(MiroSystem, size_back_x, size_back_y, size_back_z, pos_back, 'MITstol.jpg', Fixed=FIXED)