def test_move(self): lasersaur.absolute() pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(0), DEC) self.assertAlmostEqual(pos[1], stepY(0), DEC) self.assertAlmostEqual(pos[2], stepZ(0), DEC) lasersaur.move(3, 4, 5) time.sleep(2) pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(3), DEC) self.assertAlmostEqual(pos[1], stepY(4), DEC) self.assertAlmostEqual(pos[2], stepZ(5), DEC) #relative lasersaur.relative() lasersaur.move(2, 2, 2) time.sleep(2) pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(5), DEC) self.assertAlmostEqual(pos[1], stepY(6), DEC) self.assertAlmostEqual(pos[2], stepZ(7), DEC) # absolute after relative lasersaur.absolute() lasersaur.move(0, 0, 0) time.sleep(2) pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(0), DEC) self.assertAlmostEqual(pos[1], stepY(0), DEC) self.assertAlmostEqual(pos[2], stepZ(0), DEC)
def test_move(self): lasersaur.absolute() pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(0), DEC) self.assertAlmostEqual(pos[1], stepY(0), DEC) self.assertAlmostEqual(pos[2], stepZ(0), DEC) lasersaur.move(3,4,5) time.sleep(2) pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(3), DEC) self.assertAlmostEqual(pos[1], stepY(4), DEC) self.assertAlmostEqual(pos[2], stepZ(5), DEC) #relative lasersaur.relative() lasersaur.move(2,2,2) time.sleep(2) pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(5), DEC) self.assertAlmostEqual(pos[1], stepY(6), DEC) self.assertAlmostEqual(pos[2], stepZ(7), DEC) # absolute after relative lasersaur.absolute() lasersaur.move(0,0,0) time.sleep(2) pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(0), DEC) self.assertAlmostEqual(pos[1], stepY(0), DEC) self.assertAlmostEqual(pos[2], stepZ(0), DEC)
def test_feedrate_intensity(self): new_rate = 4500.1 new_intens = 210 lasersaur.feedrate(new_rate) lasersaur.intensity(new_intens) time.sleep(1) s = lasersaur.status() self.assertAlmostEqual(s['feedrate'], new_rate, DEC) self.assertAlmostEqual(s['intensity'], new_intens, DEC)
def test_feedrate_intensity(self): new_rate = 4500.1 new_intens = 210 lasersaur.feedrate(new_rate) lasersaur.intensity(new_intens) time.sleep(1) s = lasersaur.status() self.assertAlmostEqual(s['feedrate'], new_rate, DEC) self.assertAlmostEqual(s['intensity'], new_intens, DEC)
def test_offset(self): lasersaur.absolute() lasersaur.move(15.123, 15.123, 15.123) time.sleep(2) pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(15.123), DEC) self.assertAlmostEqual(pos[1], stepY(15.123), DEC) self.assertAlmostEqual(pos[2], stepZ(15.123), DEC) lasersaur.offset(4, 4, 4) time.sleep(1) off = lasersaur.status()['offset'] self.assertAlmostEqual(off[0], 4, DEC) self.assertAlmostEqual(off[1], 4, DEC) self.assertAlmostEqual(off[2], 4, DEC) # pos after offset change pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(11.123, 4), DEC) self.assertAlmostEqual(pos[1], stepY(11.123, 4), DEC) self.assertAlmostEqual(pos[2], stepZ(11.123, 4), DEC) # move with offset lasersaur.move(16.543, 16.543, 16.543) time.sleep(2) pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(16.543, 4), DEC) self.assertAlmostEqual(pos[1], stepY(16.543, 4), DEC) self.assertAlmostEqual(pos[2], stepZ(16.543, 4), DEC) # clear offset lasersaur.clear_offset() time.sleep(1) off = lasersaur.status()['offset'] self.assertAlmostEqual(off[0], 0, DEC) self.assertAlmostEqual(off[1], 0, DEC) self.assertAlmostEqual(off[2], 0, DEC) # pos after clear offset pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(20.543), DEC) self.assertAlmostEqual(pos[1], stepY(20.543), DEC) self.assertAlmostEqual(pos[2], stepZ(20.543), DEC)
def test_offset(self): lasersaur.absolute() lasersaur.move(15.123,15.123,15.123) time.sleep(2) pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(15.123), DEC) self.assertAlmostEqual(pos[1], stepY(15.123), DEC) self.assertAlmostEqual(pos[2], stepZ(15.123), DEC) lasersaur.offset(4,4,4) time.sleep(1) off = lasersaur.status()['offset'] self.assertAlmostEqual(off[0], 4, DEC) self.assertAlmostEqual(off[1], 4, DEC) self.assertAlmostEqual(off[2], 4, DEC) # pos after offset change pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(11.123, 4), DEC) self.assertAlmostEqual(pos[1], stepY(11.123, 4), DEC) self.assertAlmostEqual(pos[2], stepZ(11.123, 4), DEC) # move with offset lasersaur.move(16.543,16.543,16.543) time.sleep(2) pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(16.543, 4), DEC) self.assertAlmostEqual(pos[1], stepY(16.543, 4), DEC) self.assertAlmostEqual(pos[2], stepZ(16.543, 4), DEC) # clear offset lasersaur.clear_offset() time.sleep(1) off = lasersaur.status()['offset'] self.assertAlmostEqual(off[0], 0, DEC) self.assertAlmostEqual(off[1], 0, DEC) self.assertAlmostEqual(off[2], 0, DEC) # pos after clear offset pos = lasersaur.status()['pos'] self.assertAlmostEqual(pos[0], stepX(20.543), DEC) self.assertAlmostEqual(pos[1], stepY(20.543), DEC) self.assertAlmostEqual(pos[2], stepZ(20.543), DEC)
def test_status(self): s = lasersaur.status() self.assertIsInstance(s, dict) self.assertIn('appver', s.keys()) self.assertIn('firmver', s.keys())
def test_status(self): s = lasersaur.status() self.assertIsInstance(s, dict) self.assertIn('appver', s.keys()) self.assertIn('firmver', s.keys())