code: function _checkMasterHelper(timeout=100, maxTimeout=-1) {
    const startTime = Date.now();
  
    const localHelper = (resolve,reject) => {
      pingMasterTimeout = setTimeout(() => {
        // also check that the slave api server is set up
        if (!ThisNode.node.slaveApiSetupComplete()) {
          if (Date.now() - startTime >= maxTimeout && maxTimeout >= 0) {
            log.error(`Unable to register with master node [${ThisNode.node.getRosMasterUri()}]: unable to set up slave API Server. Stopping...`);
            reject(new Error('Unable to setup slave API server.'));
            return;
          }
          localHelper(resolve, reject);
          return;
        }
        ThisNode.node.getMasterUri({ maxAttempts: 1 })
        .then(() => {
          log.infoOnce(`Connected to master at ${ThisNode.node.getRosMasterUri()}!`);
          pingMasterTimeout = null;
          resolve();
        })
        .catch((err, resp) => {
          if (Date.now() - startTime >= maxTimeout && !(maxTimeout < 0) ){
            log.error(`Timed out before registering with master node [${ThisNode.node.getRosMasterUri()}]: master may not be running yet.`);
            reject(new Error('Registration with master timed out.'));
            return;
          } else {
            log.warnThrottle(60000, `Unable to register with master node [${ThisNode.node.getRosMasterUri()}]: master may not be running yet. Will keep trying.`);
            localHelper(resolve, reject);
          }
        });
      }, timeout);
    };
  
    return new Promise((resolve, reject) => {
      localHelper(resolve,reject);
    });
  }
docs: ------------------------------------------------------------------ Local Helper Functions ------------------------------------------------------------------ 
  @private
  Helper function to see if the master is available and able to accept
  connections.
  @param {number} timeout time in ms between connection attempts
  @param {number} maxTimeout maximum time in ms to retry before timing out.
  A negative number will make it retry forever. 0 will only make one attempt
  before timing out.