# No. 494 (Brown 1868): "Tongs for lifting stones, etc."
#
# Model (cm, joint checks in metres, gravity on, seen from in front as Brown). Two curved tongs cross on a pin; each one's short upper
# arm is jointed by a link to the shackle at the top, so the arms, the links and the shackle make a lozenge. The shackle is hoisted (the
# only input: drawn up at 3 cm/s). The pull on it draws the lozenge out long and its side pins together, which closes the tongs'
# points on the stone; the stone's weight, hanging from the tongs' pin, is what pulls the lozenge out, so the heavier the stone the
# harder the points bite. The tongs' pin is free to rise and fall (the gear hangs symmetric). Generator: opencode-runs/batch14/gen494.py.
number: 494
slug: tongs-for-lifting-stones
name: "Tongs for lifting stones, etc"
brown: "Tongs for lifting stones, etc. The pull on the shackle which connects the two links causes the latter so to act on the upper arms of the tongs as to make their points press themselves against or into the stone. The greater the weight the harder the tongs bite."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 50, duration_s: 6, floor: false}
bodies:
  - id: ground
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#b9ad94"
    pieces:
      - {kind: poly, points: [[-30, -3], [30, -3], [30, 0], [-30, 0]], y: [-14, 14], collide: 1}
  - id: stone
    shape: part
    pos: [0, 0, 0]
    density: 2400
    friction: 1.0
    color: "#cfc6b4"
    pieces:
      - {kind: poly, points: [[-10, 0], [10, 0], [10, 24], [-10, 24]], y: [-6, 6], collide: 2}
  - id: sh
    shape: part
    pos: [0, 0, 36]
    density: 7800
    color: "#6f6a60"
    pieces:
      - {kind: rod, from: [0, -2.4, 36], to: [0, 2.4, 36], radius: 0.4, collide: 0}   # the shackle's pin
      - {kind: rod, from: [0, 0, 36], to: [0, 0, 41], radius: 0.6, collide: 0}
      - {kind: disc, center: [0, 42.4], radius: 1.6, inner: 1.0, y: [-0.5, 0.5], collide: 0}
      - {kind: rod, from: [0, 0, 44], to: [0, 0, 76], radius: 0.6, collide: 0, color: "#c9b48a"}   # the crane's rope
  - id: la
    shape: part
    pos: [0, 0, 36]
    mount: sh
    density: 7800
    color: "#7c776d"
    pieces:
      - {kind: rod, from: [0, -1.6, 36], to: [-8, -1.6, 33], radius: 0.5, capsule: true, collide: 0}
  - id: lb
    shape: part
    pos: [0, 0, 36]
    mount: sh
    density: 7800
    color: "#7c776d"
    pieces:
      - {kind: rod, from: [0, 1.6, 36], to: [8, 1.6, 33], radius: 0.5, capsule: true, collide: 0}
  - {id: piv, shape: assembly, pos: [0, 0, 30], color: "#6f6a60"}
  - id: ja
    shape: part
    pos: [0, 0, 30]
    mount: piv
    density: 7800
    friction: 1.0
    color: "#8f897e"
    pieces:
      - {kind: rod, from: [0.000, -0.7, 30.000], to: [-8.000, -0.7, 33.000], radius: 0.6, capsule: true, collide: 0}
      - {kind: rod, from: [0.000, -0.7, 30.000], to: [9.000, -0.7, 29.600], radius: 0.55, capsule: true, collide: 0}
      - {kind: rod, from: [9.000, -0.7, 29.600], to: [13.600, -0.7, 26.200], radius: 0.55, capsule: true, collide: 0}
      - {kind: rod, from: [13.600, -0.7, 26.200], to: [14.600, -0.7, 21.600], radius: 0.55, capsule: true, collide: 0}
      - {kind: rod, from: [14.600, -0.7, 21.600], to: [13.400, -0.7, 19.600], radius: 0.55, capsule: true, collide: 0}
      - {kind: rod, from: [13.400, -0.7, 19.600], to: [10.400, -0.7, 19.000], radius: 0.35, capsule: true, collide: 1}   # the point
      - {kind: disc, center: [-8.000, 33], radius: 0.9, inner: 0.3, y: [-1.3, -0.1], collide: 0}
  - id: jb
    shape: part
    pos: [0, 0, 30]
    mount: piv
    density: 7800
    friction: 1.0
    color: "#8f897e"
    pieces:
      - {kind: rod, from: [-0.000, 0.7, 30.000], to: [8.000, 0.7, 33.000], radius: 0.6, capsule: true, collide: 0}
      - {kind: rod, from: [-0.000, 0.7, 30.000], to: [-9.000, 0.7, 29.600], radius: 0.55, capsule: true, collide: 0}
      - {kind: rod, from: [-9.000, 0.7, 29.600], to: [-13.600, 0.7, 26.200], radius: 0.55, capsule: true, collide: 0}
      - {kind: rod, from: [-13.600, 0.7, 26.200], to: [-14.600, 0.7, 21.600], radius: 0.55, capsule: true, collide: 0}
      - {kind: rod, from: [-14.600, 0.7, 21.600], to: [-13.400, 0.7, 19.600], radius: 0.55, capsule: true, collide: 0}
      - {kind: rod, from: [-13.400, 0.7, 19.600], to: [-10.400, 0.7, 19.000], radius: 0.35, capsule: true, collide: 1}   # the point
      - {kind: disc, center: [8.000, 33], radius: 0.9, inner: 0.3, y: [0.1, 1.3], collide: 0}
shafts:
  - {id: pin, body: piv, from: [0, -2.0, 0], to: [0, 2.0, 0], radius: 0.5}   # the tongs' pin
joints:
  - {id: j_sh, type: slide, body: sh, axis: [0, 0, 1], damping: 1, range: [-5, 60]}   # + : hoisted
  - {id: j_c, type: slide, body: piv, axis: [0, 0, 1], damping: 0.2, range: [-8, 60]}
  - {id: j_ja, type: hinge, body: ja, axis: [0, 1, 0], damping: 0.01}
  - {id: j_jb, type: hinge, body: jb, axis: [0, 1, 0], damping: 0.01}
  - {id: j_la, type: hinge, body: la, axis: [0, 1, 0], damping: 0.01}
  - {id: j_lb, type: hinge, body: lb, axis: [0, 1, 0], damping: 0.01}
  - {id: j_s, type: slide, body: stone, axis: [0, 0, 1], damping: 1, range: [-1, 60]}
pins:
  - {id: pin_a, a: la, b: ja, at: [-8, 0, 33]}
  - {id: pin_b, a: lb, b: jb, at: [8, 0, 33]}
driver: {joint: j_sh, kind: velocity, speed: 3, kv: 100000, max_torque: 3000}
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.001], margin: 0}
checks:
  - {type: follow, out: j_s, in: j_sh, expect: 1, tol: 0.05, min_r2: 0.99, settle_s: 1.5, window_s: 4.0}
  - {type: penetration, max: 0.003, settle_s: 0.2}
camera: {target: [0, 0, 22], position: [0, -260, 28], fov: 13}
display:
  output: j_s
  labels: {j_sh: "Shackle (hoisted)", j_s: Stone, j_ja: Tongs}
