# No. 116 (Brown 1868): "A substitute for the crank. Reciprocating rectilinear motion of the frame carrying the double rack produces a uniform rotary motion of the pinion-shaft. A separate pinion is used for each rack,
# the two racks being in different planes. Both pinions are loose on the shaft. A ratchet-wheel is fast on the shaft outside of each pinion, and a pawl attached to the pinion to engage in it, one ratchet-wheel having its teeth
# set in one direction and the other having its teeth set in the opposite direction. When the racks move one way, one pinion turns the shaft by means of its pawl and ratchet; and when the racks move the opposite way, the other
# pinion acts in the same way, one pinion always turning loosely on the shaft."
#
# Model (cm): an oval frame, its top rack in the front plane and its bottom rack behind, slides on its ways, the one driven joint: the hand moves it 8 cm each way (0.25 strokes a second).
# Two pinions of 16 teeth (module 0.8, pitch radius 6.4) are loose on one shaft, the front one gearing with the top rack and the one behind with the bottom rack, so they turn opposite ways. Each carries a pawl on a pin,
# sprung onto the teeth (20) of a ratchet-wheel fast on the shaft, between the pinions. A pinion turning clockwise drives the shaft by its pawl; turning the other way it slides loose over the teeth. So as the frame
# goes right the front pinion drives, as it comes back the pinion behind, and the shaft goes round clockwise, a pinion's pitch circle (6.4 cm to the radian of shaft per radian of pinion) at each stroke.
# Brown has the two ratchet-wheels set in opposite directions; the pinions turn opposite ways, so for the shaft to keep one way both are set the same way relative to the pinion that drives them. The shaft's bearing
# friction holds it while the other pawl takes up the next tooth. Generator: opencode-runs/batch9/gen116.py.
number: 116
slug: double-rack-ratchet-pinions
name: A double rack and two ratchet pinions, a substitute for the crank
brown: "A substitute for the crank. Reciprocating rectilinear motion of the frame carrying the double rack produces a uniform rotary motion of the pinion-shaft. A separate pinion is used for each rack, the two racks being in different planes. Both pinions are loose on the shaft. A ratchet-wheel is fast on the shaft outside of each pinion, and a pawl attached to the pinion to engage in it, one ratchet-wheel having its teeth set in one direction and the other having its teeth set in the opposite direction. When the racks move one way, one pinion turns the shaft by means of its pawl and ratchet; and when the racks move the opposite way, the other pinion acts in the same way, one pinion always turning loosely on the shaft."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 100
  solver: PGS
  multiccd: false
  duration_s: 10
  floor: false
bodies:
  - id: pinion_a
    shape: part
    pos: [0, 0, 0]
    density: 7800
    friction: 0.1
    color: "#d9cfb6"
    pieces:
      - {kind: disc, center: [0, 0], radius: 5.55, inner: 0.7, y: [-2.6, -1.4]}
      - {kind: poly, points: [[-0.2646, 5.6571], [-1.9204, 5.3277], [-1.7002, 6.7582], [-1.0154, 6.8944]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[-2.4094, 5.1252], [-3.813, 4.1873], [-4.157, 5.5931], [-3.5765, 5.981]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[-4.1873, 3.813], [-5.1252, 2.4094], [-5.981, 3.5765], [-5.5931, 4.157]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[-5.3277, 1.9204], [-5.6571, 0.2646], [-6.8944, 1.0154], [-6.7582, 1.7002]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[-5.6571, -0.2646], [-5.3277, -1.9204], [-6.7582, -1.7002], [-6.8944, -1.0154]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[-5.1252, -2.4094], [-4.1873, -3.813], [-5.5931, -4.157], [-5.981, -3.5765]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[-3.813, -4.1873], [-2.4094, -5.1252], [-3.5765, -5.981], [-4.157, -5.5931]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[-1.9204, -5.3277], [-0.2646, -5.6571], [-1.0154, -6.8944], [-1.7002, -6.7582]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[0.2646, -5.6571], [1.9204, -5.3277], [1.7002, -6.7582], [1.0154, -6.8944]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[2.4094, -5.1252], [3.813, -4.1873], [4.157, -5.5931], [3.5765, -5.981]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[4.1873, -3.813], [5.1252, -2.4094], [5.981, -3.5765], [5.5931, -4.157]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[5.3277, -1.9204], [5.6571, -0.2646], [6.8944, -1.0154], [6.7582, -1.7002]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[5.6571, 0.2646], [5.3277, 1.9204], [6.7582, 1.7002], [6.8944, 1.0154]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[5.1252, 2.4094], [4.1873, 3.813], [5.5931, 4.157], [5.981, 3.5765]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[3.813, 4.1873], [2.4094, 5.1252], [3.5765, 5.981], [4.157, 5.5931]], y: [-2.6, -1.4], collide: 1}
      - {kind: poly, points: [[1.9204, 5.3277], [0.2646, 5.6571], [1.0154, 6.8944], [1.7002, 6.7582]], y: [-2.6, -1.4], collide: 1}
      - {kind: rod, from: [5.3474, -1.4, 0.7515], to: [5.3474, -0.8, 0.7515], radius: 0.2, color: "#8f8a80", collide: 0}   # the pawl's pin
  - id: pawl_a
    shape: part
    pos: [5.3474, 0, 0.7515]
    mount: pinion_a
    friction: 0.1
    color: "#6b5a44"
    pieces:
      - {kind: rod, from: [5.3474, -0.8, 0.7515], to: [4.3038, -0.8, -0.9148], radius: 0.15, capsule: true, collide: 2}
  - id: pinion_b
    shape: part
    pos: [0, 0, 0]
    density: 7800
    friction: 0.1
    color: "#d9cfb6"
    pieces:
      - {kind: disc, center: [0, 0], radius: 5.55, inner: 0.7, y: [1.4, 2.6]}
      - {kind: poly, points: [[-0.2646, 5.6571], [-1.9204, 5.3277], [-1.7002, 6.7582], [-1.0154, 6.8944]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[-2.4094, 5.1252], [-3.813, 4.1873], [-4.157, 5.5931], [-3.5765, 5.981]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[-4.1873, 3.813], [-5.1252, 2.4094], [-5.981, 3.5765], [-5.5931, 4.157]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[-5.3277, 1.9204], [-5.6571, 0.2646], [-6.8944, 1.0154], [-6.7582, 1.7002]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[-5.6571, -0.2646], [-5.3277, -1.9204], [-6.7582, -1.7002], [-6.8944, -1.0154]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[-5.1252, -2.4094], [-4.1873, -3.813], [-5.5931, -4.157], [-5.981, -3.5765]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[-3.813, -4.1873], [-2.4094, -5.1252], [-3.5765, -5.981], [-4.157, -5.5931]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[-1.9204, -5.3277], [-0.2646, -5.6571], [-1.0154, -6.8944], [-1.7002, -6.7582]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[0.2646, -5.6571], [1.9204, -5.3277], [1.7002, -6.7582], [1.0154, -6.8944]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[2.4094, -5.1252], [3.813, -4.1873], [4.157, -5.5931], [3.5765, -5.981]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[4.1873, -3.813], [5.1252, -2.4094], [5.981, -3.5765], [5.5931, -4.157]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[5.3277, -1.9204], [5.6571, -0.2646], [6.8944, -1.0154], [6.7582, -1.7002]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[5.6571, 0.2646], [5.3277, 1.9204], [6.7582, 1.7002], [6.8944, 1.0154]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[5.1252, 2.4094], [4.1873, 3.813], [5.5931, 4.157], [5.981, 3.5765]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[3.813, 4.1873], [2.4094, 5.1252], [3.5765, 5.981], [4.157, 5.5931]], y: [1.4, 2.6], collide: 2}
      - {kind: poly, points: [[1.9204, 5.3277], [0.2646, 5.6571], [1.0154, 6.8944], [1.7002, 6.7582]], y: [1.4, 2.6], collide: 2}
      - {kind: rod, from: [5.3474, 1.4, 0.7515], to: [5.3474, 0.8, 0.7515], radius: 0.2, color: "#8f8a80", collide: 0}
  - id: pawl_b
    shape: part
    pos: [5.3474, 0, 0.7515]
    mount: pinion_b
    friction: 0.1
    color: "#6b5a44"
    pieces:
      - {kind: rod, from: [5.3474, 0.8, 0.7515], to: [4.3038, 0.8, -0.9148], radius: 0.15, capsule: true, collide: 2}
  - id: shaft
    shape: part
    pos: [0, 0, 0]
    density: 7800
    friction: 0.1
    color: "#c9bfa6"
    pieces:
      - {kind: rod, from: [0, -3.6, 0], to: [0, 3.6, 0], radius: 0.6, collide: 0, color: "#8f8a80"}
      - {kind: disc, center: [0, 0], radius: 3.8, inner: 0.0, y: [-1.2, -0.4]}
      - {kind: poly, points: [[3.7967, 0.1591], [4.596, 0.1926], [3.66, -1.0219]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[3.66, -1.0219], [4.4305, -1.237], [3.1651, -2.1029]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[3.1651, -2.1029], [3.8314, -2.5456], [2.3604, -2.978]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[2.3604, -2.978], [2.8573, -3.605], [1.3246, -3.5617]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[1.3246, -3.5617], [1.6034, -4.3115], [0.1591, -3.7967]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[0.1591, -3.7967], [0.1926, -4.596], [-1.0219, -3.66]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[-1.0219, -3.66], [-1.237, -4.4305], [-2.1029, -3.1651]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[-2.1029, -3.1651], [-2.5456, -3.8314], [-2.978, -2.3604]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[-2.978, -2.3604], [-3.605, -2.8573], [-3.5617, -1.3246]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[-3.5617, -1.3246], [-4.3115, -1.6034], [-3.7967, -0.1591]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[-3.7967, -0.1591], [-4.596, -0.1926], [-3.66, 1.0219]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[-3.66, 1.0219], [-4.4305, 1.237], [-3.1651, 2.1029]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[-3.1651, 2.1029], [-3.8314, 2.5456], [-2.3604, 2.978]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[-2.3604, 2.978], [-2.8573, 3.605], [-1.3246, 3.5617]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[-1.3246, 3.5617], [-1.6034, 4.3115], [-0.1591, 3.7967]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[-0.1591, 3.7967], [-0.1926, 4.596], [1.0219, 3.66]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[1.0219, 3.66], [1.237, 4.4305], [2.1029, 3.1651]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[2.1029, 3.1651], [2.5456, 3.8314], [2.978, 2.3604]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[2.978, 2.3604], [3.605, 2.8573], [3.5617, 1.3246]], y: [-1.2, -0.4], collide: 1}
      - {kind: poly, points: [[3.5617, 1.3246], [4.3115, 1.6034], [3.7967, 0.1591]], y: [-1.2, -0.4], collide: 1}
      - {kind: disc, center: [0, 0], radius: 3.8, inner: 0.0, y: [0.4, 1.2]}
      - {kind: poly, points: [[3.7967, 0.1591], [4.596, 0.1926], [3.66, -1.0219]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[3.66, -1.0219], [4.4305, -1.237], [3.1651, -2.1029]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[3.1651, -2.1029], [3.8314, -2.5456], [2.3604, -2.978]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[2.3604, -2.978], [2.8573, -3.605], [1.3246, -3.5617]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[1.3246, -3.5617], [1.6034, -4.3115], [0.1591, -3.7967]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[0.1591, -3.7967], [0.1926, -4.596], [-1.0219, -3.66]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[-1.0219, -3.66], [-1.237, -4.4305], [-2.1029, -3.1651]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[-2.1029, -3.1651], [-2.5456, -3.8314], [-2.978, -2.3604]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[-2.978, -2.3604], [-3.605, -2.8573], [-3.5617, -1.3246]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[-3.5617, -1.3246], [-4.3115, -1.6034], [-3.7967, -0.1591]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[-3.7967, -0.1591], [-4.596, -0.1926], [-3.66, 1.0219]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[-3.66, 1.0219], [-4.4305, 1.237], [-3.1651, 2.1029]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[-3.1651, 2.1029], [-3.8314, 2.5456], [-2.3604, 2.978]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[-2.3604, 2.978], [-2.8573, 3.605], [-1.3246, 3.5617]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[-1.3246, 3.5617], [-1.6034, 4.3115], [-0.1591, 3.7967]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[-0.1591, 3.7967], [-0.1926, 4.596], [1.0219, 3.66]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[1.0219, 3.66], [1.237, 4.4305], [2.1029, 3.1651]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[2.1029, 3.1651], [2.5456, 3.8314], [2.978, 2.3604]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[2.978, 2.3604], [3.605, 2.8573], [3.5617, 1.3246]], y: [0.4, 1.2], collide: 1}
      - {kind: poly, points: [[3.5617, 1.3246], [4.3115, 1.6034], [3.7967, 0.1591]], y: [0.4, 1.2], collide: 1}
  - id: oval
    shape: part
    pos: [0, 0, 0]
    density: 2700
    friction: 0.1
    color: "#b8ad97"
    pieces:
      - {kind: poly, points: [[-13.823, 7.2], [13.823, 7.2], [13.823, 8.2], [-13.823, 8.2]], y: [-2.6, 2.6], collide: 0}   # the top bar
      - {kind: poly, points: [[-13.823, -8.2], [13.823, -8.2], [13.823, -7.2], [-13.823, -7.2]], y: [-2.6, 2.6], collide: 0}   # the bottom bar
      - {kind: poly, points: [[-13.3853, 7.2], [-11.7474, 7.2], [-12.1842, 6.0], [-12.9486, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[-10.8721, 7.2], [-9.2341, 7.2], [-9.6709, 6.0], [-10.4353, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[-8.3588, 7.2], [-6.7209, 7.2], [-7.1576, 6.0], [-7.922, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[-5.8455, 7.2], [-4.2076, 7.2], [-4.6443, 6.0], [-5.4087, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[-3.3322, 7.2], [-1.6943, 7.2], [-2.1311, 6.0], [-2.8955, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[-0.819, 7.2], [0.819, 7.2], [0.3822, 6.0], [-0.3822, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[1.6943, 7.2], [3.3322, 7.2], [2.8955, 6.0], [2.1311, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[4.2076, 7.2], [5.8455, 7.2], [5.4087, 6.0], [4.6443, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[6.7209, 7.2], [8.3588, 7.2], [7.922, 6.0], [7.1576, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[9.2341, 7.2], [10.8721, 7.2], [10.4353, 6.0], [9.6709, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[11.7474, 7.2], [13.3853, 7.2], [12.9486, 6.0], [12.1842, 6.0]], y: [-2.6, -1.4], collide: 2}
      - {kind: poly, points: [[-13.3853, -7.2], [-11.7474, -7.2], [-12.1842, -6.0], [-12.9486, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[-10.8721, -7.2], [-9.2341, -7.2], [-9.6709, -6.0], [-10.4353, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[-8.3588, -7.2], [-6.7209, -7.2], [-7.1576, -6.0], [-7.922, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[-5.8455, -7.2], [-4.2076, -7.2], [-4.6443, -6.0], [-5.4087, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[-3.3322, -7.2], [-1.6943, -7.2], [-2.1311, -6.0], [-2.8955, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[-0.819, -7.2], [0.819, -7.2], [0.3822, -6.0], [-0.3822, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[1.6943, -7.2], [3.3322, -7.2], [2.8955, -6.0], [2.1311, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[4.2076, -7.2], [5.8455, -7.2], [5.4087, -6.0], [4.6443, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[6.7209, -7.2], [8.3588, -7.2], [7.922, -6.0], [7.1576, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[9.2341, -7.2], [10.8721, -7.2], [10.4353, -6.0], [9.6709, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[11.7474, -7.2], [13.3853, -7.2], [12.9486, -6.0], [12.1842, -6.0]], y: [1.4, 2.6], collide: 1}
      - {kind: poly, points: [[-13.823, 7.3], [-13.823, 8.2], [-16.961, 7.5758], [-16.6166, 6.7443]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[-16.6166, 6.7443], [-16.961, 7.5758], [-19.6213, 5.7983], [-18.9849, 5.1619]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[-18.9849, 5.1619], [-19.6213, 5.7983], [-21.3988, 3.138], [-20.5673, 2.7936]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[-20.5673, 2.7936], [-21.3988, 3.138], [-22.023, 0.0], [-21.123, 0.0]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[-21.123, 0.0], [-22.023, 0.0], [-21.3988, -3.138], [-20.5673, -2.7936]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[-20.5673, -2.7936], [-21.3988, -3.138], [-19.6213, -5.7983], [-18.9849, -5.1619]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[-18.9849, -5.1619], [-19.6213, -5.7983], [-16.961, -7.5758], [-16.6166, -6.7443]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[-16.6166, -6.7443], [-16.961, -7.5758], [-13.823, -8.2], [-13.823, -7.3]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[13.823, 7.3], [13.823, 8.2], [16.961, 7.5758], [16.6166, 6.7443]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[16.6166, 6.7443], [16.961, 7.5758], [19.6213, 5.7983], [18.9849, 5.1619]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[18.9849, 5.1619], [19.6213, 5.7983], [21.3988, 3.138], [20.5673, 2.7936]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[20.5673, 2.7936], [21.3988, 3.138], [22.023, 0.0], [21.123, 0.0]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[21.123, 0.0], [22.023, 0.0], [21.3988, -3.138], [20.5673, -2.7936]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[20.5673, -2.7936], [21.3988, -3.138], [19.6213, -5.7983], [18.9849, -5.1619]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[18.9849, -5.1619], [19.6213, -5.7983], [16.961, -7.5758], [16.6166, -6.7443]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[16.6166, -6.7443], [16.961, -7.5758], [13.823, -8.2], [13.823, -7.3]], y: [-2.6, 2.6], collide: 0}
      - {kind: rod, from: [-22.023, 0, 0], to: [-23.823, 0, 0], radius: 0.9, collide: 0, color: "#8f8a80"}   # the lugs the hand takes it by
      - {kind: rod, from: [22.023, 0, 0], to: [23.823, 0, 0], radius: 0.9, collide: 0, color: "#8f8a80"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: rod, from: [0, -4.4, 0], to: [0, -3.6, 0], radius: 0.8, color: "#8f8a80", collide: 0}   # the shaft's bearings
      - {kind: rod, from: [0, 3.6, 0], to: [0, 5.4, 0], radius: 0.8, color: "#8f8a80", collide: 0}
      - {kind: poly, points: [[-1.4, -12.2], [1.4, -12.2], [1.0, 0], [-1.0, 0]], y: [3.8, 5.4], collide: 0}   # their standard, behind
      - {kind: poly, points: [[-50, -12.2], [50, -12.2], [50, -11.0], [-50, -11.0]], y: [-4, 4], color: "#b9b09c", collide: 0}   # the bench
      - {kind: poly, points: [[-46, -11.0], [-43, -11.0], [-43, -8.5], [-46, -8.5]], y: [-2.6, 2.6], collide: 0}   # the ways' posts
      - {kind: poly, points: [[43, -11.0], [46, -11.0], [46, -8.5], [43, -8.5]], y: [-2.6, 2.6], collide: 0}
      - {kind: poly, points: [[-46, -8.5], [46, -8.5], [46, -8.25], [-46, -8.25]], y: [-2.6, 2.6], collide: 0, color: "#a39a86"}   # the way the oval rides on
joints:
  - {id: j_s, type: hinge, body: shaft, axis: [0, 1, 0], damping: 0.002, frictionloss: 0.01}   # the pinion-shaft; + : clockwise
  - {id: j_a, type: hinge, body: pinion_a, axis: [0, 1, 0], damping: 0.0005}   # loose on it
  - {id: j_b, type: hinge, body: pinion_b, axis: [0, 1, 0], damping: 0.0005}
  - {id: j_pa, type: hinge, body: pawl_a, axis: [0, 1, 0], damping: 0.0002, range: [-0.6, 0.3], stiffness: 0.01, springref: 0.25}   # sprung onto the teeth
  - {id: j_pb, type: hinge, body: pawl_b, axis: [0, 1, 0], damping: 0.0002, range: [-0.6, 0.3], stiffness: 0.01, springref: 0.25}
  - {id: j_f, type: slide, body: oval, axis: [1, 0, 0], damping: 0.05}   # the one driven joint, + : to the right
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_f, kind: velocity, rpm: 0, swing: {amplitude: 0.08, hz: 0.25}, kv: 60000.0, max_torque: 600}
checks:
  - {type: position, joint: j_f, min: -8.5, max: 8.5, settle_s: 0.0, window_s: 9}
  - {type: follow, out: j_s, in: j_f, expect: -15.625, tol: 0.7812, min_r2: 0.99, settle_s: 1.8, window_s: 0.8}   # the frame going left: the pinion behind drives, a pinion's pitch circle
  - {type: follow, out: j_s, in: j_f, expect: 15.625, tol: 0.7812, min_r2: 0.99, settle_s: 3.8, window_s: 0.8}   # going right: the front pinion
  - {type: follow, out: j_s, in: j_f, expect: -15.625, tol: 0.7812, min_r2: 0.99, settle_s: 5.8, window_s: 0.8}
  - {type: position, joint: j_s, min: -0.1, max: 11.0, settle_s: 0.0, window_s: 9.5}   # the shaft never goes back
camera: {target: [0, 0, -3], position: [0, -105.0, -3], fov: 34}
display:
  output: j_s
  labels: {j_f: "Double rack frame (hand)", j_s: "Pinion-shaft", j_a: "Front pinion", j_b: "Rear pinion"}
  proof: {label: "Pawls out of the ratchets", sub: "the frame goes to and fro but the shaft stands"}

