def test_inst(self): self.cfg = ConfigParser() self.cfg.read(os.getenv("MACHINEKIT_INI")) self.uuid = self.cfg.get("MACHINEKIT", "MKUUID") rt = rtapi.RTAPIcommand(uuid=self.uuid) rt.loadrt("icomp"); rt.newinst("icomp","foo") assert len(hal.instances) == 1 rt.newinst("icomp","bar") assert len(hal.instances) == 2 rt.delinst("foo") assert len(hal.instances) == 1 with pytest.raises(RuntimeError): # HAL error: duplicate component name 'icomp' c = hal.Component("icomp") c = hal.components["icomp"] for name in hal.instances: inst = hal.instances[name] assert c.id == inst.owner_id assert c.name == inst.owner.name assert "foo" in hal.instances assert "bar" in hal.instances assert hal.instances["foo"].size > 0 assert hal.instances["bar"].size > 0 try: x = hal.instances["nonexistent"] raise "should not happen" except NameError: pass
def setUp(self): self.cfg = ConfigParser() self.cfg.read(os.getenv("MACHINEKIT_INI")) self.uuid = self.cfg.get("MACHINEKIT", "MKUUID") self.rt = rtapi.RTAPIcommand(uuid=self.uuid) self.rt.newinst("or2", "or2.0") self.rt.newthread("servo-thread",1000000,fp=True) hal.addf("or2.0","servo-thread") hal.start_threads()
def setUp(self): global rt self.cfg = ConfigParser() self.cfg.read(os.getenv("MACHINEKIT_INI")) self.uuid = self.cfg.get("MACHINEKIT", "MKUUID") rt = rtapi.RTAPIcommand(uuid=self.uuid)
def test_rtapi_connect(self): global uuid, rt cfg = ConfigParser() cfg.read(os.getenv("MACHINEKIT_INI")) uuid = cfg.get("MACHINEKIT", "MKUUID") rt = rtapi.RTAPIcommand(uuid=uuid)
import os from six.moves import configparser from machinekit.hal import cyruntime, cyhal # retrieve the machinekit UUID cfg = configparser.ConfigParser() cfg.read(os.getenv("MACHINEKIT_INI")) uuid = cfg.get("MACHINEKIT", "MKUUID") # open a command channel to rtapi_app rt = cyruntime.RTAPIcommand(uuid=uuid)
def test_rtapi_connect(self): global rt rt = rtapi.RTAPIcommand(uuid=uuid)