public bool increment(double time)
        {
            _cumulativeLag += AnimusUtils.ConvertToTimestamp(DateTime.Now) - time;
            _count++;
            if (_count < _interval)
            {
                return(false);
            }

            var numMs = _stpw.ElapsedMilliseconds;

            AverageFps = ((float)_count) / (numMs / 1000.0f);
            AverageLag = (float)_cumulativeLag * 1000 / _count;

            if (verbose)
            {
                if (time < 0)
                {
                    Debug.Log($"{_channelName} : {AverageFps:F2} ------- {_desc}");
                }
                else
                {
                    Debug.Log($"{_channelName} : {AverageFps:F2} ------- {AverageLag:F2}ms lag -- {_desc}");
                }
            }
            _cumulativeLag = 0;
            _count         = 0;
            _stpw.Reset();
            _stpw.Start();
            return(true);
        }
        private void Update()
        {
            if (!_modalityEnabled || internalFlag)
            {
                return;
            }

            try
            {
                threadNewSamp = AnimusClient.AnimusClient.GetModality(robotID, modalityName, false);
                if (threadNewSamp == null)
                {
                    return;
                }

                if (threadNewSamp.Error != null)
                {
                    if (threadNewSamp.Error.Success)
                    {
                        updateNewSamp = AnimusUtils.DecodeData(threadNewSamp.Sample);
                        setModality.Invoke(client, new object[] { updateNewSamp.Data });
                        setModalityFPS.increment(-1);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.Log($"Set Modality error for {modalityName} modality: {e}");
            }
        }