number: 340
slug: parallel-motion-joggling-pillar
name: A parallel motion with a joggling pillar
brown: "Another parallel motion. Beam, D, C, with joggling pillar-support, B, F, which vibrates from the center, F. The piston-rod is connected at C. The radius-bar, E, A, produces the parallel motion."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 100, solver: CG, multiccd: true, duration_s: 8, floor: false}
bodies:
  # the framing: the pillar's footstep F, the wall that carries the radius bar's centre E, and the piston-rod's gland
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    density: 7800
    color: "#9a9284"
    pieces:
      - {kind: poly, points: [[-19.3459, -4.2000], [44.8952, -4.2000], [44.8952, -3.0000], [-19.3459, -3.0000]], y: [-4.6, 4.2], collide: 0}
      - {kind: poly, points: [[-3.0000, -3.0000], [3.0000, -3.0000], [3.0000, 1.0000], [-3.0000, 1.0000]], y: [2.6, 3.6], collide: 0}
      - {kind: disc, center: [0, 0], radius: 2.0, y: [2.6, 3.6], collide: 0}
      - {kind: rod, from: [0, 1.4, 0], to: [0, 3.6, 0], radius: 0.7, collide: 0, color: "#6f6a60"}
      - {kind: poly, points: [[42.8952, -3.0000], [44.8952, -3.0000], [44.8952, 42.3546], [42.8952, 42.3546]], y: [-2.2, 3.6], collide: 0}
      - {kind: poly, points: [[38.0952, 35.5546], [42.8952, 35.5546], [42.8952, 37.1546], [38.0952, 37.1546]], y: [-2.2, -1.6], collide: 0}
      - {kind: disc, center: [38.8952, 36.3546], radius: 1.0, y: [-2.2, -1.6], collide: 0}
      - {kind: poly, points: [[30.2602, -3.0000], [31.6602, -3.0000], [31.6602, 13.1135], [30.2602, 13.1135]], y: [-4.4, -3.6], collide: 0}
      - {kind: poly, points: [[26.1602, 11.7135], [31.6602, 11.7135], [31.6602, 13.1135], [26.1602, 13.1135]], y: [-4.4, -3.6], collide: 0}
      - {kind: poly, points: [[24.0602, 10.5135], [27.2602, 10.5135], [27.2602, 13.1135], [24.0602, 13.1135]], y: [-4.8, -3.0], collide: 0, color: "#7d776c"}
  # the joggling pillar B F, rocked on F (the driven joint)
  - id: Pl
    shape: part
    pos: [0, 0, 0]
    mount: frame
    density: 7800
    color: "#a39d90"
    pieces:
      - {kind: rod, from: [0, 1.8, 0], to: [4.6079, 1.8, 34.8488], radius: 1.4, collide: 0}
      - {kind: disc, center: [0.0000, 0.0000], radius: 2.4, y: [1.0, 2.6], collide: 0}
      - {kind: disc, center: [4.6079, 34.8488], radius: 2.4, y: [1.0, 2.6], collide: 0}
      - {kind: rod, from: [4.6079, -0.8, 34.8488], to: [4.6079, 2.6, 34.8488], radius: 1.0, collide: 0, color: "#6f6a60"}
  # the beam D B C, on the pillar's top B; the pin A for the radius bar, and the piston-rod's pin at its end C
  - id: Bm
    shape: part
    pos: [4.6079, 0, 34.8488]
    mount: Pl
    density: 7800
    color: "#b0a690"
    pieces:
      - {kind: poly, points: [[-15.8146, 49.5043], [6.2154, 37.3198], [27.7648, 20.9145], [26.2379, 18.5674], [2.7253, 31.9551], [-17.5596, 46.8220]], y: [-0.6, 0.6], collide: 0}
      - {kind: disc, center: [4.6079, 34.8488], radius: 2.6, y: [-0.8, 0.8], collide: 0}
      - {kind: disc, center: [-15.3459, 47.2906], radius: 1.6, y: [-0.8, 0.8], collide: 0}
      - {kind: rod, from: [-15.3459, -1.2, 47.2906], to: [-15.3459, 1.2, 47.2906], radius: 0.5, collide: 0, color: "#6f6a60"}
      - {kind: disc, center: [16.3156, 26.5766], radius: 0.4, y: [-1.6, 0.6], collide: 2, color: "#6f6a60"}
      - {kind: disc, center: [25.6602, 20.6135], radius: 0.4, y: [-3.8, 0.6], collide: 2, color: "#6f6a60"}
  # the radius bar E A, on its fixed centre E; its eye a bearing on A
  - id: Rb
    shape: part
    pos: [38.8952, 0, 36.3546]
    mount: frame
    density: 7800
    color: "#a39a88"
    pieces:
      - {kind: rod, from: [38.8952, -1.25, 36.3546], to: [16.3156, -1.25, 26.5766], radius: 0.35, collide: 0}
      - {kind: disc, center: [38.8952, 36.3546], radius: 0.75, y: [-1.6, -0.9], collide: 0}
      - {kind: band, center: [16.3156, 26.5766], r: [0.42, 0.95], a: [0, 6.2832], y: [-1.6, -0.9], slices: 36, collide: 1}
  # the cross-head C and the piston-rod, which hangs through the gland: free to move across and up and down,
  # and only the beam's end, through C's pin, places it
  - {id: Px, shape: part, pos: [25.6602, 0, 20.6135], mount: frame, mass: 0.01, color: "#8f8a80", pieces: [{kind: disc, center: [25.6602, 11.8135], radius: 0.1, y: [-4.0, -3.9], collide: 0}]}
  - id: P
    shape: part
    pos: [25.6602, 0, 20.6135]
    mount: Px
    density: 7800
    color: "#b8ad96"
    pieces:
      - {kind: band, center: [25.6602, 20.6135], r: [0.42, 0.95], a: [0, 6.2832], y: [-3.8, -3.0], slices: 36, collide: 1}
      - {kind: poly, points: [[24.7602, 19.6135], [26.5602, 19.6135], [26.5602, 21.6135], [24.7602, 21.6135]], y: [-4.4, -3.9], collide: 0}
      - {kind: rod, from: [25.6602, -4.1, 19.6135], to: [25.6602, -4.1, 6.6135], radius: 0.45, collide: 0, color: "#8f8a80"}
joints:
  - {id: j_F, type: hinge, body: Pl, axis: [0, -1, 0], damping: 0.001}
  - {id: j_B, type: hinge, body: Bm, axis: [0, -1, 0], damping: 0.001}
  - {id: j_E, type: hinge, body: Rb, 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_F, kind: velocity, rpm: 0, swing: {amplitude: 0.08, hz: 0.25}, kv: 2000, max_torque: 100}
checks:
  # the pillar, rocked on F, carries the beam's pivot B to and fro; the radius bar holds the pin A to its arc, so the
  # beam tips as it goes and its end C rises and falls with the pillar (not quite in proportion: the beam tips
  # faster one way than the other) ...
  - {type: follow, out: j_z, in: j_F, expect: 0.578, tol: 0.02, min_r2: 0.985, settle_s: 0.5, window_s: 7.0}
  - {type: amplitude, joint: j_z, min: 0.044, max: 0.052, settle_s: 0.5, window_s: 7.0}
  # ... the radius bar swinging half as far again as the pillar, the other way ...
  - {type: follow, out: j_E, in: j_F, expect: -1.517, tol: 0.04, min_r2: 0.99, settle_s: 0.5, window_s: 7.0}
  # ... so that C 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: [13.7747, 0, 9], position: [13.7747, -230, 17], fov: 30}
display:
  output: j_z
  labels: {j_F: "Joggling pillar B F (driver)", j_B: Beam D B C, j_E: Radius bar E A, j_x: Cross-head C across, j_z: Cross-head C and piston-rod}

