# No. 415 (Brown 1868): "P. Dickson's patent device for converting an oscillating motion into intermittent circular, in either direction.
# Oscillating motion communicated to lever, A, which is provided with two pawls, B and C, hinged to its upper side, near shaft of wheel, D. Small
# crank, E, on upper side of lever, A, is attached by cord to each of pawls, so that when pawl, C, is let into contact with interior of rim of
# wheel, D, it moves in one direction, and pawl, B, is out of gear. Motion of wheel, D, may be reversed by lifting pawl, C, which was in gear, and
# letting opposite one into gear by crank, E."
#
# Model (cm, gravity off, Brown's plan). The lever A turns loose on the wheel's shaft and is rocked through about 34 deg by the rod pinned to its
# foot (the one driven joint: the hand's stroke along the rod). The pawls B and C are hinged on its upper side either side of the shaft and
# reach out to the plain inside of D's rim; a light spring lays the one in gear against the rim. It grips by friction alone: rocked one way it
# jams between its pin and the rim (its line is within the angle of friction of the rim's normal) and carries D round; rocked back it trails and
# slides, and D stands. Halfway through, the crank E lifts C and lets B into gear (the cords' springs are reset), and D goes the other way.
# Generator: opencode-runs/batch13/gen415.py.
number: 415
slug: dicksons-oscillating-to-intermittent-circular
name: Dickson's oscillating to intermittent circular motion
brown: "P. Dickson's patent device for converting an oscillating motion into intermittent circular, in either direction. Oscillating motion communicated to lever, A, which is provided with two pawls, B and C, hinged to its upper side, near shaft of wheel, D. Small crank, E, on upper side of lever, A, is attached by cord to each of pawls, so that when pawl, C, is let into contact with interior of rim of wheel, D, it moves in one direction, and pawl, B, is out of gear. Motion of wheel, D, may be reversed by lifting pawl, C, which was in gear, and letting opposite one into gear by crank, E."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 60, gravity: 0, duration_s: 10, floor: false}
bodies:
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#6f6658"
    pieces:
      - {kind: disc, center: [0, 0], radius: 0.55, y: [-1.6, 1.6]}   # the wheel's shaft
  - id: wheel
    shape: part
    pos: [0, 0, 0]
    mass: 0.6
    friction: 0.9
    color: "#a39b8a"
    pieces:
      - {kind: band, center: [0, 0], r: [9.0, 9.8], a: [0, 6.2832], y: [-1.0, 0.6], slices: 96, collide: 2}   # the wheel D's rim, plain inside
      - {kind: disc, center: [0, 0], radius: 9.0, inner: 8.75, y: [0.6, 0.9], color: "#8f8676"}   # its web, behind
      - {kind: disc, center: [0, 0], radius: 8.75, inner: 0.6, y: [0.7, 0.9], color: "#b3ab9b"}
  - id: lever
    shape: part
    pos: [0, 0, 0]
    mass: 0.15
    color: "#b48a55"
    pieces:
      - {kind: poly, points: [[-4.6, -0.7], [4.6, -0.7], [4.2, -1.9], [1.0, -2.1], [-1.0, -2.1], [-4.2, -1.9]], y: [-0.3, 0.3]}   # the lever A, its cross-head
      - {kind: poly, points: [[-1.0, -6.8], [1.0, -6.8], [1.0, -2.0], [-1.0, -2.0]], y: [-0.3, 0.3]}   # and its stem
      - {kind: disc, center: [0, 0], radius: 1.2, inner: 0.55, y: [-0.3, 0.3]}   # its boss, on the wheel's shaft
      - {kind: poly, points: [[-0.5, 0.3], [0.5, 0.3], [0.5, -0.7], [-0.5, -0.7]], y: [-0.3, 0.3]}
      - {kind: disc, center: [0, -6.8], radius: 0.9, inner: 0.25, y: [-0.3, 0.3]}   # its foot, where the rod is pinned
      - {kind: rod, from: [0, -0.6, 1.4], to: [0, -0.6, 2.4], radius: 0.12, color: "#6b5a44"}   # the small crank E on its upper side
      - {kind: rod, from: [0, -0.6, 2.4], to: [0.5, -0.6, 2.4], radius: 0.12, color: "#6b5a44"}
      - {kind: rod, from: [0.5, -0.6, 2.4], to: [0.5, -0.6, 3.0], radius: 0.12, color: "#6b5a44"}
      - {kind: disc, center: [1.1559, 2.9898], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}   # the cords from E to the pawls (dotted, as Brown)
      - {kind: disc, center: [1.8119, 2.9796], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [2.4678, 2.9694], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [3.1238, 2.9593], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [3.7797, 2.9491], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [4.4357, 2.9389], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [5.0916, 2.9287], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [5.7476, 2.9185], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [-0.0301, 3.1834], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [-0.5602, 3.3668], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [-1.0903, 3.5501], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [-1.6204, 3.7335], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [-2.1505, 3.9169], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [-2.6806, 4.1003], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [-3.2106, 4.2836], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
      - {kind: disc, center: [-3.7407, 4.467], radius: 0.09, y: [-0.9, -0.85], color: "#3a3632"}
  - id: pawl_c
    shape: part
    pos: [2.25, -0.6, 0.0]
    mount: lever
    mass: 0.02
    friction: 0.9
    color: "#8a7a62"
    pieces:
      - {kind: poly, points: [[2.4508, -0.2867], [7.9888, 3.591], [7.5873, 4.1645], [2.0492, 0.2867]], y: [-0.85, -0.35]}   # the pawl C, in gear
      - {kind: disc, center: [7.788, 3.8778], radius: 0.3, y: [-0.85, -0.35], collide: 1}   # its nose, which grips the rim
      - {kind: disc, center: [2.25, 0.0], radius: 0.45, inner: 0.18, y: [-0.95, -0.25], color: "#6b5a44"}
  - id: pawl_b
    shape: part
    pos: [-2.25, -0.6, 0.0]
    mount: lever
    mass: 0.02
    friction: 0.9
    color: "#8a7a62"
    pieces:
      - {kind: poly, points: [[-1.929, 0.1395], [-4.6234, 6.34], [-5.2654, 6.061], [-2.571, -0.1395]], y: [-0.85, -0.35]}   # the pawl B, out of gear
      - {kind: disc, center: [-4.9444, 6.2005], radius: 0.3, y: [-0.85, -0.35], collide: 1}   # its nose, which grips the rim
      - {kind: disc, center: [-2.25, 0.0], radius: 0.45, inner: 0.18, y: [-0.95, -0.25], color: "#6b5a44"}
  - id: hand
    shape: part
    pos: [17.0, 0, -6.8]
    mass: 0.1
    color: "#7d7466"
    pieces:
      - {kind: disc, center: [17.0, -6.8], radius: 0.5, y: [-0.9, -0.3]}
  - id: rod
    shape: part
    pos: [17.0, -0.6, -6.8]
    mount: hand
    mass: 0.05
    color: "#7d7466"
    pieces:
      - {kind: poly, points: [[0, -7.15], [17.0, -7.15], [17.0, -6.45], [0, -6.45]], y: [-0.85, -0.35]}   # the rod that rocks the lever
      - {kind: disc, center: [0, -6.8], radius: 0.55, inner: 0.25, y: [-0.85, -0.35]}
pins:
  - {id: pin_rod, a: rod, b: lever, at: [0, -0.6, -6.8]}   # the rod's eye on the lever's foot
joints:
  - {id: j_h, type: slide, body: hand, axis: [1, 0, 0], damping: 0.5}   # the one driven joint: the hand's stroke along the rod
  - {id: j_rod, type: hinge, body: rod, axis: [0, 1, 0]}
  - {id: j_A, type: hinge, body: lever, axis: [0, -1, 0], damping: 0.002}   # the lever A on the shaft (+ = anticlockwise as drawn)
  - {id: j_c, type: hinge, body: pawl_c, axis: [0, -1, 0], stiffness: 0.1, springref: -0.024, damping: 0.0005}   # C, let into gear: its spring lays it on the rim
  - {id: j_b, type: hinge, body: pawl_b, axis: [0, -1, 0], stiffness: 0.1, springref: 0, damping: 0.0005}   # B, lifted out of gear by the cord to E
  - {id: j_D, type: hinge, body: wheel, axis: [0, -1, 0], damping: 0.15}   # the wheel D, against its work
hand:
  - {t: 5, springref: {j_c: 0.55, j_b: 0.574}}   # E turned over: C lifted out of gear, B let in
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_h, kind: velocity, rpm: 0, swing: {amplitude: 0.02, hz: 0.5}, kv: 200, max_torque: 50}
checks:
  - {type: monotonic, joint: j_D, direction: 1, max_back: 0.03, settle_s: 0.2, window_s: 4.6}   # with C in gear D only goes forward, by steps
  - {type: monotonic, joint: j_D, direction: -1, max_back: 0.03, settle_s: 5.2, window_s: 4.6}   # with B in gear, only backward
  - {type: penetration, max: 0.001}
camera: {target: [3, 0, -4.4], position: [3, -80, -4.4], fov: 21}
display:
  output: j_D
  proof: {label: "Pawls out of contact", sub: "the lever rocks alone: the wheel stands still"}
  labels: {j_h: "The hand's stroke on the rod (driver)", j_A: "The lever A", j_c: "The pawl C", j_b: "The pawl B", j_D: "The wheel D"}
