number: 363
slug: see-saw
name: See-saw
brown: "See-saw, one of the simplest illustrations of a limited oscillating or alternate circular motion."
units: cm
sim: {timestep: 0.0005, integrator: implicitfast, iterations: 50, solver: PGS, multiccd: false, duration_s: 10, floor: false}
bodies:
  # the plank and its riders, balanced on the trestle
  - id: plank
    shape: part
    pos: [0, 0, 50.0]
    density: 600
    friction: 0.5
    color: "#c9a878"
    pieces:
      - {kind: poly, points: [[-120.0, 50.0], [120.0, 50.0], [120.0, 54.0], [-120.0, 54.0]], y: [-12.0, 12.0], collide: 1}
      - {kind: poly, points: [[-6, 47.0], [6, 47.0], [6, 50.0], [-6, 50.0]], y: [-12.0, 12.0], collide: 0, color: "#a88a5c"}
      - {kind: disc, center: [0, 50.0], radius: 2.0, y: [-16, 16], collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [-60.0, -10, 60.0], to: [-60.0, 10, 60.0], radius: 1.2, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [-60.0, -10, 54.0], to: [-60.0, -10, 60.0], radius: 0.8, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [-60.0, 10, 54.0], to: [-60.0, 10, 60.0], radius: 0.8, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [60.0, -10, 60.0], to: [60.0, 10, 60.0], radius: 1.2, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [60.0, -10, 54.0], to: [60.0, -10, 60.0], radius: 0.8, collide: 0, color: "#8f8a80"}
      - {kind: rod, from: [60.0, 10, 54.0], to: [60.0, 10, 60.0], radius: 0.8, collide: 0, color: "#8f8a80"}
  - id: legs1
    shape: part
    pos: [-90.0, 0, 50.0]
    mount: plank
    density: 80
    friction: 0.1
    color: "#b86a4a"
    pieces:
      - {kind: poly, points: [[-93.0, 33.0], [-87.0, 33.0], [-87.0, 50.0], [-93.0, 50.0]], y: [-8, 8], collide: 0}
      - {kind: poly, points: [[-95.0, 30.0], [-85.0, 30.0], [-85.0, 33.0], [-95.0, 33.0]], y: [-8, 8], collide: 1, color: "#5a4a3a"}
  - id: legs2
    shape: part
    pos: [90.0, 0, 50.0]
    mount: plank
    density: 80
    friction: 0.1
    color: "#4a6ab8"
    pieces:
      - {kind: poly, points: [[87.0, 33.0], [93.0, 33.0], [93.0, 50.0], [87.0, 50.0]], y: [-8, 8], collide: 0}
      - {kind: poly, points: [[85.0, 30.0], [95.0, 30.0], [95.0, 33.0], [85.0, 33.0]], y: [-8, 8], collide: 1, color: "#5a4a3a"}
  # the trestle, the ground and its two pads
  - id: ground
    shape: part
    pos: [0, 0, 0]
    fixed: true
    friction: 0.1
    color: "#cfc6b4"
    pieces:
      - {kind: poly, points: [[-14, 0], [14, 0], [2.5, 49.0], [-2.5, 49.0]], y: [13, 16], collide: 0}
      - {kind: poly, points: [[-14, 0], [14, 0], [2.5, 49.0], [-2.5, 49.0]], y: [-16, -13], collide: 0}
      - {kind: poly, points: [[-150, -4], [150, -4], [150, 0], [-150, 0]], y: [-30, 30], collide: 2, color: "#b9b09c"}
      - {kind: poly, points: [[-130, 0], [-110, 0], [-110, 12], [-130, 12]], y: [-14, 14], collide: 2, color: "#9a8f78"}
      - {kind: poly, points: [[110, 0], [130, 0], [130, 12], [110, 12]], y: [-14, 14], collide: 2, color: "#9a8f78"}
joints:
  - {id: j_p, type: hinge, body: plank, axis: [0, -1, 0], damping: 15.0}   # + : the right end up
  - {id: j_l1, type: slide, body: legs1, axis: [0, 0, -1], range: [0, 45.0], stiffness: 100.0, damping: 5.0}
  - {id: j_l2, type: slide, body: legs2, axis: [0, 0, -1], range: [0, 45.0], stiffness: 100.0, damping: 5.0}
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.001], margin: 0}
# the riders' feet, pressing off the ground in turn; nothing else is driven
driver: {joint: j_l1, kind: feet, feet: {joints: [j_l1, j_l2], force: 80.0, hz: 0.5}, max_torque: 80.0}
checks:
  - {type: position, joint: j_p, min: -0.45, max: 0.45, settle_s: 0, window_s: 10}
  - {type: amplitude, joint: j_p, min: 0.15, max: 0.45, sustain: 0.8, settle_s: 2, window_s: 8}
  - {type: period, joint: j_p, expect_s: 2.0, tol: 0.05, settle_s: 2, window_s: 8}
  - {type: penetration, max: 0.002, settle_s: 0.5}
camera: {target: [0, 0, 22], position: [60, -430, 100], fov: 30}
display:
  output: j_p
  labels: {j_p: "Plank", j_l1: "Left rider's feet (input)", j_l2: "Right rider's feet (input)"}

