コード例 #1
0
        private void StartMeasurement()
        {
            m_isRunning = true;

            // Disable the start button if we're running the measurements.
            // Enable the stop button as a result.
            startButton.interactable = false;
            stopButton.interactable  = true;

            m_forceTrackTime = 0.0f;

            lineGraph.ClearPlot(Constants.FORCE_PLOT_SERIES_NAME);

            NetOutMessage outMessage = new NetOutMessage();

            outMessage.WriteInt32((int)MessageType.Command.Control);
            outMessage.WriteInt32((int)MessageType.ControlType.Start);

            List <Finger> fingersToPress = new List <Finger>();

            for (int i = 0; i < 5; i++)
            {
                Finger temp   = (Finger)i;
                Toggle toggle = GetFingerToggle(temp);
                if (toggle.isOn)
                {
                    fingersToPress.Add(temp);
                }
            }

            outMessage.WriteInt32(fingersToPress.Count);
            for (int i = 0; i < fingersToPress.Count; i++)
            {
                outMessage.WriteInt32((int)fingersToPress[i]);
            }

            double totalMaxForce = 0.0;

            foreach (Finger finger in Constants.FINGER_LIST)
            {
                totalMaxForce += m_appState.GetCurrentHandData().GetFingerMaxForce(finger) - m_appState.GetCurrentHandData().GetFingerBaseForce(finger);
            }
            lineGraph.maxY = (float)totalMaxForce;

            outMessage.WriteDouble(totalMaxForce);
            outMessage.WriteFloat(m_appState.StaticPhaseDuration);
            outMessage.WriteFloat(m_appState.IncreasingPhaseDuration);
            outMessage.WriteFloat(m_appState.PlateauPhaseDuration);
            outMessage.WriteFloat(m_appState.DecreasingPhaseDuration);
            outMessage.WriteFloat(m_appState.StaticEndPhaseDuration);
            outMessage.WriteDouble(GetPlateauPhaseValue());

            m_udpHelper.Send(outMessage, m_appState.HololensIP, Constants.NETWORK_PORT);
        }
コード例 #2
0
        private void Update()
        {
            if (m_isRunning)
            {
                m_measurementTimer += Time.deltaTime;
                if (m_measurementTimer >= m_measurementDuration)
                {
                    m_currentFingerIndex = GetNextFingerIndex();
                    if (m_currentFingerIndex != -1)
                    {
                        m_measurementTimer = 0.0f;

                        UpdateIndicators();
                        UpdateTargetForceLines();

                        NetOutMessage message = new NetOutMessage();
                        message.WriteInt32((int)MessageType.Command.Control);
                        message.WriteInt32((int)MessageType.ControlType.Start);
                        message.WriteInt32(m_currentFingerIndex);
                        for (int i = 0; i < 5; i++)
                        {
                            message.WriteInt32(i);
                            message.WriteDouble(GetFingerGraph((Finger)i).targetValue);
                        }
                        m_udpHelper.Send(message, m_appState.HololensIP, Constants.NETWORK_PORT);
                    }
                    else
                    {
                        StopMeasurement();
                    }
                }
            }
        }
コード例 #3
0
        private void StartMeasurement()
        {
            m_remainingFingers.Clear();
            for (int i = 0; i < 5; i++)
            {
                m_remainingFingers.Add((Finger)i);
            }

            m_currentFingerIndex = GetNextFingerIndex();
            if (m_currentFingerIndex < 0)
            {
                return;
            }

            m_isRunning = true;

            // Disable the start button if we're running the measurements.
            // Enable the stop button as a result.
            startButton.interactable = false;
            stopButton.interactable  = true;

            m_measurementTimer = 0.0f;

            UpdateIndicators();
            UpdateTargetForceLines();

            NetOutMessage message = new NetOutMessage();

            message.WriteInt32((int)MessageType.Command.Control);
            message.WriteInt32((int)MessageType.ControlType.Start);
            message.WriteInt32(m_currentFingerIndex);
            for (int i = 0; i < 5; i++)
            {
                message.WriteInt32(i);
                message.WriteDouble(GetFingerGraph((Finger)i).targetValue);
            }
            m_udpHelper.Send(message, m_appState.HololensIP, Constants.NETWORK_PORT);
        }