Exemple #1
0
    def __init__(self, table, silent=False):
        super().__init__()
        LOG.info('NetworkTablePublisher initialized for table "{}"'.format(table))

        try:
            NetworkTable.checkInit()
        except RuntimeError:
            # An exception is raised if NetworkTables was initialized
            pass
        else:
            # Since no exception was raised, NetworkTables is not initialized
            error = 'NetworkTables is not initialized. Call "init_network_tables()" '
            error += 'prior to instantiating this class.'
            raise RuntimeError(error)

        # For access by other methods for debugging
        self.table_name = table

        # We'll be pushing our own values to this table
        self.nt = NetworkTable.getTable(table)

        # Don't log anything to the console if silent
        self.silent = silent