# No. 125 (Brown 1868): "A modification of the motion shown in 122, but of a more complex character."
#
# Model (cm): three spur-gears in a row (16, 20 and 28 teeth, module 0.8) in mesh, the middle one turned clockwise (the one driven joint, 20 turns a minute); the small and the large are turned the other way by its teeth.
# Each carries a crank-wrist (2.3, 3.0 and 3.6 cm out). A rod from the small gear's wrist goes to one end of the upper lever, which swings on a stem that slides up and down in a guide; the other end of that lever is the pivot of the lower lever, whose two ends are
# joined by rods to the wrists of the middle and the large gears. The stem takes up all three cranks at once, so its motion is the more complex one: the gears' speeds are not simple multiples and the stroke never repeats within a turn.
# There is no gravity (a plan on the bench). Generator: opencode-runs/batch9/gen125.py.
number: 125
slug: three-spur-gears-wrists-whiffletree
name: Three spur-gears with crank-wrists working a lever-stem
brown: "A modification of the motion shown in 122, but of a more complex character."
units: cm
sim:
  timestep: 0.0002
  integrator: implicitfast
  iterations: 100
  solver: PGS
  multiccd: true
  duration_s: 12.0
  gravity: 0
  floor: false
bodies:
  - id: gear_m
    shape: part
    pos: [14.4, 0, 0.0]
    density: 7800
    friction: 0.1
    color: "#d9cfb6"
    pieces:
      - {kind: disc, center: [14.4, 0.0], radius: 7.15, inner: 6.2, y: [-0.6, 0.6]}
      - {kind: disc, center: [14.4, 0.0], radius: 1.4, inner: 0.6, y: [-0.6, 0.6]}
      - {kind: poly, points: [[15.7306, 0.0976], [20.4117, 1.5456], [20.2344, 2.1188], [15.5533, 0.6708]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[14.7184, 1.2956], [14.7878, 6.1951], [14.1878, 6.2036], [14.1184, 1.3041]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[13.2662, 0.7032], [8.6279, 2.2832], [8.4344, 1.7152], [13.0727, 0.1352]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[13.3809, -0.861], [10.4449, -4.784], [10.9253, -5.1436], [13.8612, -1.2206]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[14.904, -1.2353], [17.7277, -5.2399], [18.2181, -4.8941], [15.3943, -0.8896]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[15.2441, 7.2], [13.5559, 7.2], [14.0509, 8.56], [14.7491, 8.56]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[12.9779, 7.1084], [11.3723, 6.5868], [11.4228, 8.0332], [12.0868, 8.2489]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[10.8508, 6.3211], [9.4851, 5.3288], [9.0861, 6.72], [9.651, 7.1304]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[9.0712, 4.9149], [8.0789, 3.5492], [7.2696, 4.749], [7.68, 5.3139]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[7.8132, 3.0277], [7.2916, 1.4221], [6.1511, 2.3132], [6.3668, 2.9772]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[7.2, 0.8441], [7.2, -0.8441], [5.84, -0.3491], [5.84, 0.3491]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[7.2916, -1.4221], [7.8132, -3.0277], [6.3668, -2.9772], [6.1511, -2.3132]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[8.0789, -3.5492], [9.0712, -4.9149], [7.68, -5.3139], [7.2696, -4.749]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[9.4851, -5.3288], [10.8508, -6.3211], [9.651, -7.1304], [9.0861, -6.72]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[11.3723, -6.5868], [12.9779, -7.1084], [12.0868, -8.2489], [11.4228, -8.0332]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[13.5559, -7.2], [15.2441, -7.2], [14.7491, -8.56], [14.0509, -8.56]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[15.8221, -7.1084], [17.4277, -6.5868], [17.3772, -8.0332], [16.7132, -8.2489]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[17.9492, -6.3211], [19.3149, -5.3288], [19.7139, -6.72], [19.149, -7.1304]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[19.7288, -4.9149], [20.7211, -3.5492], [21.5304, -4.749], [21.12, -5.3139]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[20.9868, -3.0277], [21.5084, -1.4221], [22.6489, -2.3132], [22.4332, -2.9772]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[21.6, -0.8441], [21.6, 0.8441], [22.96, 0.3491], [22.96, -0.3491]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[21.5084, 1.4221], [20.9868, 3.0277], [22.4332, 2.9772], [22.6489, 2.3132]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[20.7211, 3.5492], [19.7288, 4.9149], [21.12, 5.3139], [21.5304, 4.749]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[19.3149, 5.3288], [17.9492, 6.3211], [19.149, 7.1304], [19.7139, 6.72]], y: [-0.6, 0.6], collide: 1}
      - {kind: poly, points: [[17.4277, 6.5868], [15.8221, 7.1084], [16.7132, 8.2489], [17.3772, 8.0332]], y: [-0.6, 0.6], collide: 1}
      - {kind: rod, from: [15.4261, -1.6, 2.8191], to: [15.4261, -0.5, 2.8191], radius: 0.4, collide: 0, color: "#8f8a80"}   # the crank-wrist
  - id: gear_s
    shape: part
    pos: [0.0, 0, 0.0]
    density: 7800
    friction: 0.1
    color: "#d0c6ac"
    pieces:
      - {kind: disc, center: [0.0, 0.0], radius: 5.55, inner: 4.6, y: [-0.6, 0.6]}
      - {kind: disc, center: [0.0, 0.0], radius: 1.4, inner: 0.6, y: [-0.6, 0.6]}
      - {kind: poly, points: [[1.3306, 0.0976], [4.4832, 1.0728], [4.3059, 1.646], [1.1533, 0.6708]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[0.3184, 1.2956], [0.3651, 4.5953], [-0.2348, 4.6038], [-0.2816, 1.3041]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[-1.1338, 0.7032], [-4.2576, 1.7673], [-4.451, 1.1993], [-1.3273, 0.1352]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[-1.0191, -0.861], [-2.9964, -3.5031], [-2.516, -3.8626], [-0.5388, -1.2206]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[0.504, -1.2353], [2.4057, -3.9323], [2.896, -3.5865], [0.9943, -0.8896]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[-0.2646, 5.6571], [-1.9204, 5.3277], [-1.7002, 6.7582], [-1.0154, 6.8944]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[-2.4094, 5.1252], [-3.813, 4.1873], [-4.157, 5.5931], [-3.5765, 5.981]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[-4.1873, 3.813], [-5.1252, 2.4094], [-5.981, 3.5765], [-5.5931, 4.157]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[-5.3277, 1.9204], [-5.6571, 0.2646], [-6.8944, 1.0154], [-6.7582, 1.7002]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[-5.6571, -0.2646], [-5.3277, -1.9204], [-6.7582, -1.7002], [-6.8944, -1.0154]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[-5.1252, -2.4094], [-4.1873, -3.813], [-5.5931, -4.157], [-5.981, -3.5765]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[-3.813, -4.1873], [-2.4094, -5.1252], [-3.5765, -5.981], [-4.157, -5.5931]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[-1.9204, -5.3277], [-0.2646, -5.6571], [-1.0154, -6.8944], [-1.7002, -6.7582]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[0.2646, -5.6571], [1.9204, -5.3277], [1.7002, -6.7582], [1.0154, -6.8944]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[2.4094, -5.1252], [3.813, -4.1873], [4.157, -5.5931], [3.5765, -5.981]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[4.1873, -3.813], [5.1252, -2.4094], [5.981, -3.5765], [5.5931, -4.157]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[5.3277, -1.9204], [5.6571, -0.2646], [6.8944, -1.0154], [6.7582, -1.7002]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[5.6571, 0.2646], [5.3277, 1.9204], [6.7582, 1.7002], [6.8944, 1.0154]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[5.1252, 2.4094], [4.1873, 3.813], [5.5931, 4.157], [5.981, 3.5765]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[3.813, 4.1873], [2.4094, 5.1252], [3.5765, 5.981], [4.157, 5.5931]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[1.9204, 5.3277], [0.2646, 5.6571], [1.0154, 6.8944], [1.7002, 6.7582]], y: [-0.6, 0.6], collide: 2}
      - {kind: rod, from: [-1.7619, -1.6, 1.4784], to: [-1.7619, -0.5, 1.4784], radius: 0.4, collide: 0, color: "#8f8a80"}   # the crank-wrist
  - id: gear_l
    shape: part
    pos: [33.6, 0, 0.0]
    density: 7800
    friction: 0.1
    color: "#d0c6ac"
    pieces:
      - {kind: disc, center: [33.6, 0.0], radius: 10.35, inner: 9.4, y: [-0.6, 0.6]}
      - {kind: disc, center: [33.6, 0.0], radius: 1.4, inner: 0.6, y: [-0.6, 0.6]}
      - {kind: poly, points: [[34.9306, 0.0976], [42.6688, 2.4913], [42.4915, 3.0645], [34.7533, 0.6708]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[34.1808, 1.2011], [35.9769, 9.0995], [35.3918, 9.2325], [33.5957, 1.3342]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[32.8502, 1.1035], [26.9081, 6.6082], [26.5003, 6.168], [32.4424, 0.6634]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[32.2694, -0.0976], [24.5312, -2.4913], [24.7085, -3.0645], [32.4467, -0.6708]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[33.0192, -1.2011], [31.2231, -9.0995], [31.8082, -9.2325], [33.6043, -1.3342]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[34.3498, -1.1035], [40.2919, -6.6082], [40.6997, -6.168], [34.7576, -0.6634]], y: [-0.5, 0.5]}
      - {kind: poly, points: [[33.2744, 10.4291], [31.5968, 10.2401], [31.9364, 11.647], [32.6302, 11.7251]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[30.9618, 10.0952], [29.3684, 9.5376], [29.3864, 10.9848], [30.0454, 11.2154]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[28.7816, 9.255], [27.3521, 8.3568], [27.0477, 9.7717], [27.6389, 10.1432]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[26.843, 7.9508], [25.6492, 6.757], [25.0376, 8.0687], [25.5313, 8.5624]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[25.2432, 6.2479], [24.345, 4.8184], [23.4568, 5.9611], [23.8283, 6.5523]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[24.0624, 4.2316], [23.5048, 2.6382], [22.3846, 3.5546], [22.6152, 4.2136]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[23.3599, 2.0032], [23.1709, 0.3256], [21.8749, 0.9698], [21.953, 1.6636]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[23.1709, -0.3256], [23.3599, -2.0032], [21.953, -1.6636], [21.8749, -0.9698]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[23.5048, -2.6382], [24.0624, -4.2316], [22.6152, -4.2136], [22.3846, -3.5546]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[24.345, -4.8184], [25.2432, -6.2479], [23.8283, -6.5523], [23.4568, -5.9611]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[25.6492, -6.757], [26.843, -7.9508], [25.5313, -8.5624], [25.0376, -8.0687]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[27.3521, -8.3568], [28.7816, -9.255], [27.6389, -10.1432], [27.0477, -9.7717]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[29.3684, -9.5376], [30.9618, -10.0952], [30.0454, -11.2154], [29.3864, -10.9848]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[31.5968, -10.2401], [33.2744, -10.4291], [32.6302, -11.7251], [31.9364, -11.647]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[33.9256, -10.4291], [35.6032, -10.2401], [35.2636, -11.647], [34.5698, -11.7251]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[36.2382, -10.0952], [37.8316, -9.5376], [37.8136, -10.9848], [37.1546, -11.2154]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[38.4184, -9.255], [39.8479, -8.3568], [40.1523, -9.7717], [39.5611, -10.1432]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[40.357, -7.9508], [41.5508, -6.757], [42.1624, -8.0687], [41.6687, -8.5624]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[41.9568, -6.2479], [42.855, -4.8184], [43.7432, -5.9611], [43.3717, -6.5523]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[43.1376, -4.2316], [43.6952, -2.6382], [44.8154, -3.5546], [44.5848, -4.2136]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[43.8401, -2.0032], [44.0291, -0.3256], [45.3251, -0.9698], [45.247, -1.6636]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[44.0291, 0.3256], [43.8401, 2.0032], [45.247, 1.6636], [45.3251, 0.9698]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[43.6952, 2.6382], [43.1376, 4.2316], [44.5848, 4.2136], [44.8154, 3.5546]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[42.855, 4.8184], [41.9568, 6.2479], [43.3717, 6.5523], [43.7432, 5.9611]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[41.5508, 6.757], [40.357, 7.9508], [41.6687, 8.5624], [42.1624, 8.0687]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[39.8479, 8.3568], [38.4184, 9.255], [39.5611, 10.1432], [40.1523, 9.7717]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[37.8316, 9.5376], [36.2382, 10.0952], [37.1546, 11.2154], [37.8136, 10.9848]], y: [-0.6, 0.6], collide: 2}
      - {kind: poly, points: [[35.6032, 10.2401], [33.9256, 10.4291], [34.5698, 11.7251], [35.2636, 11.647]], y: [-0.6, 0.6], collide: 2}
      - {kind: rod, from: [35.914, -1.6, 2.7578], to: [35.914, -0.5, 2.7578], radius: 0.4, collide: 0, color: "#8f8a80"}   # the crank-wrist
  - id: rod_1
    shape: part
    pos: [-1.7619, 0, 1.4784]
    mount: gear_s
    mass: 0.2
    color: "#b8ad97"
    pieces:
      - {kind: disc, center: [-1.7619, 1.4784], radius: 0.8, inner: 0.3, y: [-1.5, -0.9]}
      - {kind: poly, points: [[-2.1613, 1.5001], [-0.3994, 34.0216], [0.3994, 33.9784], [-1.3625, 1.4568]], y: [-1.5, -0.9]}
      - {kind: disc, center: [0.0, 34.0], radius: 0.7, inner: 0.3, y: [-1.5, -0.9]}
  - id: rod_2
    shape: part
    pos: [15.4261, 0, 2.8191]
    mount: gear_m
    mass: 0.2
    color: "#b8ad97"
    pieces:
      - {kind: disc, center: [15.4261, 2.8191], radius: 0.8, inner: 0.3, y: [-1.5, -0.9]}
      - {kind: poly, points: [[15.0263, 2.804], [14.0003, 29.9849], [14.7997, 30.0151], [15.8258, 2.8342]], y: [-1.5, -0.9]}
      - {kind: disc, center: [14.4, 30.0], radius: 0.7, inner: 0.3, y: [-1.5, -0.9]}
  - id: rod_3
    shape: part
    pos: [35.914, 0, 2.7578]
    mount: gear_l
    mass: 0.2
    color: "#b8ad97"
    pieces:
      - {kind: disc, center: [35.914, 2.7578], radius: 0.8, inner: 0.3, y: [-1.5, -0.9]}
      - {kind: poly, points: [[35.5155, 2.7239], [33.2014, 29.9661], [33.9986, 30.0339], [36.3126, 2.7916]], y: [-1.5, -0.9]}
      - {kind: disc, center: [33.6, 30.0], radius: 0.7, inner: 0.3, y: [-1.5, -0.9]}
  - id: stem
    shape: part
    pos: [12.0, 0, 34.0]
    mass: 0.5
    color: "#9a8c74"
    pieces:
      - {kind: poly, points: [[11.1, 34.0], [12.9, 34.0], [12.9, 41.0], [11.1, 41.0]], y: [-2.3, -1.7]}   # the stem
      - {kind: disc, center: [12.0, 34.0], radius: 1.2, inner: 0.3, y: [-2.3, -1.7]}
  - id: lever_1
    shape: part
    pos: [12.0, 0, 34.0]
    mount: stem
    mass: 0.3
    color: "#a89d89"
    pieces:
      - {kind: poly, points: [[0.0, 33.4], [24.0, 33.4], [24.0, 34.6], [0.0, 34.6]], y: [-1.6, -1.0]}
      - {kind: disc, center: [0.0, 34.0], radius: 0.8, inner: 0.3, y: [-1.6, -1.0]}
      - {kind: disc, center: [24.0, 34.0], radius: 0.8, inner: 0.3, y: [-1.6, -1.0]}
      - {kind: rod, from: [12.0, -1.7, 34.0], to: [12.0, -0.8, 34.0], radius: 0.3, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [0.0, -1.7, 34.0], to: [0.0, -0.8, 34.0], radius: 0.3, collide: 0, color: "#8f8a80"}
  - id: lever_2
    shape: part
    pos: [24.0, 0, 34.0]
    mount: lever_1
    mass: 0.3
    color: "#a89d89"
    pieces:
      - {kind: poly, points: [[23.5, 30.0], [24.5, 30.0], [24.5, 34.0], [23.5, 34.0]], y: [-1.6, -1.0]}   # the drop to the lower lever
      - {kind: poly, points: [[14.4, 29.4], [33.6, 29.4], [33.6, 30.6], [14.4, 30.6]], y: [-1.6, -1.0]}
      - {kind: rod, from: [24.0, -1.7, 34.0], to: [24.0, -0.8, 34.0], radius: 0.3, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [14.4, -1.7, 30.0], to: [14.4, -0.8, 30.0], radius: 0.3, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [33.6, -1.7, 30.0], to: [33.6, -0.8, 30.0], radius: 0.3, collide: 0, color: "#8f8a80"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: rod, from: [0.0, 0.6, 0], to: [0.0, 2.0, 0], radius: 0.6, color: "#8f8a80"}
      - {kind: rod, from: [14.4, 0.6, 0], to: [14.4, 2.0, 0], radius: 0.6, color: "#8f8a80"}
      - {kind: rod, from: [33.6, 0.6, 0], to: [33.6, 2.0, 0], radius: 0.6, color: "#8f8a80"}
      - {kind: poly, points: [[0.0, -1.0], [33.6, -1.0], [33.6, 1.0], [0.0, 1.0]], y: [1.4, 2.2]}   # the standard of the three shafts
      - {kind: poly, points: [[9.8, 31.0], [10.9, 31.0], [10.9, 43.0], [9.8, 43.0]], y: [-3.0, -1.4]}   # the guide of the stem
      - {kind: poly, points: [[13.1, 31.0], [14.2, 31.0], [14.2, 43.0], [13.1, 43.0]], y: [-3.0, -1.4]}
joints:
  - {id: j_m, type: hinge, body: gear_m, axis: [0, 1, 0], damping: 0.002}   # the one driven joint; + : clockwise
  - {id: j_s, type: hinge, body: gear_s, axis: [0, 1, 0], damping: 0.002}
  - {id: j_l, type: hinge, body: gear_l, axis: [0, 1, 0], damping: 0.002}
  - {id: j_r1, type: hinge, body: rod_1, axis: [0, 1, 0], damping: 0.001}
  - {id: j_r2, type: hinge, body: rod_2, axis: [0, 1, 0], damping: 0.001}
  - {id: j_r3, type: hinge, body: rod_3, axis: [0, 1, 0], damping: 0.001}
  - {id: j_z, type: slide, body: stem, axis: [0, 0, 1], damping: 0.05}   # the stem; + : up
  - {id: j_a, type: hinge, body: lever_1, axis: [0, 1, 0], damping: 0.001}
  - {id: j_b, type: hinge, body: lever_2, axis: [0, 1, 0], damping: 0.001}
pins:
  - {id: pin_1, a: rod_1, b: lever_1, at: [0.0, 0, 34.0]}
  - {id: pin_2, a: rod_2, b: lever_2, at: [14.4, 0, 30.0]}
  - {id: pin_3, a: rod_3, b: lever_2, at: [33.6, 0, 30.0]}
contact: {solref: [0.002, 1.0], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_m, kind: velocity, rpm: 20.0, kv: 1.0, max_torque: 20.0}
checks:
  - {type: follow, out: j_s, in: j_m, expect: -1.25, tol: 0.02, min_r2: 0.999, settle_s: 1.0, window_s: 6}   # the small gear, 20/16, the other way
  - {type: follow, out: j_l, in: j_m, expect: -0.7143, tol: 0.012, min_r2: 0.999, settle_s: 1.0, window_s: 6}   # the large gear, 20/28, the other way
  - {type: follow, out: j_z, in: j_m, expect: 0.0117, tol: 0.0007, min_r2: 0.98, settle_s: 1.5, window_s: 0.3333}   # the stem rising
  - {type: follow, out: j_z, in: j_m, expect: -0.0111, tol: 0.0007, min_r2: 0.98, settle_s: 2.5, window_s: 0.3333}   # then falling
  - {type: follow, out: j_z, in: j_m, expect: 0.0206, tol: 0.001, min_r2: 0.98, settle_s: 8.5, window_s: 0.3333}   # in the fourth turn, rising faster
  - {type: follow, out: j_z, in: j_m, expect: -0.0233, tol: 0.001, min_r2: 0.98, settle_s: 9.5, window_s: 0.3333}   # and falling faster: the stroke never repeats
  - {type: position, joint: j_z, min: -5.0, max: 0.8, settle_s: 0.0, window_s: 11}   # the stroke: about 5 cm
camera: {target: [14.8, 0, 12.0], position: [14.8, -108.0, 12.0], fov: 34}
display:
  output: j_z
  labels: {j_m: "Middle gear (driver)", j_s: "Small gear", j_l: "Large gear", j_z: "Lever stem"}
  proof: {label: "Gear teeth out of contact", sub: "the middle gear turns but the others and the stem stand"}

