# No. 176 (Brown 1868): "Contrivance for uncoupling engines. The wrist which is fixed on one arm of the crank (not shown) will communicate motion to the arm of the crank which is represented, when the ring on the latter has its slot in the position shown in 176. But when the ring is turned to bring the slot in the position shown in 177, the wrist passes through the slot without turning the crank to which said ring is attached."
#
# Reading of the figures (cm, no gravity; a plan): the wrist of the engine's other crank is a pin that moves to and fro across the head of the crank arm shown (4 cm either way, the one driven joint, a slide). The head carries a ring with a slot; the wrist runs in that slot.
# In 176 the slot lies across the wrist' + chr(39) + 's path, so the wrist pushes its walls and turns the arm, which hangs on a pivot ' + str(L) + ' cm below (real contact; 0.08 cm clearance). The ring is held in its position by a stiff joint spring (turning it by hand is not modelled). Generator: opencode-runs/batch11/gen176.py (MODE=176).
number: 176
slug: uncoupling-engines-coupled
name: "Contrivance for uncoupling engines: coupled"
brown: "Contrivance for uncoupling engines. The wrist which is fixed on one arm of the crank (not shown) will communicate motion to the arm of the crank which is represented, when the ring on the latter has its slot in the position shown in 176. But when the ring is turned to bring the slot in the position shown in 177, the wrist passes through the slot without turning the crank to which said ring is attached."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 100
  solver: PGS
  multiccd: true
  duration_s: 9.0
  floor: false
  gravity: 0
bodies:
  - id: arm
    shape: part
    pos: [0, 0, 0]
    mass: 0.4
    friction: 0.02
    color: "#cfc6b4"
    pieces:
      - {kind: disc, center: [0, 0], radius: 2.6, y: [-0.8, 0.0], collide: 0, color: "#d9cfb6"}
      - {kind: disc, center: [0, 0], radius: 1.7, y: [-1.2, -0.8], collide: 0, color: "#8f8a80"}
      - {kind: poly, points: [[-1.9, 0.0], [1.9, 0.0], [2.6, 13.0], [-2.6, 13.0]], y: [-0.8, 0.0], collide: 0, color: "#cfc6b4"}
      - {kind: disc, center: [0, 16.0], radius: 4.4, y: [-0.8, 0.0], collide: 0, color: "#cfc6b4"}
  - id: ring
    shape: part
    pos: [0, 0, 16.0]
    mount: arm
    mass: 0.1
    friction: 0.02
    color: "#d9cfb6"
    pieces:
      - {kind: disc, center: [0, 16.0], radius: 3.9, y: [-1.8, -0.8], collide: 0, color: "#d9cfb6"}
      - {kind: poly, points: [[-1.08, 12.4], [-1.98, 12.4], [-1.98, 19.6], [-1.08, 19.6]], y: [-1.8, -0.9], collide: 2, color: "#8f7f66"}
      - {kind: poly, points: [[1.08, 12.4], [1.98, 12.4], [1.98, 19.6], [1.08, 19.6]], y: [-1.8, -0.9], collide: 2, color: "#8f7f66"}
  - id: wrist
    shape: part
    pos: [0, 0, 16.0]
    mass: 0.2
    color: "#a89a7e"
    pieces:
      - {kind: rod, from: [0.0, -2.6, 16.0], to: [0.0, 0.8, 16.0], radius: 1.0, collide: 1, capsule: true, color: "#a89a7e"}
      - {kind: disc, center: [0, 16.0], radius: 1.8, y: [-3.2, -2.6], collide: 0, color: "#8f8a80"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: poly, points: [[-9, -4.5], [9, -4.5], [9, -3.3], [-9, -3.3]], y: [-3, 1.5], collide: 0, color: "#b9b09c"}
      - {kind: rod, from: [0, 0.2, 0], to: [0, 1.4, 0], radius: 1.0, collide: 0, color: "#8f8a80"}
      - {kind: poly, points: [[-1.2, -3.3], [1.2, -3.3], [0.8, 0], [-0.8, 0]], y: [0.4, 1.4], collide: 0}
joints:
  - {id: j_arm, type: hinge, body: arm, axis: [0, -1, 0], damping: 0.05}   # the crank arm: it turns only if the wrist pushes it
  - {id: j_ring, type: hinge, body: ring, axis: [0, -1, 0], stiffness: 400, springref: 0, damping: 0.5}   # the ring, held in its slot position
  - {id: j_w, type: slide, body: wrist, axis: [1, 0, 0], damping: 0.01}   # the wrist moving to and fro: the one driven joint
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_w, kind: velocity, rpm: 0, swing: {amplitude: 0.04, hz: 0.25}, kv: 100, max_torque: 200}
checks:
  - {type: follow, out: j_arm, in: j_w, expect: -6.250, tol: 0.2, min_r2: 0.99, settle_s: 1.7, window_s: 0.6}
  - {type: follow, out: j_arm, in: j_w, expect: -6.250, tol: 0.2, min_r2: 0.99, settle_s: 3.7, window_s: 0.6}
  - {type: follow, out: j_arm, in: j_w, expect: -6.250, tol: 0.2, min_r2: 0.99, settle_s: 5.7, window_s: 0.6}
  - {type: position, joint: j_arm, min: -0.283, max: 0.283, settle_s: 0.0, window_s: 8.5}
  - {type: penetration, max: 0.003, settle_s: 0.5}
camera: {target: [0.0, 0, 3.1], position: [0.0, -66.0, 3.1], fov: 34}
display:
  output: j_arm
  labels: {j_w: "Wrist (driver)", j_arm: "Crank arm", j_ring: "Ring"}

