# No. 490 (Brown 1868): "Ordinary steering apparatus. Plan view."
#
# Model (cm, gravity on, seen from above as Brown's plan). The hand-wheel (68 cm across, upright, seen edge-on) is keyed to a barrel (6 cm
# radius) whose shaft lies fore and aft. The tiller-rope takes a full turn round the barrel, runs off its top to two guide pulleys on upright
# pins, one each side, and from them to the boss at the end of the tiller (44 cm long, on the rudder head); it is seized round the boss.
# Turning the wheel winds one end on and lets the other off, and the tiller is drawn over to one side or the other. The rope is a real cord
# (a chain of links, pretensioned), gripping the barrel and the boss by friction; the rudder's resistance in the water is 3 N m s on the
# rudder head. Only the hand-wheel is driven (2.6 rad each way at 0.22 Hz). Generator: opencode-runs/batch14/gen490.py.
number: 490
slug: ordinary-steering-apparatus
name: Ordinary steering apparatus
brown: "Ordinary steering apparatus. Plan view. On the shaft of the hand-wheel there is a barrel on which is wound a rope which passes round the guide-pulleys and has its opposite ends attached to the tiller or lever on the top of the rudder; by turning the wheel, one end of the rope is wound on and the other let off, and the tiller is moved in one or the other direction, according to the direction in which the wheel is turned."
units: cm
sim: {timestep: 0.0001, integrator: implicitfast, iterations: 50, duration_s: 8, floor: false}
bodies:
  - id: frame
    shape: part
    pos: [0, 0, 0]
    fixed: true
    color: "#cdc0a4"
    pieces:
      - {kind: poly, points: [[-10.5, -3.5], [-6.5, -3.5], [-6.5, 3.5], [-10.5, 3.5]], y: [-5, 5], collide: 0}   # the barrel's bearings (pedestals)
      - {kind: poly, points: [[14.5, -3.5], [18.5, -3.5], [18.5, 3.5], [14.5, 3.5]], y: [-5, 5], collide: 0}
      - {kind: rod, from: [9.0, 40.0, 0.40000000000000036], to: [9.0, 40.0, 8.600000000000001], radius: 0.9, collide: 0}   # the guide pulleys' pins
      - {kind: rod, from: [9.0, -40.0, 0.40000000000000036], to: [9.0, -40.0, 8.600000000000001], radius: 0.9, collide: 0}
      - {kind: rod, from: [9.0, 40.0, 8.600000000000001], to: [17.0, 49.0, 8.600000000000001], radius: 1.6, collide: 0}   # their brackets
      - {kind: rod, from: [9.0, -40.0, 8.600000000000001], to: [17.0, -49.0, 8.600000000000001], radius: 1.6, collide: 0}
  - {id: barrel, shape: assembly, pos: [0, 0, 0], color: "#e6dcc6"}
  - id: handwheel
    shape: part
    pos: [0, 0, 0]
    mount: barrel
    color: "#c9b48c"
    pieces:
      - {kind: rod, from: [-16.0000, 34.0000, 0.0000], to: [-16.0000, 32.8415, 8.7998], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 32.8415, 8.7998], to: [-16.0000, 29.4449, 17.0000], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 29.4449, 17.0000], to: [-16.0000, 24.0416, 24.0416], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 24.0416, 24.0416], to: [-16.0000, 17.0000, 29.4449], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 17.0000, 29.4449], to: [-16.0000, 8.7998, 32.8415], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 8.7998, 32.8415], to: [-16.0000, 0.0000, 34.0000], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 0.0000, 34.0000], to: [-16.0000, -8.7998, 32.8415], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -8.7998, 32.8415], to: [-16.0000, -17.0000, 29.4449], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -17.0000, 29.4449], to: [-16.0000, -24.0416, 24.0416], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -24.0416, 24.0416], to: [-16.0000, -29.4449, 17.0000], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -29.4449, 17.0000], to: [-16.0000, -32.8415, 8.7998], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -32.8415, 8.7998], to: [-16.0000, -34.0000, 0.0000], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -34.0000, 0.0000], to: [-16.0000, -32.8415, -8.7998], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -32.8415, -8.7998], to: [-16.0000, -29.4449, -17.0000], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -29.4449, -17.0000], to: [-16.0000, -24.0416, -24.0416], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -24.0416, -24.0416], to: [-16.0000, -17.0000, -29.4449], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -17.0000, -29.4449], to: [-16.0000, -8.7998, -32.8415], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -8.7998, -32.8415], to: [-16.0000, -0.0000, -34.0000], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, -0.0000, -34.0000], to: [-16.0000, 8.7998, -32.8415], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 8.7998, -32.8415], to: [-16.0000, 17.0000, -29.4449], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 17.0000, -29.4449], to: [-16.0000, 24.0416, -24.0416], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 24.0416, -24.0416], to: [-16.0000, 29.4449, -17.0000], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 29.4449, -17.0000], to: [-16.0000, 32.8415, -8.7998], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 32.8415, -8.7998], to: [-16.0000, 34.0000, -0.0000], radius: 1.3, collide: 0}
      - {kind: rod, from: [-16.0000, 3.0000, 0.0000], to: [-16.0000, 34.0000, 0.0000], radius: 0.9, collide: 0}
      - {kind: rod, from: [-16.0000, 1.5000, 2.5981], to: [-16.0000, 17.0000, 29.4449], radius: 0.9, collide: 0}
      - {kind: rod, from: [-16.0000, -1.5000, 2.5981], to: [-16.0000, -17.0000, 29.4449], radius: 0.9, collide: 0}
      - {kind: rod, from: [-16.0000, -3.0000, 0.0000], to: [-16.0000, -34.0000, 0.0000], radius: 0.9, collide: 0}
      - {kind: rod, from: [-16.0000, -1.5000, -2.5981], to: [-16.0000, -17.0000, -29.4449], radius: 0.9, collide: 0}
      - {kind: rod, from: [-16.0000, 1.5000, -2.5981], to: [-16.0000, 17.0000, -29.4449], radius: 0.9, collide: 0}
      - {kind: rod, from: [-16.0000, 35.0000, 0.0000], to: [-16.0000, 42.0000, 0.0000], radius: 1.2, collide: 0, color: "#a8865a"}
      - {kind: rod, from: [-16.0000, 17.5000, 30.3109], to: [-16.0000, 21.0000, 36.3731], radius: 1.2, collide: 0, color: "#a8865a"}
      - {kind: rod, from: [-16.0000, -17.5000, 30.3109], to: [-16.0000, -21.0000, 36.3731], radius: 1.2, collide: 0, color: "#a8865a"}
      - {kind: rod, from: [-16.0000, -35.0000, 0.0000], to: [-16.0000, -42.0000, 0.0000], radius: 1.2, collide: 0, color: "#a8865a"}
      - {kind: rod, from: [-16.0000, -17.5000, -30.3109], to: [-16.0000, -21.0000, -36.3731], radius: 1.2, collide: 0, color: "#a8865a"}
      - {kind: rod, from: [-16.0000, 17.5000, -30.3109], to: [-16.0000, 21.0000, -36.3731], radius: 1.2, collide: 0, color: "#a8865a"}
      - {kind: rod, from: [-18.0000, 0.0000, 0.0000], to: [-14.0000, 0.0000, 0.0000], radius: 3.2, collide: 0}
      - {kind: rod, from: [-22.0000, 0.0000, 0.0000], to: [17.0000, 0.0000, 0.0000], radius: 1.4, collide: 0, color: "#8f8a80"}
  - {id: g_top, shape: assembly, pos: [9.0, 40.0, 6.4], color: "#e6dcc4"}
  - {id: g_bot, shape: assembly, pos: [9.0, -40.0, 6.4], color: "#e6dcc4"}
  - {id: tiller, shape: assembly, pos: [72.0, 0, 6.4], color: "#bfae8c"}
wheels:
  - {id: drum, body: barrel, pos: [4.0, 0, 0], quat: [0.7071068, 0, 0, -0.7071068], radius: 6.0, width: 10, groove: 8.0, flange: 0.8, mass: 2.0, spokes: 0, hub: 5.4, color: "#ded2b6"}
  - {id: gt, body: g_top, pos: [0, 0, 0], quat: [0.7071068, 0.7071068, 0, 0], radius: 5.0, width: 2.4, groove: 1.0, flange: 0.6, mass: 0.5, spokes: 0, hub: 1.4, color: "#e6dcc4"}
  - {id: gb, body: g_bot, pos: [0, 0, 0], quat: [0.7071068, 0.7071068, 0, 0], radius: 5.0, width: 2.4, groove: 1.0, flange: 0.6, mass: 0.5, spokes: 0, hub: 1.4, color: "#e6dcc4"}
  - {id: boss, body: tiller, pos: [-44.0, 0, 0], quat: [0.7071068, 0.7071068, 0, 0], radius: 3.0, width: 2.4, groove: 1.0, flange: 0.6, mass: 0.4, spokes: 0, hub: 1.4, color: "#bfae8c"}
shafts:
  - {id: bar, body: tiller, from: [-42.0, 0, -3.2], to: [0, 0, -3.2], radius: 1.4}   # the tiller, under the rope's plane
  - {id: stock, body: tiller, from: [0, 0, -24], to: [0, 0, 0], radius: 3.2}   # the rudder head
joints:
  - {id: j_b, type: hinge, body: barrel, axis: [1, 0, 0], damping: 0.01}   # the hand-wheel and barrel: the one driven joint
  - {id: j_key, type: hinge, body: handwheel, axis: [1, 0, 0], range: [-0.0002, 0.0002], damping: 0.01}   # the hand-wheel keyed on the barrel's shaft
  - {id: j_gt, type: hinge, body: g_top, axis: [0, 0, 1], damping: 0.0005}
  - {id: j_gb, type: hinge, body: g_bot, axis: [0, 0, 1], damping: 0.0005}
  - {id: j_t, type: hinge, body: tiller, axis: [0, 0, 1], damping: 3, range: [-0.8, 0.8]}   # the rudder; + : the tiller's end to -y
belts:
  - id: rope
    # in the order the rope runs: off the top of the barrel to the upper guide, round it, to the boss on the tiller and
    # round its far side, to the lower guide, round it, and back on to the top of the barrel, a full turn round it
    around: [drum, gt, boss, gb]
    senses: [-1, -1, -1, -1]
    wraps: [{wheel: drum, turns: 1, advance: 2}]
    section: round
    links: 200
    segments: 20
    thickness: 0.8
    width: 0.8
    density: 950
    stiffness: 30000
    damping: 2
    pretension: 30
    joint_armature: 0.000001
    root_damping: 0.0001
    friction: 0.8
contact: {solref: [0.002, 1], solimp: [0.9, 0.95, 0.001], margin: 0}
driver: {joint: j_b, kind: velocity, rpm: 0, swing: {amplitude: 2.6, hz: 0.22}, kv: 20.0, max_torque: 200}
checks:
  - {type: follow, out: j_t, in: j_b, expect: -0.138, tol: 0.012, min_r2: 0.97, settle_s: 1.0, window_s: 6.5}
  - {type: penetration, max: 0.004, settle_s: 0.5}
camera: {target: [26, -12, 0], position: [26, -13, 330], fov: 24}
display:
  output: j_t
  labels: {j_b: "Hand-wheel and barrel (by hand)", j_gt: Upper guide pulley, j_gb: Lower guide pulley, j_t: Tiller}
