# No. 492 (Brown 1868): "Boat-detaching hook (Brown & Level's)."
#
# Model (cm, joint checks in metres, gravity on, seen from the side as Brown). The upright standard is part of the boat (5 kg, hung by it); the boat slides
# only up and down. The tongue is hinged at the standard's head and lies out and down to the left through the bight of the tackle's hook
# (the hook and its block are fixed overhead). The boat's weight pulls the hinge down against the bight, so the tongue's tip tries to rise:
# the eye at the upper end of the lever (fulcrum at the middle of the standard) holds it down. The rope on the lever's lower end is pulled
# (the only input: the lever turned at a slow steady rate); the eye slides out along the tongue and off its tip, the tongue swings up,
# slips out of the hook, and the boat drops away onto the water (a stop 6 cm below). Generator: opencode-runs/batch14/gen492.py.
number: 492
slug: boat-detaching-hook
name: "Boat-detaching hook (Brown & Level's)"
brown: "Boat-detaching hook (Brown & Level's). The upright standard is secured to the boat, and the tongue hinged to its upper end enters an eye in the level which works on a fulcrum at the middle of the standard. A similar apparatus is applied at each end of the boat. The hooks of the tackles hook into the tongues, which are secure until it is desired to detach the boat, when a rope attached to the lower end of each lever is pulled in such a direction as to slip the eye at the upper end of the lever from off the tongue, which being then liberated slips out of the hook of the tackle and detaches the boat."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 50, duration_s: 8, floor: false}
bodies:
  - id: tackle
    shape: part
    pos: [0, 0, 0]
    fixed: true
    friction: 0.2
    color: "#8a8174"
    pieces:
      - {kind: rod, from: [-2.374, -1.4, 27.071], to: [-2.374, 1.4, 27.071], radius: 0.5, capsule: true, collide: 2}   # the hook's bight
      - {kind: rod, from: [-2.374, -2.6, 27.671], to: [-2.374, -1.4, 27.071], radius: 0.5, capsule: true, collide: 0}
      - {kind: rod, from: [-2.374, 1.4, 27.071], to: [-2.374, 2.2, 28.671], radius: 0.45, capsule: true, collide: 0}   # the point
      - {kind: rod, from: [-2.374, -2.6, 27.671], to: [-2.374, -2.6, 38.000], radius: 0.55, capsule: true, collide: 0}   # the shank
      - {kind: rod, from: [-2.374, -2.6, 38.000], to: [-2.374, -2.6, 41.000], radius: 1.0, collide: 0}   # the swivel
      - {kind: poly, points: [[-5.574, 41.000], [0.826, 41.000], [0.226, 52.000], [-4.974, 52.000]], y: [-4.2, -1.0], collide: 0}   # the tackle block's shell
      - {kind: disc, center: [-2.374, 48.000], radius: 2.4, inner: 0.4, y: [-3.3, -1.9], collide: 0, color: "#b8a888"}   # its sheave
      - {kind: rod, from: [-4.174, -2.6, 50.000], to: [-4.174, -2.6, 64.000], radius: 0.35, collide: 0, color: "#c9b48a"}   # the falls
      - {kind: rod, from: [-0.574, -2.6, 50.000], to: [-0.574, -2.6, 64.000], radius: 0.35, collide: 0, color: "#c9b48a"}
  - id: boat
    shape: part
    pos: [0, 0, 0]
    density: 400
    color: "#7d7466"
    pieces:
      - {kind: rod, from: [0, 0, 2.5], to: [0, 0, 8], radius: 0.7, collide: 0}   # the screwed foot
      - {kind: rod, from: [0, 0, 8], to: [0, 0, 10], radius: 1.6, collide: 0}   # the collar
      - {kind: loft, a: [[-1.2, -0.9, 10], [1.2, -0.9, 10], [1.2, 0.9, 10], [-1.2, 0.9, 10]], b: [[-0.9, -0.9, 30], [0.9, -0.9, 30], [0.9, 0.9, 30], [-0.9, 0.9, 30]], collide: 0}   # the standard
      - {kind: disc, center: [0, 30], radius: 1.5, inner: 0.35, y: [-1.6, 1.6], collide: 0}   # its head, the tongue's hinge
      - {kind: poly, points: [[-7, -1.5], [7, -1.5], [7, 2.5], [-7, 2.5]], y: [-6, 6], collide: 0, color: "#a08a68"}   # a piece of the boat's gunwale
  - id: ballast
    shape: weight
    pos: [0, 0, 1.5]
    mass: 5
    size: [3, 3, 2]
    mount: boat
    color: "#6d6457"
  - id: tongue
    shape: part
    pos: [0, 0, 30]
    mount: boat
    density: 7800
    friction: 0.2
    color: "#9a948a"
    pieces:
      - {kind: rod, from: [0, 0, 30], to: [-5.991, 0, 26.006], radius: 0.6, capsule: true, collide: 1}
      - {kind: rod, from: [0, -1.0, 30], to: [0, 1.0, 30], radius: 1.0, collide: 0}
  - id: lever
    shape: part
    pos: [0.000, 0, 17.000]
    mount: boat
    density: 7800
    friction: 0.2
    color: "#6f6a60"
    pieces:
      - {kind: rod, from: [-5.225, -1.2, 27.742], to: [-6.973, -1.2, 26.578], radius: 0.4, collide: 0}
      - {kind: rod, from: [-5.225, 0, 27.742], to: [-6.973, 0, 26.578], radius: 0.4, capsule: true, collide: 2}   # the eye's crown, over the tongue's tip
      - {kind: rod, from: [-3.966, 0, 25.854], to: [-5.713, 0, 24.689], radius: 0.4, capsule: true, collide: 0}   # the eye's lower side
      - {kind: rod, from: [-5.225, 1.2, 27.742], to: [-5.225, -1.2, 27.742], radius: 0.35, collide: 0}
      - {kind: rod, from: [-3.966, 1.2, 25.854], to: [-3.966, -1.2, 25.854], radius: 0.35, collide: 0}
      - {kind: rod, from: [-3.966, -1.2, 25.854], to: [-5.225, -1.2, 27.742], radius: 0.35, collide: 0}
      - {kind: rod, from: [-3.966, 1.2, 25.854], to: [-5.225, 1.2, 27.742], radius: 0.35, collide: 0}
      - {kind: rod, from: [-3.966, 1.4, 25.854], to: [0.000, 1.4, 17.000], radius: 0.6, collide: 0}   # the upper arm
      - {kind: disc, center: [0, 17], radius: 1.2, inner: 0.3, y: [0.9, 1.9], collide: 0}   # the fulcrum
      - {kind: rod, from: [0.000, 1.4, 17.000], to: [5.0, 1.4, 8], radius: 0.6, collide: 0}   # the lower arm, curving out
      - {kind: rod, from: [5.0, 1.4, 8], to: [9.000, 1.4, -1.000], radius: 0.6, collide: 0}
      - {kind: disc, center: [9, -1], radius: 1.1, inner: 0.45, y: [0.9, 1.9], collide: 0}   # its eye for the rope
      - {kind: rod, from: [9.000, 1.4, -1.000], to: [25, 1.4, -3], radius: 0.3, collide: 0, color: "#c9b48a"}   # the slipping rope
joints:
  - {id: j_b, type: slide, body: boat, axis: [0, 0, 1], damping: 0.5, range: [-6, 0.5]}   # + : up; the boat drops onto the water (its stop) 6 cm below
  - {id: j_t, type: hinge, body: tongue, axis: [0, 1, 0], damping: 0.002, range: [-0.05, 2.4]}   # + : tip up
  - {id: j_l, type: hinge, body: lever, axis: [0, 1, 0], damping: 0.01, range: [-0.5, 0.002]}   # - : rope pulled, eye out along the tongue
driver: {joint: j_l, kind: velocity, rpm: -0.4775, kv: 400, max_torque: 20}
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.001], margin: 0}
checks:
  - {type: position, joint: j_b, min: -0.3, max: 0.3, settle_s: 0.3, window_s: 3.0}   # the boat hangs on the hook while the eye holds the tongue
  - {type: position, joint: j_b, min: -7, max: -5, settle_s: 6, window_s: 1.5}   # after the slip: dropped clear
  - {type: penetration, max: 0.003, settle_s: 0.2}
camera: {target: [0, 0, 2], position: [0, -260, 16], fov: 19.5}
display:
  output: j_b
  labels: {j_l: "Lever (rope pulled)", j_t: Tongue, j_b: Boat}
