# No. 2, Pulleys and Crossed Belt (Brown 1868).
# Same pulleys as No. 1, grooved, with a crossed round (cord) belt, as Brown draws it.
# Only the upper pulley is motor-driven. The belt is a closed loop of 120 elastic leather-cord links
# (axial spring, bending in and out of the plane) that drives the lower pulley by friction. At the cross
# the two strands collide (belt-belt contact is on) and rub past each other, one just in front of the other.
number: 2
slug: pulleys-and-crossed-belt
name: Pulleys and Crossed Belt
brown: "Differs from 1 in the substitution of a crossed belt for the open one. In this case the direction of rotation of the pulleys is reversed."
units: cm
sim: {timestep: 0.0001, integrator: implicitfast, iterations: 50, duration_s: 8}
bodies:
  - {id: p_top, shape: pulley, radius: 9, width: 4, groove: 1.1, flange: 0.7, pos: [0, 0, 62], mass: 2.0, spokes: 4, hub: 2.4}
  - {id: p_bot, shape: pulley, radius: 9, width: 4, groove: 1.1, flange: 0.7, pos: [0, 0, 12], mass: 2.0, spokes: 4, hub: 2.4}
joints:
  - {id: j_top, type: hinge, body: p_top, axis: [0, 1, 0], damping: 0.002}
  - {id: j_bot, type: hinge, body: p_bot, axis: [0, 1, 0], damping: 0.05}   # the load
belts:
  - id: belt
    around: [p_top, p_bot]
    section: round
    crossed: true
    links: 120
    segments: 8
    thickness: 0.8        # cord diameter
    width: 0.8
    density: 950
    stiffness: 30000
    damping: 2
    pretension: 30
    friction: 0.6
contact: {solref: [0.004, 1], solimp: [0.9, 0.95, 0.001], margin: 0}
driver: {joint: j_top, kind: velocity, rpm: 30, kv: 2, max_torque: 5}
checks:
  # Crossed belt: the driven pulley turns the opposite way at the same speed, less creep.
  - {type: ratio, out: j_bot, in: j_top, expect: -1.0, tol: 0.04, settle_s: 1, window_s: 1}
  - {type: belt_on, belt: belt, max_radial_dev: 1.0, max_lateral: 1.0, duration_s: 2}
  - {type: self_contact, min_contacts: 100, max_penetration: 0.25, settle_s: 1}  # cord diameter 0.8
camera: {target: [0, 0, 33], position: [52, -168, 50], fov: 30}
display:
  output: j_bot
  labels: {j_top: Upper pulley (driver), j_bot: Lower pulley}
  resize: {p_top: [5, 13], p_bot: [5, 13]}
  light_links: 80
  expect: {default: -1.0}
