# No. 254 (Brown 1868): "A sprocket-wheel to drive or to be driven by a chain."
#
# Model (cm, gravity on, face view, axes level): two equal sprocket-wheels of 14 teeth (pitch 2, pitch radius 4.494), 16 apart, and an
# endless roller chain of 30 links over them, each link a pair of plates with a roller (radius 0.6) on its pin, the links hinged on the pins and
# the loop closed by the last pin. The left wheel is turned counter-clockwise at 20 rpm (the one driven joint) and drives the chain by its teeth
# on the rollers; the chain drives the right wheel, which carries a load (a damper, 0.02 N m s). Only the teeth and rollers touch.
# Generator: opencode-runs/batch11/gen254.py.
number: 254
slug: sprocket-wheel-and-chain
name: A sprocket-wheel to drive or to be driven by a chain
brown: "A sprocket-wheel to drive or to be driven by a chain."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 100
  solver: PGS
  multiccd: true
  duration_s: 6
  floor: false
bodies:
  - id: s_drive
    shape: part
    pos: [0, 0, 0]
    mass: 1.0
    friction: 0.2
    color: "#d9cfb6"
    pieces:
      - {kind: poly, points: [[0.5016, -3.7257], [1.1646, -3.5744], [1.3315, -4.3056], [1.3243, -5.1279], [1.0318, -5.1946], [0.6685, -4.4569]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[2.0685, -3.1391], [2.6001, -2.7152], [3.0678, -3.3015], [3.418, -4.0455], [3.1835, -4.2325], [2.5361, -3.7255]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[3.2257, -1.9308], [3.5207, -1.3181], [4.1964, -1.6435], [4.8348, -2.1618], [4.7046, -2.4321], [3.9014, -2.2562]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[3.744, -0.34], [3.744, 0.34], [4.494, 0.34], [5.294, 0.15], [5.294, -0.15], [4.494, -0.34]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[3.5207, 1.3181], [3.2257, 1.9308], [3.9014, 2.2562], [4.7046, 2.4321], [4.8348, 2.1618], [4.1964, 1.6435]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[2.6001, 2.7152], [2.0685, 3.1391], [2.5361, 3.7255], [3.1835, 4.2325], [3.418, 4.0455], [3.0678, 3.3015]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[1.1646, 3.5744], [0.5016, 3.7257], [0.6685, 4.4569], [1.0318, 5.1946], [1.3243, 5.1279], [1.3315, 4.3056]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[-0.5016, 3.7257], [-1.1646, 3.5744], [-1.3315, 4.3056], [-1.3243, 5.1279], [-1.0318, 5.1946], [-0.6685, 4.4569]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[-2.0685, 3.1391], [-2.6001, 2.7152], [-3.0678, 3.3015], [-3.418, 4.0455], [-3.1835, 4.2325], [-2.5361, 3.7255]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[-3.2257, 1.9308], [-3.5207, 1.3181], [-4.1964, 1.6435], [-4.8348, 2.1618], [-4.7046, 2.4321], [-3.9014, 2.2562]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[-3.744, 0.34], [-3.744, -0.34], [-4.494, -0.34], [-5.294, -0.15], [-5.294, 0.15], [-4.494, 0.34]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[-3.5207, -1.3181], [-3.2257, -1.9308], [-3.9014, -2.2562], [-4.7046, -2.4321], [-4.8348, -2.1618], [-4.1964, -1.6435]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[-2.6001, -2.7152], [-2.0685, -3.1391], [-2.5361, -3.7255], [-3.1835, -4.2325], [-3.418, -4.0455], [-3.0678, -3.3015]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[-1.1646, -3.5744], [-0.5016, -3.7257], [-0.6685, -4.4569], [-1.0318, -5.1946], [-1.3243, -5.1279], [-1.3315, -4.3056]], y: [-0.55, 0.55], collide: 1}
      - {kind: disc, center: [0.0, 0], radius: 3.764, inner: 0.7, y: [-0.55, 0.55], collide: 0, color: "#d9cfb6"}   # the web
      - {kind: rod, from: [1.2, -0.7, 0.0], to: [3.244, -0.7, 0.0], radius: 0.22, collide: 0, color: "#7d776c"}
      - {kind: rod, from: [0.3708, -0.7, 1.1413], to: [1.0024, -0.7, 3.0852], radius: 0.22, collide: 0, color: "#7d776c"}
      - {kind: rod, from: [-0.9708, -0.7, 0.7053], to: [-2.6244, -0.7, 1.9068], radius: 0.22, collide: 0, color: "#7d776c"}
      - {kind: rod, from: [-0.9708, -0.7, -0.7053], to: [-2.6244, -0.7, -1.9068], radius: 0.22, collide: 0, color: "#7d776c"}
      - {kind: rod, from: [0.3708, -0.7, -1.1413], to: [1.0024, -0.7, -3.0852], radius: 0.22, collide: 0, color: "#7d776c"}
      - {kind: disc, center: [0.0, 0], radius: 1.4, inner: 0.5, y: [-0.9, 0.9], collide: 0, color: "#8f8a80"}   # the boss
  - id: s_driven
    shape: part
    pos: [16.0, 0, 0]
    mass: 1.0
    friction: 0.2
    color: "#cfc3a6"
    pieces:
      - {kind: poly, points: [[16.5016, -3.7257], [17.1646, -3.5744], [17.3315, -4.3056], [17.3243, -5.1279], [17.0318, -5.1946], [16.6685, -4.4569]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[18.0685, -3.1391], [18.6001, -2.7152], [19.0678, -3.3015], [19.418, -4.0455], [19.1835, -4.2325], [18.5361, -3.7255]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[19.2257, -1.9308], [19.5207, -1.3181], [20.1964, -1.6435], [20.8348, -2.1618], [20.7046, -2.4321], [19.9014, -2.2562]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[19.744, -0.34], [19.744, 0.34], [20.494, 0.34], [21.294, 0.15], [21.294, -0.15], [20.494, -0.34]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[19.5207, 1.3181], [19.2257, 1.9308], [19.9014, 2.2562], [20.7046, 2.4321], [20.8348, 2.1618], [20.1964, 1.6435]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[18.6001, 2.7152], [18.0685, 3.1391], [18.5361, 3.7255], [19.1835, 4.2325], [19.418, 4.0455], [19.0678, 3.3015]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[17.1646, 3.5744], [16.5016, 3.7257], [16.6685, 4.4569], [17.0318, 5.1946], [17.3243, 5.1279], [17.3315, 4.3056]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[15.4984, 3.7257], [14.8354, 3.5744], [14.6685, 4.3056], [14.6757, 5.1279], [14.9682, 5.1946], [15.3315, 4.4569]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[13.9315, 3.1391], [13.3999, 2.7152], [12.9322, 3.3015], [12.582, 4.0455], [12.8165, 4.2325], [13.4639, 3.7255]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[12.7743, 1.9308], [12.4793, 1.3181], [11.8036, 1.6435], [11.1652, 2.1618], [11.2954, 2.4321], [12.0986, 2.2562]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[12.256, 0.34], [12.256, -0.34], [11.506, -0.34], [10.706, -0.15], [10.706, 0.15], [11.506, 0.34]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[12.4793, -1.3181], [12.7743, -1.9308], [12.0986, -2.2562], [11.2954, -2.4321], [11.1652, -2.1618], [11.8036, -1.6435]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[13.3999, -2.7152], [13.9315, -3.1391], [13.4639, -3.7255], [12.8165, -4.2325], [12.582, -4.0455], [12.9322, -3.3015]], y: [-0.55, 0.55], collide: 1}
      - {kind: poly, points: [[14.8354, -3.5744], [15.4984, -3.7257], [15.3315, -4.4569], [14.9682, -5.1946], [14.6757, -5.1279], [14.6685, -4.3056]], y: [-0.55, 0.55], collide: 1}
      - {kind: disc, center: [16.0, 0], radius: 3.764, inner: 0.7, y: [-0.55, 0.55], collide: 0, color: "#cfc3a6"}   # the web
      - {kind: rod, from: [17.2, -0.7, 0.0], to: [19.244, -0.7, 0.0], radius: 0.22, collide: 0, color: "#7d776c"}
      - {kind: rod, from: [16.3708, -0.7, 1.1413], to: [17.0024, -0.7, 3.0852], radius: 0.22, collide: 0, color: "#7d776c"}
      - {kind: rod, from: [15.0292, -0.7, 0.7053], to: [13.3756, -0.7, 1.9068], radius: 0.22, collide: 0, color: "#7d776c"}
      - {kind: rod, from: [15.0292, -0.7, -0.7053], to: [13.3756, -0.7, -1.9068], radius: 0.22, collide: 0, color: "#7d776c"}
      - {kind: rod, from: [16.3708, -0.7, -1.1413], to: [17.0024, -0.7, -3.0852], radius: 0.22, collide: 0, color: "#7d776c"}
      - {kind: disc, center: [16.0, 0], radius: 1.4, inner: 0.5, y: [-0.9, 0.9], collide: 0, color: "#8f8a80"}   # the boss
  - id: ch_x
    shape: part
    pos: [0.0, 0, -4.494]
    mass: 0.001
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [0.0, 0, -4.494], to: [0.0, 0, -4.484], radius: 0.01}   # (a carriage that leaves the chain free in its plane)
  - id: ch_z
    shape: part
    pos: [0.0, 0, -4.494]
    mount: ch_x
    mass: 0.001
    color: "#8f8a80"
    pieces:
      - {kind: rod, from: [0.0, 0, -4.494], to: [0.0, 0, -4.484], radius: 0.01}   # (a carriage that leaves the chain free in its plane)
  - id: L0
    shape: part
    pos: [0.0, 0, -4.494]
    mount: ch_z
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[-0.3, -4.074], [2.3, -4.074], [2.3, -4.914], [-0.3, -4.914]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[-0.3, -4.074], [2.3, -4.074], [2.3, -4.914], [-0.3, -4.914]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [0.0, -0.5, -4.494], to: [0.0, 0.5, -4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [0.0, -1.0, -4.494], to: [0.0, 1.0, -4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L1
    shape: part
    pos: [2.0, 0, -4.494]
    mount: L0
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[1.7, -4.074], [4.3, -4.074], [4.3, -4.914], [1.7, -4.914]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[1.7, -4.074], [4.3, -4.074], [4.3, -4.914], [1.7, -4.914]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [2.0, -0.5, -4.494], to: [2.0, 0.5, -4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [2.0, -1.0, -4.494], to: [2.0, 1.0, -4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L2
    shape: part
    pos: [4.0, 0, -4.494]
    mount: L1
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[3.7, -4.074], [6.3, -4.074], [6.3, -4.914], [3.7, -4.914]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[3.7, -4.074], [6.3, -4.074], [6.3, -4.914], [3.7, -4.914]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [4.0, -0.5, -4.494], to: [4.0, 0.5, -4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [4.0, -1.0, -4.494], to: [4.0, 1.0, -4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L3
    shape: part
    pos: [6.0, 0, -4.494]
    mount: L2
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[5.7, -4.074], [8.3, -4.074], [8.3, -4.914], [5.7, -4.914]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[5.7, -4.074], [8.3, -4.074], [8.3, -4.914], [5.7, -4.914]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [6.0, -0.5, -4.494], to: [6.0, 0.5, -4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [6.0, -1.0, -4.494], to: [6.0, 1.0, -4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L4
    shape: part
    pos: [8.0, 0, -4.494]
    mount: L3
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[7.7, -4.074], [10.3, -4.074], [10.3, -4.914], [7.7, -4.914]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[7.7, -4.074], [10.3, -4.074], [10.3, -4.914], [7.7, -4.914]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [8.0, -0.5, -4.494], to: [8.0, 0.5, -4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [8.0, -1.0, -4.494], to: [8.0, 1.0, -4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L5
    shape: part
    pos: [10.0, 0, -4.494]
    mount: L4
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[9.7, -4.074], [12.3, -4.074], [12.3, -4.914], [9.7, -4.914]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[9.7, -4.074], [12.3, -4.074], [12.3, -4.914], [9.7, -4.914]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [10.0, -0.5, -4.494], to: [10.0, 0.5, -4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [10.0, -1.0, -4.494], to: [10.0, 1.0, -4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L6
    shape: part
    pos: [12.0, 0, -4.494]
    mount: L5
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[11.7, -4.074], [14.3, -4.074], [14.3, -4.914], [11.7, -4.914]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[11.7, -4.074], [14.3, -4.074], [14.3, -4.914], [11.7, -4.914]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [12.0, -0.5, -4.494], to: [12.0, 0.5, -4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [12.0, -1.0, -4.494], to: [12.0, 1.0, -4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L7
    shape: part
    pos: [14.0, 0, -4.494]
    mount: L6
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[13.7, -4.074], [16.3, -4.074], [16.3, -4.914], [13.7, -4.914]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[13.7, -4.074], [16.3, -4.074], [16.3, -4.914], [13.7, -4.914]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [14.0, -0.5, -4.494], to: [14.0, 0.5, -4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [14.0, -1.0, -4.494], to: [14.0, 1.0, -4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L8
    shape: part
    pos: [16.0, 0, -4.494]
    mount: L7
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[15.6141, -4.1512], [18.1489, -3.5727], [18.3358, -4.3916], [15.801, -4.9702]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[15.6141, -4.1512], [18.1489, -3.5727], [18.3358, -4.3916], [15.801, -4.9702]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [16.0, -0.5, -4.494], to: [16.0, 0.5, -4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [16.0, -1.0, -4.494], to: [16.0, 1.0, -4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L9
    shape: part
    pos: [17.9499, 0, -4.0489]
    mount: L8
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[17.4534, -3.9076], [19.4862, -2.2865], [20.0099, -2.9433], [17.9772, -4.5643]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[17.4534, -3.9076], [19.4862, -2.2865], [20.0099, -2.9433], [17.9772, -4.5643]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [17.9499, -0.5, -4.0489], to: [17.9499, 0.5, -4.0489], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [17.9499, -1.0, -4.0489], to: [17.9499, 1.0, -4.0489], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L10
    shape: part
    pos: [19.5135, 0, -2.8019]
    mount: L9
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[19.0049, -2.89], [20.133, -0.5475], [20.8899, -0.9119], [19.7618, -3.2545]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[19.0049, -2.89], [20.133, -0.5475], [20.8899, -0.9119], [19.7618, -3.2545]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [19.5135, -0.5, -2.8019], to: [19.5135, 0.5, -2.8019], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [19.5135, -1.0, -2.8019], to: [19.5135, 1.0, -2.8019], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L11
    shape: part
    pos: [20.3813, 0, -1.0]
    mount: L10
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[19.9613, -1.3], [19.9613, 1.3], [20.8013, 1.3], [20.8013, -1.3]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[19.9613, -1.3], [19.9613, 1.3], [20.8013, 1.3], [20.8013, -1.3]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [20.3813, -0.5, -1.0], to: [20.3813, 0.5, -1.0], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [20.3813, -1.0, -1.0], to: [20.3813, 1.0, -1.0], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L12
    shape: part
    pos: [20.3813, 0, 1.0]
    mount: L11
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[20.133, 0.5475], [19.0049, 2.89], [19.7618, 3.2545], [20.8899, 0.9119]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[20.133, 0.5475], [19.0049, 2.89], [19.7618, 3.2545], [20.8899, 0.9119]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [20.3813, -0.5, 1.0], to: [20.3813, 0.5, 1.0], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [20.3813, -1.0, 1.0], to: [20.3813, 1.0, 1.0], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L13
    shape: part
    pos: [19.5135, 0, 2.8019]
    mount: L12
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[19.4862, 2.2865], [17.4534, 3.9076], [17.9772, 4.5643], [20.0099, 2.9433]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[19.4862, 2.2865], [17.4534, 3.9076], [17.9772, 4.5643], [20.0099, 2.9433]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [19.5135, -0.5, 2.8019], to: [19.5135, 0.5, 2.8019], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [19.5135, -1.0, 2.8019], to: [19.5135, 1.0, 2.8019], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L14
    shape: part
    pos: [17.9499, 0, 4.0489]
    mount: L13
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[18.1489, 3.5727], [15.6141, 4.1512], [15.801, 4.9702], [18.3358, 4.3916]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[18.1489, 3.5727], [15.6141, 4.1512], [15.801, 4.9702], [18.3358, 4.3916]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [17.9499, -0.5, 4.0489], to: [17.9499, 0.5, 4.0489], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [17.9499, -1.0, 4.0489], to: [17.9499, 1.0, 4.0489], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L15
    shape: part
    pos: [16.0, 0, 4.494]
    mount: L14
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[16.3, 4.074], [13.7, 4.074], [13.7, 4.914], [16.3, 4.914]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[16.3, 4.074], [13.7, 4.074], [13.7, 4.914], [16.3, 4.914]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [16.0, -0.5, 4.494], to: [16.0, 0.5, 4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [16.0, -1.0, 4.494], to: [16.0, 1.0, 4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L16
    shape: part
    pos: [14.0, 0, 4.494]
    mount: L15
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[14.3, 4.074], [11.7, 4.074], [11.7, 4.914], [14.3, 4.914]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[14.3, 4.074], [11.7, 4.074], [11.7, 4.914], [14.3, 4.914]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [14.0, -0.5, 4.494], to: [14.0, 0.5, 4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [14.0, -1.0, 4.494], to: [14.0, 1.0, 4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L17
    shape: part
    pos: [12.0, 0, 4.494]
    mount: L16
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[12.3, 4.074], [9.7, 4.074], [9.7, 4.914], [12.3, 4.914]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[12.3, 4.074], [9.7, 4.074], [9.7, 4.914], [12.3, 4.914]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [12.0, -0.5, 4.494], to: [12.0, 0.5, 4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [12.0, -1.0, 4.494], to: [12.0, 1.0, 4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L18
    shape: part
    pos: [10.0, 0, 4.494]
    mount: L17
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[10.3, 4.074], [7.7, 4.074], [7.7, 4.914], [10.3, 4.914]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[10.3, 4.074], [7.7, 4.074], [7.7, 4.914], [10.3, 4.914]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [10.0, -0.5, 4.494], to: [10.0, 0.5, 4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [10.0, -1.0, 4.494], to: [10.0, 1.0, 4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L19
    shape: part
    pos: [8.0, 0, 4.494]
    mount: L18
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[8.3, 4.074], [5.7, 4.074], [5.7, 4.914], [8.3, 4.914]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[8.3, 4.074], [5.7, 4.074], [5.7, 4.914], [8.3, 4.914]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [8.0, -0.5, 4.494], to: [8.0, 0.5, 4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [8.0, -1.0, 4.494], to: [8.0, 1.0, 4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L20
    shape: part
    pos: [6.0, 0, 4.494]
    mount: L19
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[6.3, 4.074], [3.7, 4.074], [3.7, 4.914], [6.3, 4.914]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[6.3, 4.074], [3.7, 4.074], [3.7, 4.914], [6.3, 4.914]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [6.0, -0.5, 4.494], to: [6.0, 0.5, 4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [6.0, -1.0, 4.494], to: [6.0, 1.0, 4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L21
    shape: part
    pos: [4.0, 0, 4.494]
    mount: L20
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[4.3, 4.074], [1.7, 4.074], [1.7, 4.914], [4.3, 4.914]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[4.3, 4.074], [1.7, 4.074], [1.7, 4.914], [4.3, 4.914]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [4.0, -0.5, 4.494], to: [4.0, 0.5, 4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [4.0, -1.0, 4.494], to: [4.0, 1.0, 4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L22
    shape: part
    pos: [2.0, 0, 4.494]
    mount: L21
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[2.3, 4.074], [-0.3, 4.074], [-0.3, 4.914], [2.3, 4.914]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[2.3, 4.074], [-0.3, 4.074], [-0.3, 4.914], [2.3, 4.914]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [2.0, -0.5, 4.494], to: [2.0, 0.5, 4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [2.0, -1.0, 4.494], to: [2.0, 1.0, 4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L23
    shape: part
    pos: [0.0, 0, 4.494]
    mount: L22
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[0.3859, 4.1512], [-2.1489, 3.5727], [-2.3358, 4.3916], [0.199, 4.9702]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[0.3859, 4.1512], [-2.1489, 3.5727], [-2.3358, 4.3916], [0.199, 4.9702]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [0.0, -0.5, 4.494], to: [0.0, 0.5, 4.494], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [0.0, -1.0, 4.494], to: [0.0, 1.0, 4.494], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L24
    shape: part
    pos: [-1.9499, 0, 4.0489]
    mount: L23
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[-1.4534, 3.9076], [-3.4862, 2.2865], [-4.0099, 2.9433], [-1.9772, 4.5643]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[-1.4534, 3.9076], [-3.4862, 2.2865], [-4.0099, 2.9433], [-1.9772, 4.5643]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [-1.9499, -0.5, 4.0489], to: [-1.9499, 0.5, 4.0489], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [-1.9499, -1.0, 4.0489], to: [-1.9499, 1.0, 4.0489], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L25
    shape: part
    pos: [-3.5135, 0, 2.8019]
    mount: L24
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[-3.0049, 2.89], [-4.133, 0.5475], [-4.8899, 0.9119], [-3.7618, 3.2545]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[-3.0049, 2.89], [-4.133, 0.5475], [-4.8899, 0.9119], [-3.7618, 3.2545]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [-3.5135, -0.5, 2.8019], to: [-3.5135, 0.5, 2.8019], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [-3.5135, -1.0, 2.8019], to: [-3.5135, 1.0, 2.8019], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L26
    shape: part
    pos: [-4.3813, 0, 1.0]
    mount: L25
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[-3.9613, 1.3], [-3.9613, -1.3], [-4.8013, -1.3], [-4.8013, 1.3]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[-3.9613, 1.3], [-3.9613, -1.3], [-4.8013, -1.3], [-4.8013, 1.3]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [-4.3813, -0.5, 1.0], to: [-4.3813, 0.5, 1.0], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [-4.3813, -1.0, 1.0], to: [-4.3813, 1.0, 1.0], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L27
    shape: part
    pos: [-4.3813, 0, -1.0]
    mount: L26
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[-4.133, -0.5475], [-3.0049, -2.89], [-3.7618, -3.2545], [-4.8899, -0.9119]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[-4.133, -0.5475], [-3.0049, -2.89], [-3.7618, -3.2545], [-4.8899, -0.9119]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [-4.3813, -0.5, -1.0], to: [-4.3813, 0.5, -1.0], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [-4.3813, -1.0, -1.0], to: [-4.3813, 1.0, -1.0], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L28
    shape: part
    pos: [-3.5135, 0, -2.8019]
    mount: L27
    mass: 0.01
    friction: 0.2
    color: "#a39d90"
    pieces:
      - {kind: poly, points: [[-3.4862, -2.2865], [-1.4534, -3.9076], [-1.9772, -4.5643], [-4.0099, -2.9433]], y: [0.58, 0.74], collide: 0}
      - {kind: poly, points: [[-3.4862, -2.2865], [-1.4534, -3.9076], [-1.9772, -4.5643], [-4.0099, -2.9433]], y: [-0.74, -0.58], collide: 0}
      - {kind: rod, from: [-3.5135, -0.5, -2.8019], to: [-3.5135, 0.5, -2.8019], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [-3.5135, -1.0, -2.8019], to: [-3.5135, 1.0, -2.8019], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: L29
    shape: part
    pos: [-1.9499, 0, -4.0489]
    mount: L28
    mass: 0.01
    friction: 0.2
    color: "#8f8a80"
    pieces:
      - {kind: poly, points: [[-2.1489, -3.5727], [0.3859, -4.1512], [0.199, -4.9702], [-2.3358, -4.3916]], y: [0.75, 0.95], collide: 0}
      - {kind: poly, points: [[-2.1489, -3.5727], [0.3859, -4.1512], [0.199, -4.9702], [-2.3358, -4.3916]], y: [-0.95, -0.75], collide: 0}
      - {kind: rod, from: [-1.9499, -0.5, -4.0489], to: [-1.9499, 0.5, -4.0489], radius: 0.6, collide: 2, capsule: true, color: "#5e584e"}   # the roller
      - {kind: rod, from: [-1.9499, -1.0, -4.0489], to: [-1.9499, 1.0, -4.0489], radius: 0.2, collide: 0, color: "#3e3a34"}   # its pin
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#b9b09c"
    pieces:
      - {kind: rod, from: [0, 0.8, 0], to: [0, 3, 0], radius: 0.5, collide: 0, color: "#8f8a80"}   # the shafts
      - {kind: rod, from: [16.0, 0.8, 0], to: [16.0, 3, 0], radius: 0.5, collide: 0, color: "#8f8a80"}
pins:
  - {id: pin_close, a: L29, b: L0, at: [0.0, 0, -4.494]}   # the last pin, closing the chain
joints:
  - {id: j_a, type: hinge, body: s_drive, axis: [0, -1, 0], damping: 0.001}   # the one driven joint; +: counter-clockwise
  - {id: j_b, type: hinge, body: s_driven, axis: [0, -1, 0], damping: 0.02}   # the driven wheel and its load
  - {id: j_cx, type: slide, body: ch_x, axis: [1, 0, 0], damping: 0.0005}   # the chain is free in its plane, held only by the wheels
  - {id: j_cz, type: slide, body: ch_z, axis: [0, 0, 1], damping: 0.0005}
  - {id: j_c0, type: hinge, body: L0, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L1, type: hinge, body: L1, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L2, type: hinge, body: L2, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L3, type: hinge, body: L3, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L4, type: hinge, body: L4, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L5, type: hinge, body: L5, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L6, type: hinge, body: L6, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L7, type: hinge, body: L7, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L8, type: hinge, body: L8, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L9, type: hinge, body: L9, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L10, type: hinge, body: L10, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L11, type: hinge, body: L11, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L12, type: hinge, body: L12, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L13, type: hinge, body: L13, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L14, type: hinge, body: L14, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L15, type: hinge, body: L15, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L16, type: hinge, body: L16, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L17, type: hinge, body: L17, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L18, type: hinge, body: L18, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L19, type: hinge, body: L19, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L20, type: hinge, body: L20, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L21, type: hinge, body: L21, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L22, type: hinge, body: L22, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L23, type: hinge, body: L23, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L24, type: hinge, body: L24, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L25, type: hinge, body: L25, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L26, type: hinge, body: L26, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L27, type: hinge, body: L27, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L28, type: hinge, body: L28, axis: [0, -1, 0], damping: 0.0002}
  - {id: j_L29, type: hinge, body: L29, axis: [0, -1, 0], damping: 0.0002}
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_a, kind: velocity, rpm: 20, kv: 2, max_torque: 5}
checks:
  - {type: ratio, out: j_b, in: j_a, expect: 1.0, tol: 0.02, settle_s: 1, window_s: 4.5}   # equal wheels: tooth for tooth
  - {type: penetration, max: 0.002, settle_s: 0.5}
camera: {target: [8.0, 0, 0], position: [8.0, -80, 4], fov: 30}
display:
  output: j_b
  labels: {j_a: "Driving sprocket", j_b: "Driven sprocket"}

