number: 333
slug: parallel-motion-particular-cases
name: A parallel motion used only in particular cases
brown: "A parallel motion used only in particular cases."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 100, solver: CG, multiccd: true, duration_s: 8, floor: false}
bodies:
  # the framing: the radius arm's centre G, the rocker's centre H, and the gland that guides the piston-rod
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    density: 7800
    color: "#9a9284"
    pieces:
      - {kind: poly, points: [[-8.0000, -30.0000], [46.0000, -30.0000], [46.0000, -29.0000], [-8.0000, -29.0000]], y: [-4.6, 4.2], collide: 0}
      - {kind: poly, points: [[-1.0000, -29.0000], [1.0000, -29.0000], [1.0000, 0.0000], [-1.0000, 0.0000]], y: [2.8, 3.6], collide: 0}
      - {kind: disc, center: [0, 0], radius: 1.4, y: [2.8, 3.6], collide: 0}
      - {kind: rod, from: [0, 1.2, 0], to: [0, 3.6, 0], radius: 0.5, collide: 0, color: "#6f6a60"}
      - {kind: poly, points: [[33.0541, -29.0000], [35.0541, -29.0000], [35.0541, -26.6954], [33.0541, -26.6954]], y: [0.4, 1.2], collide: 0}
      - {kind: disc, center: [34.0541, -26.6954], radius: 1.2, y: [0.4, 1.2], collide: 0}
      - {kind: rod, from: [34.0541, -4.2, -26.6954], to: [34.0541, 1.2, -26.6954], radius: 0.5, collide: 0, color: "#6f6a60"}
      - {kind: poly, points: [[-4.5000, -29.0000], [-3.0000, -29.0000], [-3.0000, -2.0000], [-4.5000, -2.0000]], y: [-4.4, -3.6], collide: 0}
      - {kind: poly, points: [[-4.5000, -2.0000], [0.7089, -2.0000], [0.7089, -0.5000], [-4.5000, -0.5000]], y: [-4.4, -3.6], collide: 0}
      - {kind: poly, points: [[-0.4911, -0.5000], [2.7089, -0.5000], [2.7089, 2.5000], [-0.4911, 2.5000]], y: [-4.8, -3.0], collide: 0, color: "#7d776c"}
  # the radius arm G C, rocked on G (the driven joint)
  - id: A1
    shape: part
    pos: [0, 0, 0]
    mount: frame
    density: 7800
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [0.0000, 1.8, 0.0000], to: [20.1898, 1.8, 10.3761], radius: 0.55, collide: 0}
      - {kind: disc, center: [0.0000, 0.0000], radius: 1.0, y: [1.4, 2.2], collide: 0}
      - {kind: disc, center: [20.1898, 10.3761], radius: 1.0, y: [1.4, 2.2], collide: 0}
      - {kind: rod, from: [20.1898, -2.4, 10.3761], to: [20.1898, 2.2, 10.3761], radius: 0.4, collide: 0, color: "#6f6a60"}
  # the beam E C B, on the arm's pin C; its end E a bearing on the cross-head's pin, its end B a pin for the rocker
  - id: Bm
    shape: part
    pos: [20.1898, 0, 10.3761]
    mount: A1
    density: 7800
    color: "#b0a690"
    pieces:
      - {kind: poly, points: [[0.8399, 23.9169], [21.4899, 12.3935], [40.5147, -1.6517], [39.5396, -3.1647], [18.8897, 8.3588], [-0.1352, 22.4039]], y: [-0.6, 0.6], collide: 0}
      - {kind: disc, center: [20.1898, 10.3761], radius: 3.0, y: [-0.8, 0.8], collide: 0}
      - {kind: band, center: [1.1089, 22.6729], r: [0.42, 0.95], a: [0, 6.2832], y: [-0.6, 0.6], slices: 36, collide: 1}
      - {kind: disc, center: [39.2706, -1.9207], radius: 0.4, y: [-1.6, 0.6], collide: 2, color: "#6f6a60"}
  # the rocker H B, standing in for a slide under B
  - id: Rk
    shape: part
    pos: [34.0541, 0, -26.6954]
    mount: frame
    density: 7800
    color: "#a39a88"
    pieces:
      - {kind: rod, from: [34.0541, -1.25, -26.6954], to: [39.2706, -1.25, -1.9207], radius: 0.35, collide: 0}
      - {kind: disc, center: [34.0541, -26.6954], radius: 0.75, y: [-1.6, -0.9], collide: 0}
      - {kind: band, center: [39.2706, -1.9207], r: [0.42, 0.95], a: [0, 6.2832], y: [-1.6, -0.9], slices: 36, collide: 1}
  # the lower bar C K, hanging from C; its lower end K a pin
  - id: V
    shape: part
    pos: [20.1898, 0, 10.3761]
    mount: Bm
    density: 7800
    color: "#a39a88"
    pieces:
      - {kind: rod, from: [20.1898, -2.2, 10.3761], to: [14.9733, -2.2, -14.3986], radius: 0.35, collide: 0}
      - {kind: disc, center: [20.1898, 10.3761], radius: 0.75, y: [-2.6, -1.8], collide: 0}
      - {kind: disc, center: [17.5815, -2.0113], radius: 0.7, y: [-2.6, -1.8], collide: 0}
      - {kind: disc, center: [14.9733, -14.3986], radius: 0.4, y: [-3.6, -1.8], collide: 2, color: "#6f6a60"}
  # the bar H K, on H; its eye a bearing on K's pin
  - id: Q
    shape: part
    pos: [34.0541, 0, -26.6954]
    mount: frame
    density: 7800
    color: "#a39a88"
    pieces:
      - {kind: rod, from: [34.0541, -3.25, -26.6954], to: [14.9733, -3.25, -14.3986], radius: 0.35, collide: 0}
      - {kind: disc, center: [34.0541, -26.6954], radius: 0.75, y: [-3.6, -2.9], collide: 0}
      - {kind: band, center: [14.9733, -14.3986], r: [0.42, 0.95], a: [0, 6.2832], y: [-3.6, -2.9], slices: 36, collide: 1}
  # the cross-head E and the piston-rod, which hangs through the gland: free to move across and up and down,
  # and only the beam's end, through E's pin, places it
  - {id: Px, shape: part, pos: [1.1089, 0, 22.6729], mount: frame, mass: 0.01, color: "#8f8a80", pieces: [{kind: disc, center: [1.1089, 1], radius: 0.1, y: [-4.0, -3.9], collide: 0}]}
  - id: P
    shape: part
    pos: [1.1089, 0, 22.6729]
    mount: Px
    density: 7800
    color: "#b8ad96"
    pieces:
      - {kind: disc, center: [1.1089, 22.6729], radius: 0.4, y: [-4.2, 0.6], collide: 2, color: "#6f6a60"}
      - {kind: poly, points: [[0.2089, 21.6729], [2.0089, 21.6729], [2.0089, 23.6729], [0.2089, 23.6729]], y: [-4.4, -2.6], collide: 0}
      - {kind: rod, from: [1.1089, -3.9, 21.6729], to: [1.1089, -3.9, -5.3271], radius: 0.45, collide: 0, color: "#8f8a80"}
joints:
  - {id: j_A, type: hinge, body: A1, axis: [0, -1, 0], damping: 0.001}
  - {id: j_C, type: hinge, body: Bm, axis: [0, -1, 0], damping: 0.001}
  - {id: j_R, type: hinge, body: Rk, axis: [0, -1, 0], damping: 0.001}
  - {id: j_V, type: hinge, body: V, axis: [0, -1, 0], damping: 0.001}
  - {id: j_Q, type: hinge, body: Q, axis: [0, -1, 0], damping: 0.001}
  - {id: j_x, type: slide, body: Px, axis: [1, 0, 0], damping: 0.2, range: [-1, 1]}
  - {id: j_z, type: slide, body: P, axis: [0, 0, 1], damping: 0.2, range: [-7, 7]}
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_A, kind: velocity, rpm: 0, swing: {amplitude: 0.14, hz: 0.25}, kv: 2000, max_torque: 100}
checks:
  # the radius arm, rocked on G, carries the beam's middle C round its arc; the beam's end B is held near
  # the level of G by the rocker, so the beam's other end E rises and falls in step with the arm ...
  - {type: follow, out: j_z, in: j_A, expect: 0.362, tol: 0.01, min_r2: 0.999, settle_s: 0.5, window_s: 7.0}
  - {type: amplitude, joint: j_z, min: 0.048, max: 0.057, settle_s: 0.5, window_s: 7.0}
  # ... the beam turning on C nearly twice as far as the arm, the other way ...
  - {type: follow, out: j_C, in: j_A, expect: -1.838, tol: 0.04, min_r2: 0.999, settle_s: 0.5, window_s: 7.0}
  # ... so that E keeps to a straight upright line: the cross-head strays across by under a millimetre
  - {type: position, joint: j_x, min: -0.1, max: 0.1, settle_s: 0.5, window_s: 7.0}
  - {type: penetration, max: 0.0003, settle_s: 0.2}
camera: {target: [19, 0, -14], position: [19, -215, -6], fov: 30}
display:
  output: j_z
  labels: {j_A: "Radius arm G C (driver)", j_C: Beam E C B, j_R: Rocker H B, j_x: Cross-head E across, j_z: Cross-head E and piston-rod}

