# No. 28, Brush-wheels (Brown 1868).
#
# Laid out as the plate (1 unit = 1 cm): a large horizontal disc (r 15, 1.2 thick) on a vertical
# shaft with a flared boss beneath; above it, near its edge, a small wheel (r 3) on a horizontal
# shaft that points along a radius of the disc, its rim resting on the disc's upper face. The
# disc's face is india-rubber (friction 0.8), as Brown suggests.
#
# Fully physical: only the disc's shaft is motor-driven. The small wheel turns on its own axle in a
# bearing free to rise and fall (a vertical slide), so it rests on the disc with its own weight
# (2 kg, 19.6 N); nothing else joins the two, and it turns by friction at the one point of contact
# against a 0.03 N·m bearing load (1 N at its rim). The disc's face at radius r_c moves at ω_d·r_c,
# and the small wheel rolls on it, so ω_w/ω_d = r_c / r_w: the speed is set by how far the wheel
# stands from the disc's centre. The three passive settings (`variants`) slide the wheel along its
# shaft to r_c = 6, 9 and 12 (the plate's, near the edge): ratios 2, 3 and 4. The sign follows
# from the axes: the disc turns about +z, so under the wheel (on +y, at x = 0) its face moves
# towards -x; the wheel's axle points along +y and its lowest point moves the same way when it
# turns about +y forwards: ω_w/ω_d = +r_c/r_w. The rim's width (1.2) straddles r_c, so the wheel
# rolls about 1 % slow (it twists on the face across its width).
number: 28
slug: brush-wheels
name: Brush-wheels
brown: "These are sometimes called ‘brush-wheels.’ The relative speeds can be varied by changing the distance of the upper wheel from the center of the lower one. The one drives the other by the friction or adhesion, and this may be increased by facing the lower one with india-rubber."
units: cm
sim: {timestep: 0.0002, integrator: implicitfast, iterations: 50, duration_s: 4, floor: false}
bodies:
  - {id: disc, shape: assembly, pos: [0, 0, 0], color: "#e4d9bf"}
  # the small wheel: its bearing rides a vertical slide, so it rests on the disc by its weight
  - {id: brush, shape: pulley, radius: 3, width: 1.2, pos: [0, 12, 3.6], mass: 2.0, flange: 0, spokes: 4, hub: 0.8,
     spin: {damping: 0.0005, frictionloss: 0.03}, touch: {side: 2, friction: 0.8}, color: "#e9dfc9"}
joints:
  - {id: j_disc, type: hinge, body: disc, axis: [0, 0, 1], damping: 0.002}
  - {id: j_lift, type: slide, body: brush, axis: [0, 0, 1], range: [-1, 1], damping: 5}
wheels:
  # the disc: a flat-faced solid (a profile of one radius: flat end faces, not a rounded rim)
  - {id: face, body: disc, pos: [0, 0, 0], quat: [0.7071068, 0.7071068, 0, 0], radius: 15, width: 1.2, profile: [[-0.6, 15], [0.6, 15]],
     mass: 4.0, flange: 0, spokes: 0, web: true, hub: 2.2, touch: {side: 1, friction: 0.8}, color: "#e4d9bf"}
shafts:
  - {id: sh_disc, body: disc, from: [0, 0, -0.6], to: [0, 0, -10], radius: 0.8}
  - {id: boss, body: disc, from: [0, 0, -0.6], to: [0, 0, -3], radius: 2.4}
variants:
  - {id: near, note: "the small wheel slid in to r_c = 6: ratio 2", body_pos: {brush: [0, 6, 3.6]}}
  - {id: middle, note: "at r_c = 9: ratio 3", body_pos: {brush: [0, 9, 3.6]}}
  - {id: plate, note: "near the edge, as the plate draws it, r_c = 12: ratio 4", body_pos: {brush: [0, 12, 3.6]}}
variant: plate
contact: {solref: [0.002, 1], solimp: [0.95, 0.99, 0.0005], margin: 0}
driver: {joint: j_disc, kind: velocity, rpm: 30, kv: 2, max_torque: 5}
checks:
  # rolling at r_c = 12 on r_w = 3: ω_w/ω_d = 12/3 = 4 (the other two settings in test_movements.py)
  - {type: ratio, out: brush_spin, in: j_disc, expect: 4.0, tol: 0.06, settle_s: 1, window_s: 2}
  - {type: position, joint: j_lift, min: -0.05, max: 0.02, settle_s: 1, window_s: 2}
  - {type: penetration, max: 0.0005, settle_s: 1}
camera: {target: [0, 3, -1], position: [-34, -44, 11], fov: 38}
display:
  output: brush_spin
  labels: {j_disc: "Disc (driver)", brush_spin: "Brush-wheel", j_lift: "Its bearing, resting by weight"}
  expect: {default: 4.0, near: 2.0, middle: 3.0, plate: 4.0}
  proof: {label: "Face made smooth", sub: "no friction on the disc's face: the disc turns, the small wheel stands"}
