Beispiel #1
0
 public Result ResetZ1()
 {
     _log.Debug("Z1 go original position");
     Device?.GoOrigin(DS102.AXIS_Z1);
     Z1Position = 0;
     Observer?.Invoke("Z1", Z1Position);
     return(new Result("Ok"));
 }
Beispiel #2
0
        private void Config_LogKalmanDataReceived(object sender, LogDataReceivedEventArgs e)
        {
            _firstValueTracked = true;

            _historyVarianceX.Add((float)e.GetVariable("kalman.varPX"));
            _historyVarianceY.Add((float)e.GetVariable("kalman.varPY"));
            _historyVarianceZ.Add((float)e.GetVariable("kalman.varPZ"));

            _historyVarianceX.RemoveAt(0);
            _historyVarianceY.RemoveAt(0);
            _historyVarianceZ.RemoveAt(0);

            VarianceX = CalculatueMax(_historyVarianceX) - CalculatueMin(_historyVarianceX);
            VarianceY = CalculatueMax(_historyVarianceY) - CalculatueMin(_historyVarianceY);
            VarianceZ = CalculatueMax(_historyVarianceZ) - CalculatueMin(_historyVarianceZ);

            CurrentPosition = new Position((float)e.GetVariable("kalman.stateX"), (float)e.GetVariable("kalman.stateY"), (float)e.GetVariable("kalman.stateZ"));
            PositionUpdate?.Invoke(this, new PositionUpdateEventArgs(CurrentPosition));
            _waitForVarianceUpdate.Set();
        }
Beispiel #3
0
    void HandleInboundMessage(UdpMessage message)
    {
        switch (message.Event)
        {
        case "connected": Connected?.Invoke(); break;

        case "position": PositionUpdate?.Invoke(Deserialize <PositionUpdate>(message.Data.ToString())); break;

        case "newplayer": NewPlayer?.Invoke(new Guid(message.Data.ToString())); break;

        case "playerdisconnected": PlayerDisconnected?.Invoke(new Guid(message.Data.ToString())); break;

        case "newnetobj": NewNetObj?.Invoke(Deserialize <NetObj>(message.Data.ToString())); break;

        case "destroynetobj": NetObjDestroyed?.Invoke(new Guid(message.Data.ToString())); break;

        case "owner-changed": OwnerChanged?.Invoke(new Guid(message.Data.ToString())); break;

        default: Debug.LogError("Received invalid inbound message event: " + message.Event); break;
        }
    }