def linear_2_stages(): g1 = SpurGear(10, 0.5, 0, 8) g2 = SpurGear(50, 0.5, 0, 8) g3 = SpurGear(13, 0.5, 0, 12) g4 = SpurGear(78, 0.5, 0, 12) a = Actuator(components=[GearPair(g1, g2, 0, 0), GearPair(g3, g4, 10, 0)]) return a
def broken_motored_2_stages(): s = Stepper('A', motor_data['A']) g1 = SpurGear(10, 0.8, 0, 8) g2 = SpurGear(50, 0.8, 0, 8) g3 = SpurGear(13, 0.5, 0, 12) g4 = SpurGear(80, 0.5, 0, 12) comp = [s, GearPair(g1, g2, 10, 0), GearPair(g3, g4, -3, -2.3)] return Actuator(components=comp)
def impossible_motored_2_stages(): s = Stepper('B', motor_data['B']) g1 = SpurGear(10, 0.8, 0, 8) g2 = SpurGear(35, 0.8, 0, 8) g3 = SpurGear(25, 0.5, 0, 12) g4 = SpurGear(80, 0.5, 0, 12) comp = [s, GearPair(g1, g2, 10, 0), GearPair(g3, g4, -30, -2.3)] a = Actuator(components=comp) return a
def good_motored_2_stages(): s = Stepper('A', motor_data['A']) g1 = SpurGear(17, 0.5, 0.15, 8) g2 = SpurGear(60, 0.5, -0.15, 8) g3 = SpurGear(17, 0.5, 0.15, 12) g4 = SpurGear(78, 0.5, -0.15, 12) comp = [s, GearPair(g1, g2, 10, 0), GearPair(g3, g4, 10, -2.3)] a = Actuator(components=comp) return a
def test_gear_mesh_small_stretch(): g1 = SpurGear(25, 0.5, 0, 10) g2 = SpurGear(80, 0.5, 0, 10) gp = GearPair(g1, g2, GearPair.stretch_margin / 2, 0) actuator = Actuator(components=[gp]) meshes, _, space = actuator.mesh assert np.allclose(space.bounds[:, 2], [gp.disp, gp.disp + 5.]) assert np.allclose(meshes[0].bounds[:, 2], [gp.disp, gp.disp + 5.]) assert np.allclose(meshes[1].bounds[:, 2], [gp.disp, gp.disp + 5.])
def test_gear_mesh_minus_stretch(): g1 = SpurGear(25, 0.5, 0, 10) g2 = SpurGear(80, 0.5, 0, 10) gp = GearPair(g1, g2, -10, 0) actuator = Actuator(components=[gp]) meshes, _, space = actuator.mesh assert np.allclose(space.bounds[:, 2], [-15., -gp.stretch_margin]) assert np.allclose(meshes[0].bounds[:, 2], [-15., -gp.stretch_margin]) assert np.allclose(meshes[1].bounds[:, 2], [-15., -10.])