コード例 #1
0
def MC2TXX(rim_radius,
           wheel_radius,
           width,
           rot=[0, 0, 0],
           pos=[0, 0, 0],
           Fixed=False):
    density_tire = density['Steel Forged Concrete']

    [rim, wheel] = MiroAPI.add_TwoBodyTire(False,
                                           rim_radius,
                                           wheel_radius,
                                           width,
                                           pos,
                                           density_tire,
                                           texture='MITstol.jpg')

    COMPONENT_Rim = mc.MiroComponent(rim)
    COMPONENT_Wheel = mc.MiroComponent(wheel)

    COMPONENT_Rim.AddLinkPoint('A', [0, 0, 1], [0, 0, width / 2])
    COMPONENT_Rim.AddLinkPoint('B', [0, 0, -1], [0, 0, -width / 2])

    COMPONENT_Wheel.AddLinkPoint('A', [0, 0, 1], [0, 0, width / 2])
    COMPONENT_Wheel.AddLinkPoint('B', [0, 0, -1], [0, 0, -width / 2])

    COMPONENT_Rim.Rotate(rot)
    COMPONENT_Wheel.Rotate(rot)

    return [COMPONENT_Rim, COMPONENT_Wheel]
コード例 #2
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
コード例 #3
0
def MC5XX(M1, M2, M3, rot=[0, 0, 0], pos=[0, 0, 0], Fixed=False):
    '''Ellipsoid component, ABS plastic.\n
    M1 = radius in x\n 
    M2 = radius in y\n
    M3 = radius in z\n
    Linkpoints: A: +x, B: -x, C: +y, D: -y, E: +z, F: -z.'''
    size_rx = M1
    size_ry = M2
    size_rz = M3
    density_brick = density['ABS']  # kg/m^3

    body_ball = MiroAPI.add_ellipsoidShape(False,
                                           size_rx,
                                           size_ry,
                                           size_rz,
                                           pos,
                                           texture='test_texture.png',
                                           scale=[0.07, 0.07],
                                           Collide=False,
                                           density=density_brick)

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

    COMPONENT.AddLinkPoint('A', [1, 0, 0], [size_rx, 0, 0])
    COMPONENT.AddLinkPoint('B', [-1, 0, 0], [-size_rx, 0, 0])
    COMPONENT.AddLinkPoint('C', [0, 1, 0], [0, size_ry, 0])
    COMPONENT.AddLinkPoint('D', [0, -1, 0], [0, size_ry, 0])
    COMPONENT.AddLinkPoint('E', [0, 0, 1], [0, 0, size_rz])
    COMPONENT.AddLinkPoint('F', [0, 0, -1], [0, 0, -size_rz])

    COMPONENT.Rotate(rot)

    return COMPONENT
コード例 #4
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
コード例 #5
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
コード例 #6
0
def MC2XX(M1, M2, rot=[0, 0, 0], pos=[0, 0, 0], Fixed=False):
    size_h = M1
    size_r = M2
    density_brick = density['ABS']  # kg/m^3

    body_brick = MiroAPI.add_cylinderShape(False,
                                           size_r,
                                           size_h,
                                           density_brick,
                                           pos,
                                           Fixed=False,
                                           texture='MITstol.jpg')

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

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

    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
ファイル: Props.py プロジェクト: Teskedsgubben/MiroSimulint
def robotcourse(MiroSystem, target):
    course_comp = MC.MiroComponent()
        
    # Import .obj file from object_files directory and set color [R, G, B]
    course_comp.ImportObj('Bana_robottavlingen.obj', color = [0.7, 0.7, 0.7])

    course_comp.MoveToPosition([target[0], target[1], target[2]])

    MiroSystem.Add(course_comp.GetBody())
コード例 #9
0
def DUMMY(rot=[0, 0, 0], pos=[0, 0, 0], Fixed=False, radius=0.025):
    body_ball = MiroAPI.add_sphereShape(False,
                                        radius,
                                        pos,
                                        texture='test_texture.png',
                                        scale=[0.07, 0.07],
                                        Collide=False)

    # Generate MiroComponent with above body
    COMPONENT = mc.MiroComponent(body_ball)
    COMPONENT.AddLinkPoint('A', [0, 0, 0], [0, 0, 0])
    COMPONENT.Rotate(rot)
    COMPONENT.MoveToPosition(pos)

    return COMPONENT
コード例 #10
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
コード例 #11
0
def MCTXX(radius_tire, width, rot=[0, 0, 0], pos=[0, 0, 0], Fixed=False):
    density_tire = density['Rubber']

    tire = MiroAPI.add_OneBodyTire(False,
                                   radius_tire,
                                   width,
                                   pos,
                                   density_tire,
                                   texture='MITstol.jpg')

    COMPONENT = mc.MiroComponent(tire)

    COMPONENT.AddLinkPoint('A', [0, 0, 1], [0, 0, width / 2])
    COMPONENT.AddLinkPoint('B', [0, 0, -1], [0, 0, -width / 2])

    COMPONENT.Rotate(rot)

    return COMPONENT