def test_start_tracking(): """ test start tracking reqs: """ tracker = NDITracker(SETTINGS_DUMMY) with pytest.raises(ValueError): tracker.start_tracking() tracker.close()
def configure_tracker(config): """ Configures the tracking system. :param: A dictionary containing configuration data :return: The tracker object :raises: KeyError if no tracker entry in config """ if "tracker type" not in config: raise KeyError('Tracker configuration requires tracker type') tracker_type = config.get("tracker type") tracker = None if tracker_type in ("vega", "polaris", "aurora", "dummy"): tracker = NDITracker(config) if tracker_type in "aruco": tracker = ArUcoTracker(config) tracker.start_tracking() return tracker
def configure_tracker(config): """ Configures a scikit-surgery tracker based on the passed config :param config: a tracker configuration dictionary :returns: The tracker :raises: KeyError """ if "tracker type" not in config: raise KeyError('Tracker configuration requires tracker type') tracker_type = config.get("tracker type") tracker = None if tracker_type in ("vega", "polaris", "aurora", "dummy"): tracker = NDITracker(config) if tracker_type in "aruco": tracker = ArUcoTracker(config) if tracker_type not in "dummy": tracker.start_tracking() return tracker
def run(): """Demonstration program Example showing how to initialise, configure, and communicate with NDI Polaris, Vega, and Aurora trackers. Configuration is by python dictionaries, edit as necessary. Dictionaries for other systems: settings_polaris = {"tracker type": "polaris", "romfiles" : ["../data/8700339.rom"]} settings_aurora = { "tracker type": "aurora", "ports to use" : [1,2]} settings_dummy = {"tracker type": "dummy",} """ settings_vega = { "tracker type": "vega", "ip address": "192.168.2.17", "port": 8765, "romfiles": ["../data/8700339.rom", "../data/something_else.rom"] } tracker = NDITracker(settings_vega) tracker.start_tracking() six.print_(tracker.get_tool_descriptions()) for _ in range(20): six.print_(tracker.get_frame()) time.sleep(0.300333) tracker.stop_tracking() tracker.close()