number: 366
slug: drilling-machine
name: Drilling machine
brown: "Drilling machine. By the large bevel-gear rotary motion is given to vertical drillshaft, which slides through small bevel-gear but is made to turn with it by a feather and groove, and is depressed by treadle connected with upper lever."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 80, solver: PGS, multiccd: true, duration_s: 8, floor: false}
bodies:
  # the crank shaft and the large bevel-gear (the driver)
  - id: crank
    shape: part
    pos: [0, 0, 0]
    density: 7800
    color: "#d9cfb6"
    pieces:
      - {kind: rod, from: [-5.500000000000001, 0, 0], to: [-26, 0, 0], radius: 0.7, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [-24, 0, 0], to: [-24, 0, -9], radius: 0.6, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [-24, 0, -9], to: [-29, 0, -9], radius: 0.7, collide: 0, color: "#a88a5c"}
      - {kind: rod, from: [-20, 0, 0], to: [-21.5, 0, 0], radius: 6.0, collide: 0, color: "#9c958a"}
  # the small bevel-gear's sleeve, carrying the feather
  - id: sleeve
    shape: part
    pos: [0, 0, 0]
    density: 7800
    color: "#e2d8bf"
    pieces:
      - {kind: rod, from: [0, 0, 8.600000000000001], to: [0, 0, 16], radius: 1.4, collide: 0}
      - {kind: rod, from: [0.95, 0, 9.5], to: [0.95, 0, 12.5], radius: 0.25, capsule: true, collide: 2, color: "#6f6a60"}
  # the drill-shaft: a carriage sliding up and down, the shaft turning in it
  - id: drill_z
    shape: part
    pos: [0, 0, 24.4]
    density: 7800
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [0, 0, 24.4], to: [0, 0, 24.5], radius: 0.3, collide: 0}
  - id: drill
    shape: part
    mount: drill_z
    pos: [0, 0, 24.4]
    density: 7800
    friction: 0.1
    color: "#b5ae9f"
    pieces:
      - {kind: rod, from: [0, 0, -2.5], to: [0, 0, 23.0], radius: 0.8, collide: 0}
      - {kind: rod, from: [0, 0, -6], to: [0, 0, -2.5], radius: 0.4, capsule: true, collide: 2, color: "#6f6a60"}
      - {kind: rod, from: [0, 0, 23.0], to: [0, 0, 24.4], radius: 1.6, collide: 0, color: "#8f8a80"}
      - {kind: poly, points: [[-1.13, 23.599999999999998], [1.13, 23.599999999999998], [1.13, 24.4], [-1.13, 24.4]], y: [-1.13, 1.13], collide: 2, color: "#8f8a80"}
      - {kind: rod, from: [0.8099, 0.4966, 8.5], to: [0.8099, 0.4966, 20.5], radius: 0.2, capsule: true, collide: 1, color: "#6f6a60"}
      - {kind: rod, from: [0.8099, -0.4966, 8.5], to: [0.8099, -0.4966, 20.5], radius: 0.2, capsule: true, collide: 1, color: "#6f6a60"}
  # the upper lever, pivoted on the column's head; its pad bears on the collar
  - id: lever
    shape: part
    pos: [-12, 0, 26.6]
    density: 7800
    friction: 0.1
    color: "#c9b48a"
    pieces:
      - {kind: poly, points: [[-13, 26.0], [16, 26.0], [16, 27.2], [-13, 27.2]], y: [-0.6, 0.6]}
      - {kind: rod, from: [0, -1.2, 25.5], to: [0, 1.2, 25.5], radius: 0.5, capsule: true, collide: 1, color: "#8f8a80"}
      - {kind: disc, center: [-12, 26.6], radius: 0.9, y: [-0.9, 0.9], color: "#8f8a80"}
  # the link from the treadle up to the lever
  - id: link
    shape: part
    mount: lever
    pos: [14, 0, 26.6]
    density: 2000
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [14, -1.1, 26.6], to: [14, -1.1, -27], radius: 0.35, collide: 0}
      - {kind: disc, center: [14, 26.6], radius: 0.6, y: [-1.5, -0.7]}
      - {kind: disc, center: [14, -27], radius: 0.6, y: [-1.5, -0.7]}
  # the treadle, pivoted at the floor on the left
  - id: treadle
    shape: part
    pos: [-14, 0, -27]
    density: 700
    color: "#c9a878"
    pieces:
      - {kind: poly, points: [[-14, -27.6], [24, -27.6], [24, -26.4], [-14, -26.4]], y: [-0.6, 0.6]}
      - {kind: poly, points: [[17, -27.6], [26, -27.6], [26, -26.6], [17, -26.6]], y: [-3, 3]}
      - {kind: disc, center: [-14, -27], radius: 0.8, y: [-1.0, 1.0], color: "#8f8a80"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    friction: 0.3
    pieces:
      - {kind: poly, points: [[-30, -31], [30, -31], [30, -29.5], [-30, -29.5]], y: [-8, 10], color: "#b9b09c"}
      - {kind: poly, points: [[-15, -29.5], [-13, -29.5], [-13.5, -28], [-14.5, -28]], y: [-1.6, 1.6]}
      - {kind: poly, points: [[-2, -29.5], [2, -29.5], [2, 30], [-2, 30]], y: [7, 9.5]}
      - {kind: poly, points: [[-13, 27.4], [2, 27.4], [2, 29.5], [-13, 29.5]], y: [-1.4, 9.5]}
      - {kind: poly, points: [[-2.2, 16.3], [2.2, 16.3], [2.2, 17.5], [-2.2, 17.5]], y: [-2.2, 9.5]}
      - {kind: poly, points: [[-2.2, 2.5], [2.2, 2.5], [2.2, 3.7], [-2.2, 3.7]], y: [-2.2, 9.5]}
      - {kind: poly, points: [[-18, -1.2], [-16, -1.2], [-16, 1.2], [-18, 1.2]], y: [-1.2, 9.5]}
      - {kind: poly, points: [[-6, -10.5], [6, -10.5], [6, -9.0], [-6, -9.0]], y: [-4, 4], collide: 1, color: "#9a8f78"}
      - {kind: poly, points: [[-7, -12.0], [7, -12.0], [7, -10.5], [-7, -10.5]], y: [-6, 9.5]}
bevels:
  - {id: gL, body: crank, teeth: 40, pitch_radius: 8.0, cone_angle: 1.1071, face_width: 2.5, backlash: 0.04, phase: 0.0, quat: [0.7071068, 0, 0, 0.7071068]}
  - {id: gS, body: sleeve, teeth: 20, pitch_radius: 4.0, cone_angle: 0.4636, face_width: 2.5, backlash: 0.04, phase: 0.1571, quat: [0.7071068, 0.7071068, 0, 0]}
pins:
  - {id: p_tr, a: link, b: treadle, at: [14, 0, -27]}
joints:
  - {id: j_h, type: hinge, body: crank, axis: [1, 0, 0], damping: 0.005}   # the one driven joint
  - {id: j_s, type: hinge, body: sleeve, axis: [0, 0, 1], damping: 0.005}
  - {id: j_dz, type: slide, body: drill_z, axis: [0, 0, 1], range: [-6, 0], stiffness: 600.0, springref: 0.03, damping: 5}
  - {id: j_d, type: hinge, body: drill, axis: [0, 0, 1], damping: 0.01}
  - {id: j_ul, type: hinge, body: lever, axis: [0, 1, 0], range: [-0.05, 0.5], damping: 0.5}
  - {id: j_lk, type: hinge, body: link, axis: [0, 1, 0], damping: 0.01}
  - {id: j_tr, type: hinge, body: treadle, axis: [0, 1, 0], range: [-0.05, 0.6], stiffness: 30.0, springref: 0, damping: 2}
hand:
  - {t: 2.5, springref: {j_tr: 0.6}}
  - {t: 6.0, springref: {j_tr: 0}}
contact: {solref: [0.0008, 1], solimp: [0.95, 0.99, 0.001], margin: 0}
driver: {joint: j_h, kind: velocity, rpm: 30, kv: 2, max_torque: 5}
checks:
  - {type: ratio, out: j_d, in: j_h, expect: 2.0, tol: 0.05, settle_s: 0.5, window_s: 7}
  - {type: ratio, out: j_d, in: j_h, expect: 2.0, tol: 0.05, settle_s: 3.5, window_s: 2}
  - {type: position, joint: j_dz, min: -1.5, max: 0.1, settle_s: 0.5, window_s: 1.9}
  - {type: position, joint: j_dz, min: -3.0, max: -2.2, settle_s: 3.5, window_s: 2}
  - {type: position, joint: j_dz, min: -1.5, max: 0.1, settle_s: 6.8, window_s: 1.2}
  - {type: penetration, max: 0.001, settle_s: 0.5}
camera: {target: [-2, 0, -16], position: [-135, -248, 58], fov: 30}
display:
  output: j_d
  labels: {j_h: "Crank and large bevel-gear (driver)", j_s: "Small bevel-gear and sleeve", j_d: "Drill-shaft", j_dz: "Drill-shaft, down", j_tr: "Treadle"}

