# No. 227 (Brown 1868): "Represents a chain and chain pulley. The links being in different planes, spaces are left between them for the teeth of the pulley to enter."
#
# Model (cm; the pulley's face in the x-z plane, gravity on): a chain of round-wire links (pitch 2), each hinged to the next where they interlock, the links
# lying alternately flat (in the plane of the chain's line and the pulley's axis, seen edge-on here) and on edge (in the pulley's plane, seen face-on). The pulley
# holds 8 flat links round its circumference, so the chain lies on it as a 16-gon (corners at r 5.126). Under each flat link it has two seats, one either side
# of the middle groove that the edge links run in, and a tooth in the groove that enters the space in the middle of the flat link, between the ends of the edge
# links, and pushes on its end. The chain hangs over the pulley; its right-hand end carries a 0.4 kg weight running in vertical guides, its left end hangs
# free. The pulley is turned counter-clockwise (4 rpm, the only driven joint) and winds the weight up at 5.093 cm a radian on the mean.
# Generator: opencode-runs/batch11/gen227.py.
number: 227
slug: chain-and-chain-pulley
name: A chain and chain pulley
brown: "Represents a chain and chain pulley. The links being in different planes, spaces are left between them for the teeth of the pulley to enter."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 100
  solver: PGS
  multiccd: true
  duration_s: 8
  floor: false
bodies:
  - id: pulley
    shape: part
    pos: [0, 0, 0]
    mass: 1.0
    friction: 0.2
    color: "#d9cfb6"
    pieces:
      - {kind: poly, points: [[4.82, 0.0], [4.4531, 1.8445], [2.4021, 0.995], [2.6, 0.0]], y: [0.42, 1.1], collide: 1}
      - {kind: poly, points: [[4.82, 0.0], [4.4531, 1.8445], [2.4021, 0.995], [2.6, 0.0]], y: [-1.1, -0.42], collide: 1}
      - {kind: poly, points: [[3.7533, 0.2368], [3.5582, 1.2176], [5.396, 1.4608], [5.5443, 0.7154]], y: [-0.3, 0.3], collide: 1, color: "#b8ad97"}
      - {kind: poly, points: [[3.4082, 3.4082], [1.8445, 4.4531], [0.995, 2.4021], [1.8385, 1.8385]], y: [0.42, 1.1], collide: 1}
      - {kind: poly, points: [[3.4082, 3.4082], [1.8445, 4.4531], [0.995, 2.4021], [1.8385, 1.8385]], y: [-1.1, -0.42], collide: 1}
      - {kind: poly, points: [[2.4865, 2.8214], [1.6551, 3.377], [2.7826, 4.8485], [3.4146, 4.4263]], y: [-0.3, 0.3], collide: 1, color: "#b8ad97"}
      - {kind: poly, points: [[0.0, 4.82], [-1.8445, 4.4531], [-0.995, 2.4021], [0.0, 2.6]], y: [0.42, 1.1], collide: 1}
      - {kind: poly, points: [[0.0, 4.82], [-1.8445, 4.4531], [-0.995, 2.4021], [0.0, 2.6]], y: [-1.1, -0.42], collide: 1}
      - {kind: poly, points: [[-0.2368, 3.7533], [-1.2176, 3.5582], [-1.4608, 5.396], [-0.7154, 5.5443]], y: [-0.3, 0.3], collide: 1, color: "#b8ad97"}
      - {kind: poly, points: [[-3.4082, 3.4082], [-4.4531, 1.8445], [-2.4021, 0.995], [-1.8385, 1.8385]], y: [0.42, 1.1], collide: 1}
      - {kind: poly, points: [[-3.4082, 3.4082], [-4.4531, 1.8445], [-2.4021, 0.995], [-1.8385, 1.8385]], y: [-1.1, -0.42], collide: 1}
      - {kind: poly, points: [[-2.8214, 2.4865], [-3.377, 1.6551], [-4.8485, 2.7826], [-4.4263, 3.4146]], y: [-0.3, 0.3], collide: 1, color: "#b8ad97"}
      - {kind: poly, points: [[-4.82, 0.0], [-4.4531, -1.8445], [-2.4021, -0.995], [-2.6, 0.0]], y: [0.42, 1.1], collide: 1}
      - {kind: poly, points: [[-4.82, 0.0], [-4.4531, -1.8445], [-2.4021, -0.995], [-2.6, 0.0]], y: [-1.1, -0.42], collide: 1}
      - {kind: poly, points: [[-3.7533, -0.2368], [-3.5582, -1.2176], [-5.396, -1.4608], [-5.5443, -0.7154]], y: [-0.3, 0.3], collide: 1, color: "#b8ad97"}
      - {kind: poly, points: [[-3.4082, -3.4082], [-1.8445, -4.4531], [-0.995, -2.4021], [-1.8385, -1.8385]], y: [0.42, 1.1], collide: 1}
      - {kind: poly, points: [[-3.4082, -3.4082], [-1.8445, -4.4531], [-0.995, -2.4021], [-1.8385, -1.8385]], y: [-1.1, -0.42], collide: 1}
      - {kind: poly, points: [[-2.4865, -2.8214], [-1.6551, -3.377], [-2.7826, -4.8485], [-3.4146, -4.4263]], y: [-0.3, 0.3], collide: 1, color: "#b8ad97"}
      - {kind: poly, points: [[-0.0, -4.82], [1.8445, -4.4531], [0.995, -2.4021], [-0.0, -2.6]], y: [0.42, 1.1], collide: 1}
      - {kind: poly, points: [[-0.0, -4.82], [1.8445, -4.4531], [0.995, -2.4021], [-0.0, -2.6]], y: [-1.1, -0.42], collide: 1}
      - {kind: poly, points: [[0.2368, -3.7533], [1.2176, -3.5582], [1.4608, -5.396], [0.7154, -5.5443]], y: [-0.3, 0.3], collide: 1, color: "#b8ad97"}
      - {kind: poly, points: [[3.4082, -3.4082], [4.4531, -1.8445], [2.4021, -0.995], [1.8385, -1.8385]], y: [0.42, 1.1], collide: 1}
      - {kind: poly, points: [[3.4082, -3.4082], [4.4531, -1.8445], [2.4021, -0.995], [1.8385, -1.8385]], y: [-1.1, -0.42], collide: 1}
      - {kind: poly, points: [[2.8214, -2.4865], [3.377, -1.6551], [4.8485, -2.7826], [4.4263, -3.4146]], y: [-0.3, 0.3], collide: 1, color: "#b8ad97"}
      - {kind: disc, center: [0, 0], radius: 3.7773, inner: 0.6, y: [-1.1, 1.1], collide: 0}   # the groove's floor
      - {kind: disc, center: [0, 0], radius: 6.0258, inner: 0.6, y: [1.1, 1.5], collide: 0}   # the back cheek
  - id: load
    shape: part
    pos: [5.1258, 0, -24.0]
    mass: 0.4
    friction: 0.1
    color: "#6b5a44"
    pieces:
      - {kind: rod, from: [5.1258, 0, -24.0], to: [5.1258, 0, -25.2], radius: 0.25, collide: 0}   # the hook
      - {kind: poly, points: [[3.5258, -25.2], [6.7258, -25.2], [6.7258, -28.2], [3.5258, -28.2]], y: [-1.2, 1.2], collide: 0}   # the weight
  - id: L0
    shape: part
    pos: [5.1258, 0, -24.0]
    mount: load
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [5.1258, -0.7, -24.0], to: [5.1258, -0.7, -22.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, 0.7, -24.0], to: [5.1258, 0.7, -22.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -24.0], to: [5.1258, 0.7, -24.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -22.0], to: [5.1258, 0.7, -22.0], radius: 0.3, collide: 2, capsule: true}
  - id: L1
    shape: part
    pos: [5.1258, 0, -22.0]
    mount: L0
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [5.8258, 0.0, -22.0], to: [5.8258, 0.0, -20.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [4.4258, 0.0, -22.0], to: [4.4258, 0.0, -20.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -22.0], to: [4.4258, 0.0, -22.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -20.0], to: [4.4258, 0.0, -20.0], radius: 0.3, collide: 0, capsule: true}
  - id: L2
    shape: part
    pos: [5.1258, 0, -20.0]
    mount: L1
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [5.1258, -0.7, -20.0], to: [5.1258, -0.7, -18.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, 0.7, -20.0], to: [5.1258, 0.7, -18.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -20.0], to: [5.1258, 0.7, -20.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -18.0], to: [5.1258, 0.7, -18.0], radius: 0.3, collide: 2, capsule: true}
  - id: L3
    shape: part
    pos: [5.1258, 0, -18.0]
    mount: L2
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [5.8258, 0.0, -18.0], to: [5.8258, 0.0, -16.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [4.4258, 0.0, -18.0], to: [4.4258, 0.0, -16.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -18.0], to: [4.4258, 0.0, -18.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -16.0], to: [4.4258, 0.0, -16.0], radius: 0.3, collide: 0, capsule: true}
  - id: L4
    shape: part
    pos: [5.1258, 0, -16.0]
    mount: L3
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [5.1258, -0.7, -16.0], to: [5.1258, -0.7, -14.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, 0.7, -16.0], to: [5.1258, 0.7, -14.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -16.0], to: [5.1258, 0.7, -16.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -14.0], to: [5.1258, 0.7, -14.0], radius: 0.3, collide: 2, capsule: true}
  - id: L5
    shape: part
    pos: [5.1258, 0, -14.0]
    mount: L4
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [5.8258, 0.0, -14.0], to: [5.8258, 0.0, -12.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [4.4258, 0.0, -14.0], to: [4.4258, 0.0, -12.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -14.0], to: [4.4258, 0.0, -14.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -12.0], to: [4.4258, 0.0, -12.0], radius: 0.3, collide: 0, capsule: true}
  - id: L6
    shape: part
    pos: [5.1258, 0, -12.0]
    mount: L5
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [5.1258, -0.7, -12.0], to: [5.1258, -0.7, -10.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, 0.7, -12.0], to: [5.1258, 0.7, -10.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -12.0], to: [5.1258, 0.7, -12.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -10.0], to: [5.1258, 0.7, -10.0], radius: 0.3, collide: 2, capsule: true}
  - id: L7
    shape: part
    pos: [5.1258, 0, -10.0]
    mount: L6
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [5.8258, 0.0, -10.0], to: [5.8258, 0.0, -8.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [4.4258, 0.0, -10.0], to: [4.4258, 0.0, -8.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -10.0], to: [4.4258, 0.0, -10.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -8.0], to: [4.4258, 0.0, -8.0], radius: 0.3, collide: 0, capsule: true}
  - id: L8
    shape: part
    pos: [5.1258, 0, -8.0]
    mount: L7
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [5.1258, -0.7, -8.0], to: [5.1258, -0.7, -6.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, 0.7, -8.0], to: [5.1258, 0.7, -6.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -8.0], to: [5.1258, 0.7, -8.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -6.0], to: [5.1258, 0.7, -6.0], radius: 0.3, collide: 2, capsule: true}
  - id: L9
    shape: part
    pos: [5.1258, 0, -6.0]
    mount: L8
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [5.8258, 0.0, -6.0], to: [5.8258, 0.0, -4.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [4.4258, 0.0, -6.0], to: [4.4258, 0.0, -4.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -6.0], to: [4.4258, 0.0, -6.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -4.0], to: [4.4258, 0.0, -4.0], radius: 0.3, collide: 0, capsule: true}
  - id: L10
    shape: part
    pos: [5.1258, 0, -4.0]
    mount: L9
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [5.1258, -0.7, -4.0], to: [5.1258, -0.7, -2.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, 0.7, -4.0], to: [5.1258, 0.7, -2.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -4.0], to: [5.1258, 0.7, -4.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, -2.0], to: [5.1258, 0.7, -2.0], radius: 0.3, collide: 2, capsule: true}
  - id: L11
    shape: part
    pos: [5.1258, 0, -2.0]
    mount: L10
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [5.8258, 0.0, -2.0], to: [5.8258, 0.0, 0.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [4.4258, 0.0, -2.0], to: [4.4258, 0.0, 0.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, -2.0], to: [4.4258, 0.0, -2.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.8258, 0.0, 0.0], to: [4.4258, 0.0, 0.0], radius: 0.3, collide: 0, capsule: true}
  - id: L12
    shape: part
    pos: [5.1258, 0, 0.0]
    mount: L11
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [5.1258, -0.7, 0.0], to: [4.7357, -0.7, 1.9616], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, 0.7, 0.0], to: [4.7357, 0.7, 1.9616], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [5.1258, -0.7, 0.0], to: [5.1258, 0.7, 0.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [4.7357, -0.7, 1.9616], to: [4.7357, 0.7, 1.9616], radius: 0.3, collide: 2, capsule: true}
  - id: L13
    shape: part
    pos: [4.7357, 0, 1.9616]
    mount: L12
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [5.3177, 0.0, 2.3505], to: [4.2065, 0.0, 4.0134], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [4.1536, 0.0, 1.5727], to: [3.0425, 0.0, 3.2356], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [5.3177, 0.0, 2.3505], to: [4.1536, 0.0, 1.5727], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [4.2065, 0.0, 4.0134], to: [3.0425, 0.0, 3.2356], radius: 0.3, collide: 0, capsule: true}
  - id: L14
    shape: part
    pos: [3.6245, 0, 3.6245]
    mount: L13
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [3.6245, -0.7, 3.6245], to: [1.9616, -0.7, 4.7357], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [3.6245, 0.7, 3.6245], to: [1.9616, 0.7, 4.7357], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [3.6245, -0.7, 3.6245], to: [3.6245, 0.7, 3.6245], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [1.9616, -0.7, 4.7357], to: [1.9616, 0.7, 4.7357], radius: 0.3, collide: 2, capsule: true}
  - id: L15
    shape: part
    pos: [1.9616, 0, 4.7357]
    mount: L14
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [2.0981, 0.0, 5.4222], to: [0.1366, 0.0, 5.8124], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [1.825, 0.0, 4.0491], to: [-0.1366, 0.0, 4.4393], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [2.0981, 0.0, 5.4222], to: [1.825, 0.0, 4.0491], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [0.1366, 0.0, 5.8124], to: [-0.1366, 0.0, 4.4393], radius: 0.3, collide: 0, capsule: true}
  - id: L16
    shape: part
    pos: [0.0, 0, 5.1258]
    mount: L15
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [0.0, -0.7, 5.1258], to: [-1.9616, -0.7, 4.7357], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [0.0, 0.7, 5.1258], to: [-1.9616, 0.7, 4.7357], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [0.0, -0.7, 5.1258], to: [0.0, 0.7, 5.1258], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [-1.9616, -0.7, 4.7357], to: [-1.9616, 0.7, 4.7357], radius: 0.3, collide: 2, capsule: true}
  - id: L17
    shape: part
    pos: [-1.9616, 0, 4.7357]
    mount: L16
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [-2.3505, 0.0, 5.3177], to: [-4.0134, 0.0, 4.2065], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-1.5727, 0.0, 4.1536], to: [-3.2356, 0.0, 3.0425], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-2.3505, 0.0, 5.3177], to: [-1.5727, 0.0, 4.1536], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-4.0134, 0.0, 4.2065], to: [-3.2356, 0.0, 3.0425], radius: 0.3, collide: 0, capsule: true}
  - id: L18
    shape: part
    pos: [-3.6245, 0, 3.6245]
    mount: L17
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [-3.6245, -0.7, 3.6245], to: [-4.7357, -0.7, 1.9616], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [-3.6245, 0.7, 3.6245], to: [-4.7357, 0.7, 1.9616], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [-3.6245, -0.7, 3.6245], to: [-3.6245, 0.7, 3.6245], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [-4.7357, -0.7, 1.9616], to: [-4.7357, 0.7, 1.9616], radius: 0.3, collide: 2, capsule: true}
  - id: L19
    shape: part
    pos: [-4.7357, 0, 1.9616]
    mount: L18
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [-5.4222, 0.0, 2.0981], to: [-5.8124, 0.0, 0.1366], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-4.0491, 0.0, 1.825], to: [-4.4393, 0.0, -0.1366], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-5.4222, 0.0, 2.0981], to: [-4.0491, 0.0, 1.825], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-5.8124, 0.0, 0.1366], to: [-4.4393, 0.0, -0.1366], radius: 0.3, collide: 0, capsule: true}
  - id: L20
    shape: part
    pos: [-5.1258, 0, 0.0]
    mount: L19
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [-5.1258, -0.7, 0.0], to: [-5.1258, -0.7, -2.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [-5.1258, 0.7, 0.0], to: [-5.1258, 0.7, -2.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [-5.1258, -0.7, 0.0], to: [-5.1258, 0.7, 0.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [-5.1258, -0.7, -2.0], to: [-5.1258, 0.7, -2.0], radius: 0.3, collide: 2, capsule: true}
  - id: L21
    shape: part
    pos: [-5.1258, 0, -2.0]
    mount: L20
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [-5.8258, 0.0, -2.0], to: [-5.8258, 0.0, -4.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-4.4258, 0.0, -2.0], to: [-4.4258, 0.0, -4.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-5.8258, 0.0, -2.0], to: [-4.4258, 0.0, -2.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-5.8258, 0.0, -4.0], to: [-4.4258, 0.0, -4.0], radius: 0.3, collide: 0, capsule: true}
  - id: L22
    shape: part
    pos: [-5.1258, 0, -4.0]
    mount: L21
    mass: 0.02
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [-5.1258, -0.7, -4.0], to: [-5.1258, -0.7, -6.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [-5.1258, 0.7, -4.0], to: [-5.1258, 0.7, -6.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [-5.1258, -0.7, -4.0], to: [-5.1258, 0.7, -4.0], radius: 0.3, collide: 2, capsule: true}
      - {kind: rod, from: [-5.1258, -0.7, -6.0], to: [-5.1258, 0.7, -6.0], radius: 0.3, collide: 2, capsule: true}
  - id: L23
    shape: part
    pos: [-5.1258, 0, -6.0]
    mount: L22
    mass: 0.02
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [-5.8258, 0.0, -6.0], to: [-5.8258, 0.0, -8.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-4.4258, 0.0, -6.0], to: [-4.4258, 0.0, -8.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-5.8258, 0.0, -6.0], to: [-4.4258, 0.0, -6.0], radius: 0.3, collide: 0, capsule: true}
      - {kind: rod, from: [-5.8258, 0.0, -8.0], to: [-4.4258, 0.0, -8.0], radius: 0.3, collide: 0, capsule: true}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: rod, from: [0, -1.6, 0], to: [0, 3.0, 0], radius: 0.6, collide: 0, color: "#8f8a80"}   # the pulley's shaft
      - {kind: poly, points: [[-1.0, 0], [1.0, 0], [1.0, 9.0], [-1.0, 9.0]], y: [1.8, 3.0], collide: 0}   # its hanger
      - {kind: poly, points: [[-9, 9.0], [11, 9.0], [11, 10.2], [-9, 10.2]], y: [-1.5, 3.0], collide: 0, color: "#b9b09c"}   # the beam
      - {kind: rod, from: [3.1258, 1.6, -26.5], to: [3.1258, 1.6, -6], radius: 0.25, collide: 0, color: "#8f8a80"}   # the weight's guides
      - {kind: rod, from: [7.1258, 1.6, -26.5], to: [7.1258, 1.6, -6], radius: 0.25, collide: 0, color: "#8f8a80"}
joints:
  - {id: j_p, type: hinge, body: pulley, axis: [0, -1, 0], damping: 0.01}   # the one driven joint; +: counter-clockwise
  - {id: j_load, type: slide, body: load, axis: [0, 0, 1], damping: 0.5}   # +: up
  - {id: j_L0, type: hinge, body: L0, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L1, type: hinge, body: L1, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L2, type: hinge, body: L2, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L3, type: hinge, body: L3, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L4, type: hinge, body: L4, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L5, type: hinge, body: L5, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L6, type: hinge, body: L6, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L7, type: hinge, body: L7, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L8, type: hinge, body: L8, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L9, type: hinge, body: L9, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L10, type: hinge, body: L10, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L11, type: hinge, body: L11, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L12, type: hinge, body: L12, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L13, type: hinge, body: L13, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L14, type: hinge, body: L14, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L15, type: hinge, body: L15, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L16, type: hinge, body: L16, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L17, type: hinge, body: L17, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L18, type: hinge, body: L18, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L19, type: hinge, body: L19, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L20, type: hinge, body: L20, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L21, type: hinge, body: L21, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L22, type: hinge, body: L22, axis: [0, -1, 0], damping: 0.0005}
  - {id: j_L23, type: hinge, body: L23, axis: [0, -1, 0], damping: 0.0005}
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_p, kind: velocity, rpm: 4, kv: 20, max_torque: 20}
checks:
  - {type: follow, out: j_load, in: j_p, expect: 0.05093, tol: 0.00204, min_r2: 0.995, settle_s: 1.0, window_s: 6.5}   # the chain's pitch x 16 per turn
  - {type: penetration, max: 0.001, settle_s: 0.5}
camera: {target: [0.0, 0, -11.0], position: [4.0, -75.0, -2.0], fov: 34}
display:
  output: j_load
  labels: {j_p: "Chain pulley (driver)", j_load: "Weight"}
  proof: {label: "Pulley teeth and seats out of contact", sub: "the pulley turns, the chain falls off it and the weight drops"}

