# No. 411 (Brown 1868): "Self-recording level for surveyors. Consists of a carriage, the shape of which is governed by an isosceles triangle having
# horizontal base. The circumference of each wheel equals the base of the triangle. A pendulum, when the instrument is on level ground, bisects the
# base, and when on an inclination gravitates to right or left from center accordingly. A drum, rotated by gearing from one of the carriage wheels,
# carries sectionally ruled paper, upon which pencil on pendulum traces profile corresponding with that of ground traveled over. ..."
#
# Model (cm, gravity on, side view). The carriage stands on two wheels of radius 5, their axles 31.42 apart (the triangle's base equals a wheel's
# circumference). The surveyor's hands push it to and fro along the ground, 18 cm either way at 0.05 Hz (the one driven joint, a slide along the
# level); the carriage is otherwise free to rise and tilt, so it rides on its wheels over the ground: level, then a rise of 15 deg. The wheels roll
# by friction. Sixteen pegs standing out from the hind wheel's face turn an eight-leaved pinion on the drum's shaft (real contact), so the drum turns
# twice for each turn of the wheel. The pendulum hangs free on its pivot at the top of the frame and keeps upright, so against the carriage it swings
# out as far as the carriage tilts; its pencil lies against the drum. Generator: opencode-runs/batch13/gen411.py.
number: 411
slug: self-recording-level
name: Self-recording level for surveyors
brown: "Self-recording level for surveyors. Consists of a carriage, the shape of which is governed by an isosceles triangle having horizontal base. The circumference of each wheel equals the base of the triangle. A pendulum, when the instrument is on level ground, bisects the base, and when on an inclination gravitates to right or left from center accordingly. A drum, rotated by gearing from one of the carriage wheels, carries sectionally ruled paper, upon which pencil on pendulum traces profile corresponding with that of ground traveled over. The drum can be shifted vertically to accord with any given scale, and horizontally, to avoid removal of filled paper."
units: cm
sim: {timestep: 0.0001, integrator: implicitfast, iterations: 60, duration_s: 60, floor: false}
bodies:
  - id: ground
    shape: part
    pos: [0, 0, 0]
    fixed: true
    friction: 1.0
    color: "#b9ad8f"
    pieces:
      - {kind: poly, points: [[-50.0, -4], [16.5, -4], [16.5, 0], [-50.0, 0]], y: [-4, 6], collide: 1, color: "#b9ad8f"}   # the level ground
      - {kind: poly, points: [[16.5, -4], [48.0, -4], [48.0, 8.4404], [16.5, 0]], y: [-4, 6], collide: 1, color: "#b9ad8f"}   # the rise
  - {id: car_x, shape: part, pos: [0, 0, 5], mass: 0.3, pieces: [{kind: rod, from: [-24.708, -3, 12.1036], to: [-21.708, -3, 12.1036], radius: 0.6, color: "#8a6a48"}]}   # the surveyor's hands on the handle
  - {id: car_z, shape: part, pos: [0, 0, 5], mount: car_x, mass: 0.05, pieces: [{kind: rod, from: [0, -6, 5], to: [0, -5.95, 5], radius: 0.05}]}
  - id: carriage
    shape: part
    pos: [0, 0, 5]
    mount: car_z
    mass: 0.8
    color: "#b48a55"
    pieces:
      - {kind: band, center: [0.0, -4.0], r: [17.7036, 18.5036], a: [0.5203, 2.6213], y: [-1.6, -1.0], slices: 24, color: "#b48a55"}
      - {kind: band, center: [0.0, -4.0], r: [17.7036, 18.5036], a: [0.5203, 2.6213], y: [3.6, 4.2], slices: 24, color: "#b48a55"}
      - {kind: rod, from: [-15.708, -1.8, 5.0], to: [-15.168, -1.8, 5.6435], radius: 0.07, color: "#3a3632"}   # Brown's isosceles triangle (dotted): its base, axle to axle, equals a wheel's circumference
      - {kind: rod, from: [-14.7262, -1.8, 6.17], to: [-14.1863, -1.8, 6.8135], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-13.7445, -1.8, 7.34], to: [-13.2045, -1.8, 7.9835], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-12.7627, -1.8, 8.51], to: [-12.2228, -1.8, 9.1535], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-11.781, -1.8, 9.68], to: [-11.241, -1.8, 10.3235], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-10.7992, -1.8, 10.85], to: [-10.2593, -1.8, 11.4935], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-9.8175, -1.8, 12.02], to: [-9.2775, -1.8, 12.6635], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-8.8357, -1.8, 13.19], to: [-8.2958, -1.8, 13.8335], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-7.854, -1.8, 14.36], to: [-7.314, -1.8, 15.0035], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-6.8722, -1.8, 15.53], to: [-6.3323, -1.8, 16.1735], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-5.8905, -1.8, 16.7], to: [-5.3505, -1.8, 17.3435], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-4.9087, -1.8, 17.87], to: [-4.3688, -1.8, 18.5135], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-3.927, -1.8, 19.04], to: [-3.387, -1.8, 19.6835], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-2.9452, -1.8, 20.21], to: [-2.4053, -1.8, 20.8535], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-1.9635, -1.8, 21.38], to: [-1.4235, -1.8, 22.0235], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-0.9817, -1.8, 22.55], to: [-0.4418, -1.8, 23.1935], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [15.708, -1.8, 5.0], to: [15.168, -1.8, 5.6435], radius: 0.07, color: "#3a3632"}   # Brown's isosceles triangle (dotted): its base, axle to axle, equals a wheel's circumference
      - {kind: rod, from: [14.7262, -1.8, 6.17], to: [14.1863, -1.8, 6.8135], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [13.7445, -1.8, 7.34], to: [13.2045, -1.8, 7.9835], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [12.7627, -1.8, 8.51], to: [12.2228, -1.8, 9.1535], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [11.781, -1.8, 9.68], to: [11.241, -1.8, 10.3235], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [10.7992, -1.8, 10.85], to: [10.2593, -1.8, 11.4935], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [9.8175, -1.8, 12.02], to: [9.2775, -1.8, 12.6635], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [8.8357, -1.8, 13.19], to: [8.2958, -1.8, 13.8335], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [7.854, -1.8, 14.36], to: [7.314, -1.8, 15.0035], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [6.8722, -1.8, 15.53], to: [6.3323, -1.8, 16.1735], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [5.8905, -1.8, 16.7], to: [5.3505, -1.8, 17.3435], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [4.9087, -1.8, 17.87], to: [4.3688, -1.8, 18.5135], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [3.927, -1.8, 19.04], to: [3.387, -1.8, 19.6835], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [2.9452, -1.8, 20.21], to: [2.4053, -1.8, 20.8535], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [1.9635, -1.8, 21.38], to: [1.4235, -1.8, 22.0235], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [0.9817, -1.8, 22.55], to: [0.4418, -1.8, 23.1935], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-15.708, -1.8, 5.0], to: [-14.844, -1.8, 5.0], radius: 0.07, color: "#3a3632"}   # Brown's isosceles triangle (dotted): its base, axle to axle, equals a wheel's circumference
      - {kind: rod, from: [-14.1372, -1.8, 5.0], to: [-13.2732, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-12.5664, -1.8, 5.0], to: [-11.7024, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-10.9956, -1.8, 5.0], to: [-10.1316, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-9.4248, -1.8, 5.0], to: [-8.5608, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-7.854, -1.8, 5.0], to: [-6.99, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-6.2832, -1.8, 5.0], to: [-5.4192, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-4.7124, -1.8, 5.0], to: [-3.8485, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-3.1416, -1.8, 5.0], to: [-2.2777, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-1.5708, -1.8, 5.0], to: [-0.7069, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [0.0, -1.8, 5.0], to: [0.8639, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [1.5708, -1.8, 5.0], to: [2.4347, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [3.1416, -1.8, 5.0], to: [4.0055, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [4.7124, -1.8, 5.0], to: [5.5763, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [6.2832, -1.8, 5.0], to: [7.1471, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [7.854, -1.8, 5.0], to: [8.7179, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [9.4248, -1.8, 5.0], to: [10.2887, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [10.9956, -1.8, 5.0], to: [11.8595, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [12.5664, -1.8, 5.0], to: [13.4303, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [14.1372, -1.8, 5.0], to: [15.0011, -1.8, 5.0], radius: 0.07, color: "#3a3632"}
      - {kind: rod, from: [-15.708, -1.3, 5], to: [-15.708, 3.9, 5], radius: 0.35, color: "#8f8a80"}   # the axles
      - {kind: rod, from: [15.708, -1.3, 5], to: [15.708, 3.9, 5], radius: 0.35, color: "#8f8a80"}
      - {kind: rod, from: [-14.708, -1.3, 3.4], to: [14.708, -1.3, 3.4], radius: 0.3}   # the lower rail
      - {kind: rod, from: [-17.208, -1.3, 9.9036], to: [-22.708, -3, 12.1036], radius: 0.45}   # the handle's arm
      - {kind: rod, from: [-12.908, 3.42, 5], to: [8.5, 3.42, 5], radius: 0.12, color: "#8f8a80"}
      - {kind: rod, from: [0, -1.6, 14.1], to: [0, 4.2, 14.1], radius: 0.3, color: "#8f8a80"}   # the pendulum's pivot, at the top of the frame
  - id: wheel_h
    shape: part
    pos: [-15.708, 0, 5]
    mount: carriage
    mass: 0.15
    friction: 1.0
    color: "#6b5a44"
    pieces:
      - {kind: band, center: [-15.708, 5.0], r: [4.4, 5], a: [0, 6.2832], y: [-0.6, 0.6], slices: 48, collide: 2, color: "#6b5a44"}   # the tyre, running on the ground
      - {kind: disc, center: [-15.708, 5.0], radius: 0.9, y: [-0.8, 0.8], color: "#6b5a44"}
      - {kind: rod, from: [-14.9437, 0, 5.2364], to: [-11.4089, 0, 6.3298], radius: 0.25, color: "#6b5a44"}
      - {kind: rod, from: [-15.6966, 0, 5.7999], to: [-15.6442, 0, 9.4995], radius: 0.25, color: "#6b5a44"}
      - {kind: rod, from: [-16.4652, 0, 5.258], to: [-19.9676, 0, 6.451], radius: 0.25, color: "#6b5a44"}
      - {kind: rod, from: [-16.1873, 0, 4.3595], to: [-18.4043, 0, 1.3972], radius: 0.25, color: "#6b5a44"}
      - {kind: rod, from: [-15.2469, 0, 4.3462], to: [-13.1147, 0, 1.3223], radius: 0.25, color: "#6b5a44"}
  - id: crown
    shape: part
    pos: [-15.708, 0, 5]
    mount: wheel_h
    mass: 0.02
    color: "#a08a5c"
    pieces:
      - {kind: rod, from: [-11.981, 0.6, 5.7413], to: [-11.981, 2, 5.7413], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}   # the pegs (crown teeth) on the hind wheel
      - {kind: rod, from: [-12.5484, 0.6, 7.1112], to: [-12.5484, 2, 7.1112], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-13.5968, 0.6, 8.1596], to: [-13.5968, 2, 8.1596], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-14.9666, 0.6, 8.727], to: [-14.9666, 2, 8.727], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-16.4493, 0.6, 8.727], to: [-16.4493, 2, 8.727], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-17.8191, 0.6, 8.1596], to: [-17.8191, 2, 8.1596], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-18.8675, 0.6, 7.1112], to: [-18.8675, 2, 7.1112], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-19.4349, 0.6, 5.7413], to: [-19.4349, 2, 5.7413], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-19.4349, 0.6, 4.2587], to: [-19.4349, 2, 4.2587], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-18.8675, 0.6, 2.8888], to: [-18.8675, 2, 2.8888], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-17.8191, 0.6, 1.8404], to: [-17.8191, 2, 1.8404], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-16.4493, 0.6, 1.273], to: [-16.4493, 2, 1.273], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-14.9666, 0.6, 1.273], to: [-14.9666, 2, 1.273], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-13.5968, 0.6, 1.8404], to: [-13.5968, 2, 1.8404], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-12.5484, 0.6, 2.8888], to: [-12.5484, 2, 2.8888], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
      - {kind: rod, from: [-11.981, 0.6, 4.2587], to: [-11.981, 2, 4.2587], radius: 0.22, capsule: true, collide: 2, color: "#a08a5c"}
  - id: wheel_f
    shape: part
    pos: [15.708, 0, 5]
    mount: carriage
    mass: 0.15
    friction: 1.0
    color: "#6b5a44"
    pieces:
      - {kind: band, center: [15.708, 5.0], r: [4.4, 5], a: [0, 6.2832], y: [-0.6, 0.6], slices: 48, collide: 2, color: "#6b5a44"}   # the tyre, running on the ground
      - {kind: disc, center: [15.708, 5.0], radius: 0.9, y: [-0.8, 0.8], color: "#6b5a44"}
      - {kind: rod, from: [16.4722, 0, 5.2364], to: [20.007, 0, 6.3298], radius: 0.25, color: "#6b5a44"}
      - {kind: rod, from: [15.7193, 0, 5.7999], to: [15.7717, 0, 9.4995], radius: 0.25, color: "#6b5a44"}
      - {kind: rod, from: [14.9507, 0, 5.258], to: [11.4483, 0, 6.451], radius: 0.25, color: "#6b5a44"}
      - {kind: rod, from: [15.2286, 0, 4.3595], to: [13.0116, 0, 1.3972], radius: 0.25, color: "#6b5a44"}
      - {kind: rod, from: [16.169, 0, 4.3462], to: [18.3012, 0, 1.3223], radius: 0.25, color: "#6b5a44"}
  - id: drum
    shape: part
    pos: [0, 3.42, 5]
    mount: carriage
    mass: 0.03
    color: "#efe6cf"
    pieces:
      - {kind: rod, from: [-7.0, 3.42, 5], to: [7.0, 3.42, 5], radius: 2.2, color: "#efe6cf"}   # the drum, its paper ruled in sections
      - {kind: rod, from: [-6.9, 5.63, 5.0], to: [6.9, 5.63, 5.0], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 5.3339, 6.105], to: [6.9, 5.3339, 6.105], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 4.525, 6.9139], to: [6.9, 4.525, 6.9139], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 3.42, 7.21], to: [6.9, 3.42, 7.21], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 2.315, 6.9139], to: [6.9, 2.315, 6.9139], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 1.5061, 6.105], to: [6.9, 1.5061, 6.105], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 1.21, 5.0], to: [6.9, 1.21, 5.0], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 1.5061, 3.895], to: [6.9, 1.5061, 3.895], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 2.315, 3.0861], to: [6.9, 2.315, 3.0861], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 3.42, 2.79], to: [6.9, 3.42, 2.79], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 4.525, 3.0861], to: [6.9, 4.525, 3.0861], radius: 0.03, color: "#7a6a58"}
      - {kind: rod, from: [-6.9, 5.3339, 3.895], to: [6.9, 5.3339, 3.895], radius: 0.03, color: "#7a6a58"}
      - {kind: loft, a: [[-12.458, 3.92, 4.87], [-12.458, 5.32, 4.87], [-12.458, 5.32, 5.13], [-12.458, 3.92, 5.13]], b: [[-11.358, 3.92, 4.87], [-11.358, 5.32, 4.87], [-11.358, 5.32, 5.13], [-11.358, 3.92, 5.13]], collide: 1, color: "#c9a865"}   # the pinion's leaves, on the drum's shaft
      - {kind: loft, a: [[-12.458, 3.8655, 5.2616], [-12.458, 4.8554, 6.2516], [-12.458, 4.6716, 6.4354], [-12.458, 3.6816, 5.4455]], b: [[-11.358, 3.8655, 5.2616], [-11.358, 4.8554, 6.2516], [-11.358, 4.6716, 6.4354], [-11.358, 3.6816, 5.4455]], collide: 1, color: "#c9a865"}
      - {kind: loft, a: [[-12.458, 3.55, 5.5], [-12.458, 3.55, 6.9], [-12.458, 3.29, 6.9], [-12.458, 3.29, 5.5]], b: [[-11.358, 3.55, 5.5], [-11.358, 3.55, 6.9], [-11.358, 3.29, 6.9], [-11.358, 3.29, 5.5]], collide: 1, color: "#c9a865"}
      - {kind: loft, a: [[-12.458, 3.1584, 5.4455], [-12.458, 2.1684, 6.4354], [-12.458, 1.9846, 6.2516], [-12.458, 2.9745, 5.2616]], b: [[-11.358, 3.1584, 5.4455], [-11.358, 2.1684, 6.4354], [-11.358, 1.9846, 6.2516], [-11.358, 2.9745, 5.2616]], collide: 1, color: "#c9a865"}
      - {kind: loft, a: [[-12.458, 2.92, 5.13], [-12.458, 1.52, 5.13], [-12.458, 1.52, 4.87], [-12.458, 2.92, 4.87]], b: [[-11.358, 2.92, 5.13], [-11.358, 1.52, 5.13], [-11.358, 1.52, 4.87], [-11.358, 2.92, 4.87]], collide: 1, color: "#c9a865"}
      - {kind: loft, a: [[-12.458, 2.9745, 4.7384], [-12.458, 1.9846, 3.7484], [-12.458, 2.1684, 3.5646], [-12.458, 3.1584, 4.5545]], b: [[-11.358, 2.9745, 4.7384], [-11.358, 1.9846, 3.7484], [-11.358, 2.1684, 3.5646], [-11.358, 3.1584, 4.5545]], collide: 1, color: "#c9a865"}
      - {kind: loft, a: [[-12.458, 3.29, 4.5], [-12.458, 3.29, 3.1], [-12.458, 3.55, 3.1], [-12.458, 3.55, 4.5]], b: [[-11.358, 3.29, 4.5], [-11.358, 3.29, 3.1], [-11.358, 3.55, 3.1], [-11.358, 3.55, 4.5]], collide: 1, color: "#c9a865"}
      - {kind: loft, a: [[-12.458, 3.6816, 4.5545], [-12.458, 4.6716, 3.5646], [-12.458, 4.8554, 3.7484], [-12.458, 3.8655, 4.7384]], b: [[-11.358, 3.6816, 4.5545], [-11.358, 4.6716, 3.5646], [-11.358, 4.8554, 3.7484], [-11.358, 3.8655, 4.7384]], collide: 1, color: "#c9a865"}
      - {kind: rod, from: [-12.508, 3.42, 5], to: [-11.308, 3.42, 5], radius: 0.5, color: "#c9a865"}
  - id: pend
    shape: part
    pos: [0, 0, 14.1]
    mount: carriage
    mass: 0.12
    color: "#a07850"
    pieces:
      - {kind: poly, points: [[-0.4, 15.1], [0.4, 15.1], [0.4, 4.6], [-0.4, 4.6]], y: [-1.0, -0.6]}   # the pendulum
      - {kind: disc, center: [0, 14.1], radius: 0.9, inner: 0.35, y: [-1.05, -0.55]}
      - {kind: poly, points: [[-1.4, 4.6], [1.4, 4.6], [1.4, 2.3], [-1.4, 2.3]], y: [-1.6, 0.0], density: 11000}   # its bob
      - {kind: rod, from: [0, -0.6, 5], to: [0, 1.17, 5], radius: 0.12, color: "#3a3632"}   # the pencil, against the drum
pins:
  - {id: pin_cr, a: crown, b: wheel_h, at: [-11.908, 0, 5]}   # the ring's screw
joints:
  - {id: j_x, type: slide, body: car_x, axis: [1, 0, 0], damping: 0.5}   # the one driven joint: the surveyor's push along the ground
  - {id: j_z, type: slide, body: car_z, axis: [0, 0, 1], damping: 0.5}   # the carriage rides up and down on its wheels
  - {id: j_t, type: hinge, body: carriage, axis: [0, -1, 0], damping: 0.05}   # and tilts with the ground (+ = nose up)
  - {id: j_wh, type: hinge, body: wheel_h, axis: [0, 1, 0], damping: 0.001}
  - {id: j_cr, type: hinge, body: crown, axis: [0, 1, 0]}   # the pegs' ring is screwed to the wheel (pin_cr)
  - {id: j_wf, type: hinge, body: wheel_f, axis: [0, 1, 0], damping: 0.001}
  - {id: j_d, type: hinge, body: drum, axis: [1, 0, 0], damping: 0.0005}
  - {id: j_p, type: hinge, body: pend, axis: [0, -1, 0], damping: 0.015}   # the pendulum on its pivot (+ = swung towards the front)
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_x, kind: velocity, rpm: 0, swing: {amplitude: 0.18, hz: 0.05}, kv: 200, max_torque: 50}
checks:
  - {type: follow, out: j_p, in: j_t, expect: -1, tol: 0.06, min_r2: 0.98, settle_s: 3.0, window_s: 57}   # the pendulum keeps upright: against the carriage it swings as far as the ground slopes
  - {type: follow, out: j_wh, in: j_x, expect: 20.0, tol: 0.4, min_r2: 0.999, settle_s: 3.0, window_s: 57}   # the hind wheel rolls on the level without slipping (tol 2%: as the carriage tilts its hind axle draws forward a little)
  - {type: follow, out: j_d, in: j_wh, expect: 2.0, tol: 0.05, min_r2: 0.995, settle_s: 3.0, window_s: 57}   # the drum turns twice for each turn of the wheel
  - {type: amplitude, joint: j_x, min: 0.072, max: 0.252, sustain: 0.7, settle_s: 0, window_s: 60}
camera: {target: [-2, 0, 2], position: [-2, -150, 2], fov: 22}
display:
  output: j_p
  labels: {j_x: "The surveyor's push (driver)", j_t: "The carriage's tilt", j_p: "The pendulum against the carriage", j_wh: "The hind wheel", j_d: "The drum"}
