# No. 51 (Brown 1868): "Two kinds of universal joints." Brown's figure 51 is the single joint: each
# shaft ends in a loop (a yoke); a cross inside turns in the eyes of both.
#
# Model (cm): A is level; B is bent down 25 deg. Every joint is a hinge (a shaft in its bearing, the
# cross in A's eyes) and B's yoke eyes are pins on the cross's other arm ends. A is the one driven
# shaft (with its driving pulley); B carries a small pulley taking off the work. B keeps pace with A
# over each turn but not within it: twice a turn it runs ahead and falls back, its speed between
# cos 25 and 1/cos 25 of A's (Hooke's joint: tan B = cos 25 tan A). Generated by batch7/gen050.py.
number: 51
slug: universal-joint
name: Universal joint
brown: "Two kinds of universal joints."
units: cm
sim: {timestep: 0.0001, integrator: Euler, iterations: 50, duration_s: 8, floor: false}
bodies:
  - id: shaftA
    shape: part
    pos: [0, 0, 10.0]
    density: 7800
    color: "#d9cfb6"
    pieces:
      - {kind: rod, from: [0, -16.0, 10.0], to: [0.0, -2.6, 10.0], radius: 0.6, color: "#8f8a80"}
      - {kind: rod, from: [0.0, -14.6, 10.0], to: [0.0, -13.4, 10.0], radius: 4.0, color: "#9c958a"}
      - {kind: rod, from: [-2.0, -2.6, 10.0], to: [2.0, -2.6, 10.0], radius: 0.35}
      - {kind: rod, from: [2.0, -2.6, 10.0], to: [2.0, 0.0, 10.0], radius: 0.35}
      - {kind: rod, from: [-2.0, -2.6, 10.0], to: [-2.0, 0.0, 10.0], radius: 0.35}
      - {kind: rod, from: [2.24, 0.0, 10.0], to: [-2.24, 0.0, 10.0], radius: 0.25, color: "#8f8a80"}
  - id: cross1
    shape: part
    pos: [0, 0, 10.0]
    mount: shaftA
    density: 7800
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [-2.1, 0.0, 10.0], to: [2.1, 0.0, 10.0], radius: 0.3, color: "#a39d90"}
      - {kind: rod, from: [0.0, 0.8875, 11.9032], to: [0.0, -0.8875, 8.0968], radius: 0.3, color: "#a39d90"}
  - id: shaftB
    shape: part
    pos: [0, 0, 10.0]
    density: 7800
    color: "#e8dec6"
    pieces:
      - {kind: rod, from: [0.0, 2.3564, 8.9012], to: [0, 14.5009, 3.2381], radius: 0.6, color: "#8f8a80"}
      - {kind: rod, from: [0.0, 12.1445, 4.3369], to: [0.0, 13.2321, 3.8298], radius: 2.0, color: "#9c958a"}
      - {kind: rod, from: [0.0, 3.2016, 10.7138], to: [0.0, 1.5112, 7.0886], radius: 0.35}
      - {kind: rod, from: [0.0, 1.5112, 7.0886], to: [0.0, -0.8452, 8.1874], radius: 0.35}
      - {kind: rod, from: [0.0, 3.2016, 10.7138], to: [0.0, 0.8452, 11.8126], radius: 0.35}
      - {kind: rod, from: [0.0, -0.9467, 7.9699], to: [0.0, 0.9467, 12.0301], radius: 0.25, color: "#8f8a80"}
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cfc6b4"
    pieces:
      - {kind: rod, from: [0, -12.0, 10.0], to: [0, -12.0, -1.0], radius: 0.5}
      - {kind: rod, from: [-1.2, -12.0, 10.0], to: [1.2, -12.0, 10.0], radius: 0.9, color: "#b9b09c"}
      - {kind: rod, from: [0, 10.8757, 4.9286], to: [0, 10.8757, -1.0], radius: 0.5}
      - {kind: rod, from: [-1.2, 10.8757, 4.9286], to: [1.2, 10.8757, 4.9286], radius: 0.9, color: "#b9b09c"}
      - {kind: poly, points: [[-4, -2], [4, -2], [4, -1], [-4, -1]], y: [-15.0, 13.88], color: "#b9b09c"}
joints:
  - {id: j_A, type: hinge, body: shaftA, axis: [0, 1.0, 0], damping: 0.002}   # the driven shaft, in its bearing
  - {id: j_c1a, type: hinge, body: cross1, axis: [1.0, 0, 0], damping: 0.0005}   # the cross in A's eyes
  - {id: j_B, type: hinge, body: shaftB, axis: [0, 0.9063, -0.4226], damping: 0.02}   # the driven-on shaft in its bearing, and its load
# B's yoke eyes on the arm ends of the cross (two pins on one line: a hinge, closing the loop)
pins:
  - {id: eye1, a: cross1, b: shaftB, at: [0.0, -0.8452, 8.1874]}
  - {id: eye2, a: cross1, b: shaftB, at: [0.0, 0.8452, 11.8126]}
driver: {joint: j_A, kind: velocity, rpm: 30, kv: 2, max_torque: 5}
checks:
  # B keeps pace over each turn, and within it swings between cos 25 and 1/cos 25 of A's speed
  - {type: ratio, out: j_B, in: j_A, expect: 1, tol: 0.003, settle_s: 1, window_s: 6}
  - {type: ratio_range, out: j_B, in: j_A, min: 0.8972, max: 1.1144, settle_s: 1, window_s: 6, min_swing: 0.1675}
  # the cross rocks in A's eyes by the angle between the shafts (25 deg)
  - {type: amplitude, joint: j_c1a, min: 0.4232, max: 0.4494, settle_s: 1, window_s: 6}
camera: {target: [0.0, 0.0, 7.0], position: [55, -30, 30], fov: 30}
display:
  output: j_B
  labels: {j_A: "Shaft A (driver)", j_B: "Shaft B", j_c1a: "Cross in A's yoke"}
  proof: {label: "Yoke eyes off the cross", sub: "B's eyes no longer hold the cross: A turns, B stands"}
