# No. 87 (Brown 1868): see `brown`. Model (cm), on No. 53's bevels and double clutch: the upright bevel (the
# one driven joint) turns B and C (loose on the shaft) opposite ways; the clutch-box D slides on the shaft's
# feather and carries round pins either side that enter the jaws on B or C. A second pair of miter bevels at the
# shaft's end turns the wheel E about an upright spindle; a stud under E strikes the upper arm of the bell-crank
# G, whose short lower arm draws the connecting-rod and so tips the weighted lever F (pivoted under the shaft,
# its fork's pin in D's groove) back past the upright: F then falls over by its own weight against its stop and
# carries D into the other gear, so the shaft and E reverse, until the stud, coming round the other way,
# strikes G from the other side. F is built a hair (TH0) past the upright, so it falls at the start.
# Generator: opencode-runs/batch8/gen087.py.
number: 87
slug: self-reversing-weighted-lever
name: A self-reversing motion by a stud and a weighted lever
brown: A contrivance for a self-reversing motion. The bevel-gear between the gears, B and C, is the driver. The gears, B and C, run loose upon the shaft, consequently motion is only communicated when one or other of them is engaged with the clutch-box, D, which slides on a feather on the shaft and is shown in gear with C. The wheel, E, at the right, is driven by bevel-gearing from the shaft on which
  the gears, B, C, and clutch are placed, and is about to strike the bell-crank, G, and produce such a movement thereof as will cause the connecting-rod to carry the weighted lever, F, beyond a perpendicular position, when the said lever will fall over suddenly to the left, and carry the clutch into gear with B, thereby reversing the motion of the shaft, until the stud in the wheel, E, coming round
  in the contrary direction, brings the weighted lever back past the perpendicular position, and thereby again causes it to reverse the motion.
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 100, solver: PGS, multiccd: true, duration_s: 20.0, floor: false}
bodies:
- id: gearA
  shape: part
  pos: [0, 0, 0]
  density: 7800
  friction: 0.15
  color: '#e8dec6'
  pieces:
  - {kind: disc, center: [0, 0], radius: 3.6, inner: 0.7, y: [3.2, 4.6]}
  - {kind: disc, center: [0, 0], radius: 1.4, inner: 0.7, y: [4.6, 7.4]}
  - {kind: loft, a: [[1.4362, 3.4, -0.4328], [1.4362, 2.6, -0.4328], [1.3508, 2.4, 0.6522], [0.5543, 2.6, 1.3938], [0.5543, 3.4, 1.3938]], b: [[2.7055, 3.4, -1.2963], [2.7055, 2.6, -1.2963], [2.7016, 2.4, 1.3044], [0.6675, 2.6, 2.9248], [0.6675, 3.4, 2.9248]], collide: 1}
  - {kind: loft, a: [[-0.3433, 3.4, 1.4602], [-0.3433, 2.6, 1.4602], [-1.2402, 2.4, 0.8437], [-1.4842, 2.6, -0.2169], [-1.4842, 3.4, -0.2169]], b: [[-0.2301, 3.4, 2.9912], [-0.2301, 2.6, 2.9912], [-2.4804, 2.4, 1.6875], [-2.8667, 2.6, -0.8844], [-2.8667, 3.4, -0.8844]], collide: 1}
  - {kind: loft, a: [[-1.0929, 3.4, -1.0274], [-1.0929, 2.6, -1.0274], [-0.1106, 2.4, -1.4959], [0.93, 2.6, -1.1769], [0.93, 3.4, -1.1769]], b: [[-2.4754, 3.4, -1.6948], [-2.4754, 2.6, -1.6948], [-0.2212, 2.4, -2.9918], [2.1992, 2.6, -2.0404], [2.1992, 3.4, -2.0404]], collide: 1}
- id: gearB
  shape: part
  pos: [0, 0, 0]
  density: 7800
  friction: 0.15
  color: '#e2d8bf'
  pieces:
  - {kind: disc, center: [0, 0], radius: 3.6, inner: 0.7, y: [-4.6, -3.2]}
  - {kind: disc, center: [0, 0], radius: 1.4, inner: 0.7, y: [-7.4, -4.6]}
  - {kind: loft, a: [[0.1215, -3.4, -1.4951], [0.1215, -2.6, -1.4951], [1.1004, -2.4, -1.0194], [1.5, -2.6, -0.007], [1.5, -3.4, -0.007]], b: [[-0.2189, -3.4, -2.992], [-0.2189, -2.6, -2.992], [2.2008, -2.4, -2.0388], [2.9666, -2.6, 0.4466], [2.9666, -3.4, 0.4466]], collide: 1}
  - {kind: loft, a: [[1.234, -3.4, 0.8528], [1.234, -2.6, 0.8528], [0.3326, -2.4, 1.4627], [-0.7439, -2.6, 1.3025], [-0.7439, -3.4, 1.3025]], b: [[2.7006, -3.4, 1.3064], [2.7006, -2.6, 1.3064], [0.6652, -2.4, 2.9253], [-1.8701, -2.6, 2.3458], [-1.8701, -3.4, 2.3458]], collide: 1}
  - {kind: loft, a: [[-1.3555, -3.4, 0.6423], [-1.3555, -2.6, 0.6423], [-1.433, -2.4, -0.4433], [-0.7561, -2.6, -1.2955], [-0.7561, -3.4, -1.2955]], b: [[-2.4817, -3.4, 1.6856], [-2.4817, -2.6, 1.6856], [-2.866, -2.4, -0.8866], [-1.0965, -2.6, -2.7924], [-1.0965, -3.4, -2.7924]], collide: 1}
- id: shaft
  shape: part
  pos: [0, 0, 0]
  density: 7800
  color: '#d9cfb6'
  pieces:
  - {kind: rod, from: [0, -14, 0], to: [0, 15.0, 0], radius: 0.6, color: '#8f8a80'}
  - {kind: rod, from: [0, -2.6, 0.6], to: [0, 2.6, 0.6], radius: 0.18, color: '#6f6a60'}
- id: clutch
  shape: part
  pos: [0, 0, 0]
  mount: shaft
  density: 7800
  friction: 0.15
  color: '#d8ccb0'
  pieces:
  - {kind: disc, center: [0, 0], radius: 3.2, inner: 0.6, y: [1.0, 1.8]}
  - {kind: disc, center: [0, 0], radius: 3.2, inner: 0.6, y: [-1.8, -1.0]}
  - {kind: disc, center: [0, 0], radius: 1.4, inner: 0.6, y: [-1.0, 1.0]}
  - {kind: disc, center: [0, 0], radius: 2.4, y: [0.8, 1.0], collide: 2}
  - {kind: disc, center: [0, 0], radius: 2.4, y: [-1.0, -0.8], collide: 2}
  - {kind: rod, from: [-0.1187, 1.7, 1.4953], to: [-0.2374, 1.7, 2.9906], radius: 0.4, collide: 2, capsule: true}
  - {kind: rod, from: [-1.2356, 1.7, -0.8504], to: [-2.4712, 1.7, -1.7009], radius: 0.4, collide: 2, capsule: true}
  - {kind: rod, from: [1.3543, 1.7, -0.6449], to: [2.7086, 1.7, -1.2897], radius: 0.4, collide: 2, capsule: true}
  - {kind: rod, from: [-0.1187, -1.7, 1.4953], to: [-0.2374, -1.7, 2.9906], radius: 0.4, collide: 2, capsule: true}
  - {kind: rod, from: [-1.2356, -1.7, -0.8504], to: [-2.4712, -1.7, -1.7009], radius: 0.4, collide: 2, capsule: true}
  - {kind: rod, from: [1.3543, -1.7, -0.6449], to: [2.7086, -1.7, -1.2897], radius: 0.4, collide: 2, capsule: true}
- id: lever_f
  shape: part
  pos: [0, 0, -13]
  friction: 0.05
  color: '#b8ad97'
  pieces:
  - {kind: rod, from: [0.0, 0.0, -13.0], to: [0.0, -0.11, -2.0005], radius: 0.35, density: 7800}
  - {kind: rod, from: [-0.9, -0.1105, -1.9506], to: [0.9, -0.1105, -1.9506], radius: 0.7, collide: 1, capsule: true, density: 7800}
  - {kind: rod, from: [0.0, -1.0649, -6.5103], to: [0.0, 0.935, -6.4903], radius: 2.0, density: 7800, color: '#6f6a60'}
  - {kind: rod, from: [0.6, 0.0, -13.0], to: [-6.5, 0.0, -13.0], radius: 0.45, density: 7800}
  - {kind: rod, from: [-6.5, 0.0, -13.0], to: [-6.5, 0.04, -16.9998], radius: 0.35, density: 7800}
- {id: upright, shape: assembly, pos: [0, 0, 0], color: '#e8dec6'}
- id: wheel_e
  shape: part
  pos: [0, 20.0, 0]
  friction: 0.1
  color: '#cdbf9f'
  pieces:
  - {kind: rod, from: [0, 20.0, -7.6000000000000005], to: [0, 20.0, -8.4], radius: 7.4}
  - {kind: rod, from: [6.5, 20.0, -8.4], to: [6.5, 20.0, -10.4], radius: 0.5, collide: 1, capsule: true, color: '#6f6a60'}
- id: crank_g
  shape: part
  pos: [-6.5, 20.0, -15.8]
  density: 400
  friction: 0.1
  color: '#a99c84'
  pieces:
  - {kind: poly, points: [[-7.3, -15.8], [-5.7, -15.8], [-5.7, -9.0], [-7.3, -9.0]], y: [19.6, 20.4], collide: 2}
  - {kind: rod, from: [-6.5, 20.0, -15.8], to: [-6.5, 20.0, -17.0], radius: 0.35}
  - {kind: rod, from: [-6.3, 20.0, -15.8], to: [-7.5, 20.0, -15.8], radius: 0.45}
- id: rod_c
  shape: part
  pos: [-6.5, 20.0, -17.0]
  mount: crank_g
  density: 400
  color: '#8f8a80'
  pieces:
  - {kind: rod, from: [-6.5, 20.0, -17.0], to: [-6.5, 0.04, -16.9998], radius: 0.3}
- id: frame
  shape: part
  pos: [0, 0, 0]
  fixed: true
  color: '#cfc6b4'
  pieces:
  - {kind: poly, points: [[-1.5, -21], [1.5, -21], [1.0, 0], [-1.0, 0]], y: [-12, -11]}
  - {kind: disc, center: [0, 0], radius: 1.3, y: [-12, -11]}
  - {kind: poly, points: [[-1.5, -21], [1.5, -21], [1.0, 0], [-1.0, 0]], y: [11, 12]}
  - {kind: disc, center: [0, 0], radius: 1.3, y: [11, 12]}
  - {kind: poly, points: [[-9.5, -21], [-8, -21], [-8, 19], [-9.5, 19]], y: [-0.75, 0.75]}
  - {kind: poly, points: [[-9.5, 17.4], [0, 17.4], [0, 18.6], [-9.5, 18.6]], y: [-0.75, 0.75]}
  - {kind: poly, points: [[-1.2, -21], [1.2, -21], [0.8, -13], [-0.8, -13]], y: [-2.6, -1.9]}
  - {kind: rod, from: [0, 20.0, -21], to: [0, 20.0, -8.5], radius: 0.6, color: '#8f8a80'}
  - {kind: poly, points: [[-7.5, -21], [-8.5, -21], [-8.5, -15.200000000000001], [-7.5, -15.200000000000001]], y: [19.4, 20.6]}
joints:
- {id: j_up, type: hinge, body: upright, axis: [0, 0, 1], damping: 0.001}
- {id: j_A, type: hinge, body: gearA, axis: [0, 1, 0], damping: 0.002}
- {id: j_B, type: hinge, body: gearB, axis: [0, 1, 0], damping: 0.002}
- {id: j_shaft, type: hinge, body: shaft, axis: [0, 1, 0], damping: 0.1}
- {id: j_feather, type: slide, body: clutch, axis: [0, 1, 0], range: [-1.0, 1.0], damping: 2}
- {id: j_F, type: hinge, body: lever_f, axis: [1, 0, 0], range: [-0.13, 0.11], damping: 0.001}
- {id: j_E, type: hinge, body: wheel_e, axis: [0, 0, 1], damping: 0.002}
- {id: j_G, type: hinge, body: crank_g, axis: [1, 0, 0], damping: 0.002}
- {id: j_cr, type: hinge, body: rod_c, axis: [1, 0, 0], damping: 0.0}
bevels:
- {id: gA, body: gearA, teeth: 20, pitch_radius: 6, cone_angle: 0.7853982, face_width: 2.4, backlash: 0.05, phase: 0.0}
- {id: gB, body: gearB, teeth: 20, pitch_radius: 6, cone_angle: 0.7853982, face_width: 2.4, backlash: 0.05, phase: 0.0, quat: [0, 0, 0, 1]}
- {id: gV, body: upright, teeth: 20, pitch_radius: 6, cone_angle: 0.7853982, face_width: 2.4, backlash: 0.05, phase: 0.1570796, quat: [0.7071068, 0.7071068, 0, 0]}
- {id: gS, body: shaft, pos: [0, 20.0, 0], teeth: 20, pitch_radius: 6, cone_angle: 0.7853982, face_width: 2.4, backlash: 0.05, phase: 0.0, quat: [0, 0, 0, 1]}
- {id: gE, body: wheel_e, pos: [0, 0, 0], teeth: 20, pitch_radius: 6, cone_angle: 0.7853982, face_width: 2.4, backlash: 0.05, phase: 0.1570796, quat: [0.7071068, -0.7071068, 0, 0]}
shafts:
- {id: sh_up, body: upright, from: [0, 0, 6.5], to: [0, 0, 19], radius: 0.6}
- {id: sh_pul, body: upright, from: [0, 0, 13.5], to: [0, 0, 14.9], radius: 4.5, inner: 0.6}
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_up, kind: velocity, rpm: 15, kv: 2, max_torque: 10}
checks:
- {type: ratio, out: j_A, in: j_up, expect: -1, tol: 0.005, settle_s: 0.5, window_s: 19}
- {type: ratio, out: j_B, in: j_up, expect: 1, tol: 0.005, settle_s: 0.5, window_s: 19}
- {type: ratio, out: j_shaft, in: j_up, expect: 1, tol: 0.01, settle_s: 2.3, window_s: 1.3}
- {type: ratio, out: j_shaft, in: j_up, expect: -1, tol: 0.01, settle_s: 5.5, window_s: 3.0}
- {type: ratio, out: j_shaft, in: j_up, expect: 1, tol: 0.01, settle_s: 10.0, window_s: 3.0}
- {type: ratio, out: j_shaft, in: j_up, expect: -1, tol: 0.01, settle_s: 15.3, window_s: 3.0}
- {type: position, joint: j_E, min: -3.1, max: 3.1, settle_s: 0.5, window_s: 19.4}
- {type: penetration, max: 0.001, settle_s: 0.5}
camera: {target: [2, 6, -8.5], position: [143.5, 68, 44.5], fov: 34}
display: {output: j_shaft, labels: {j_up: Driving bevel (driver), j_A: 'Bevel C, loose', j_B: 'Bevel B, loose', j_shaft: Shaft, j_feather: Clutch-box D on the feather, j_F: Weighted lever F, j_E: Wheel E, j_G: Bell-crank G}, proof: {label: E's stud out of contact, sub: 'the stud passes the bell-crank: the lever never goes over and the shaft never reverses'}}
pins:
- {id: pin_f, a: rod_c, b: lever_f, at: [-6.5, 0.04, -16.9998]}

