def test_get_encoder(self): enc = emotion.get_encoder("m0enc") self.assertTrue(enc) self.assertEquals(enc.steps_per_unit, 50) m0 = emotion.get_axis("m0") self.assertEquals(m0.encoder, enc) m1 = emotion.get_axis("m1") self.assertEquals(m1.encoder, None)
def test_maxee(self): m1 = emotion.get_axis("m1") m1.move(1) self.assertEquals(m1.position(), 1) m0 = emotion.get_axis("m0") m0.dial(0); m0.position(0) self.assertRaises(RuntimeError, m0.move, 1) enc = emotion.get_encoder("m0enc") enc.set(2) m0.move(2) self.assertEquals(m0.position(), 2)
def test_encoder_set_position(self): myenc = emotion.get_encoder("myenc") pos = 2.0 # given in mm self.assertEqual(myenc.set(pos), pos)
def test_encoder_get_position(self): myenc = emotion.get_encoder("myenc") #myenc.controller.log_level(emotion.log.INFO) pos = myenc.read()
def test_encoder_creation(self): myenc = emotion.get_encoder("myenc") self.assertTrue(myenc)
def test_tolerance(self): enc = emotion.get_encoder("m0enc") self.assertEquals(enc.tolerance, 0.001)
def test_encoder_set(self): m0 = emotion.get_axis("m0") enc = emotion.get_encoder("m0enc") self.assertEquals(enc.set(133), 133)
def test_encoder_read(self): m0 = emotion.get_axis("m0") enc = emotion.get_encoder("m0enc") self.assertEquals(enc.read(), m0.dial()/enc.steps_per_unit)
def test_encoder(self): encA = emotion.get_encoder("encA") self.assertTrue(encA) print "PI_E517 encoder : ", encA.read()