public void SwitchState(SetupStates state)
    {
        if (SetupState != state)
        {
            switch (state)
            {
            case SetupStates.FindFloor:
                SetupStepDescription.gameObject.SetActive(true);

                ConfirmFloorPanel.SetActive(false);
                break;

            case SetupStates.ConfirmFloor:
                SetupStepDescription.gameObject.SetActive(false);

                ConfirmFloorPanel.SetActive(true);
                break;

            case SetupStates.AddObstacles:
                ConfirmFloorPanel.SetActive(false);

                SetupStepDescription.gameObject.SetActive(true);
                SetupStepDescription.text = "Now add some environment objects by scanning and clicking on things";
                break;
            }

            SetupState = state;
        }
    }
Example #2
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     if ( (int)currentState - 1 >= 0 )
         currentState = (SetupStates)((int)currentState - 1);
     if (radioGMail.Checked && (int)currentState > 1)
         currentState = SetupStates.SS_Identity;
     setState(currentState);
 }
Example #3
0
        private void setState(SetupStates state)
        {
            switch (state)
            {
                case SetupStates.SS_AccountType:
                    lblTitle.Text = "New Account Setup";
                    resetPanels();
                    panelSetAccount.Show();
                    break;

                case SetupStates.SS_Identity:
                    lblTitle.Text = "Identity";
                    resetPanels();
                    panelIdentity.Show();
                    break;

                case SetupStates.SS_ServerInfo:
                    lblTitle.Text = "Server Information";
                    resetPanels();

                    // auto fill-in info
                    string[] creds = txtEmailAddress.Text.Trim().Split('@');
                    txtIncomingServer.Text = creds[1];
                    txtUserName.Text = creds[0];
                    txtSMTP.Text = creds[1];
                    txtSMTPUsername.Text = creds[0];

                    panelServerInformation.Show();
                    break;

                case SetupStates.SS_UserNames:
                    lblTitle.Text = "User Names";
                    resetPanels();
                    panelUserNames.Show();
                    break;

                case SetupStates.SS_SMTP:
                    lblTitle.Text = "SMTP Settings";
                    btnNext.Text = "&Next >";
                    resetPanels();
                    panelSMTP.Show();
                    break;

                case SetupStates.SS_Review:
                    lblTitle.Text = "Congratulations!";
                    btnNext.Text = "Finish";
                    resetPanels();
                    panelReview.Show();

                    if ( radioGMail.Checked )
                    {
                        // preconfigure hashtable with GMAIL settings
                        doGmailSetup();
                    }
                    else
                    {
                        this.hashAccountInfo["full_name"] = txtYourName.Text.Trim();
                        this.hashAccountInfo["email"] = txtEmailAddress.Text.Trim();
                        this.hashAccountInfo["incoming_server"] = txtIncomingServer.Text.Trim();
                        this.hashAccountInfo["incoming_port"] = txtIncomingServerPort.Text.Trim();
                        this.hashAccountInfo["incoming_security"] = "No"; //TODO: HARDCODED?
                        this.hashAccountInfo["username"] = txtUserName.Text.Trim();
                        this.hashAccountInfo["server_type"] =
                            radioIMAP.Checked ? "imap" : (radioPOP.Checked ? "pop" : "undefined");
                        this.hashAccountInfo["smtp_server"] = txtSMTP.Text.Trim();
                        this.hashAccountInfo["smtp_port"] = txtSMTPPort.Text.Trim();
                        this.hashAccountInfo["smtp_username"] = txtSMTPUsername.Text.Trim();
                        this.hashAccountInfo["smtp_security"] =
                            radioSecNo.Checked ? "No" :
                            radioSecTLSIf.Checked ? "TLSIF" :
                            radioTLS.Checked ? "TLS" :
                            radioSSL.Checked ? "SSL" : "No";
                    }

                    // show info
                    lblReviewAll.Text = "Full Name: " + this.hashAccountInfo["full_name"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Email Address: " + this.hashAccountInfo["email"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Incoming User Name: " + this.hashAccountInfo["username"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Incoming Server Name: " + this.hashAccountInfo["incoming_server"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Incoming Server Port: " + this.hashAccountInfo["incoming_port"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Incoming Server Type: " + this.hashAccountInfo["server_type"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Outgoing Server Name (SMTP): " + this.hashAccountInfo["smtp_server"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Outgoing Server Port: " + this.hashAccountInfo["smtp_port"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Outgoing Server User Name: " + this.hashAccountInfo["smtp_username"];
                    break;
            }
            currentState = state;
        }
Example #4
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     if ( (int)currentState - 1 >= 0 )
         currentState = (SetupStates)((int)currentState - 1);
     setState(currentState);
 }
Example #5
0
        private void setState(SetupStates state)
        {
            switch (state)
            {
                case SetupStates.SS_General:
                    lblTitle.Text = "EmEx General Configuration";
                    btnNext.Text = "Next >";
                    resetPanels();
                    panelGeneral.Show();
                    break;

                case SetupStates.SS_Review:
                    lblTitle.Text = "Congratulations!";
                    btnNext.Text = "Finish";
                    resetPanels();
                    panelReview.Show();

                    this.hashAccountInfo["backend_server"] = txtBackendServer.Text.Trim();
                    this.hashAccountInfo["backend_port"] = txtBackendPort.Text.Trim();
                    this.hashAccountInfo["backend_path"] = txtBackendPath.Text.Trim();
                    this.hashAccountInfo["backend_user"] = txtBackendUser.Text.Trim();
                    this.hashAccountInfo["backend_pass"] = txtBackendPassword.Text.Trim();

                    // show info
                    lblReviewAll.Text = "Backend Server: " + this.hashAccountInfo["backend_server"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Backend Port: " + this.hashAccountInfo["backend_port"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Backend Username: "******"backend_user"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Backend Password: "******"backend_pass"];
                    lblReviewAll.Text += Environment.NewLine;
                    lblReviewAll.Text += "Backend Path: " + this.hashAccountInfo["backend_path"];
                    lblReviewAll.Text += Environment.NewLine;
                    break;
            }
            currentState = state;
        }
    // Update is called once per frame
    void Update()
    {
        // Report hand positions to Python script once per second
        if (currState == States.Playtime)
        {
            textTitle.text = "Robot Control Phase";
            elapsedTime   += Time.deltaTime;
            if (elapsedTime >= clientObject.SendFrequency)
            {
                string LArmMessage = ((leftHand.transform.position - leftHandDimens[0]) / leftHandDimens[2].y).ToString("G4");
                string RArmMessage = ((rightHand.transform.position - rightHandDimens[0]) / rightHandDimens[2].y).ToString("G4");

                // Send arm positions to server
                if (clientObject.serverConnection.isConnected)
                {
                    clientObject.serverConnection.fnPacketTest("MOVE|LArm|" + LArmMessage);
                    clientObject.serverConnection.fnPacketTest("MOVE|RArm|" + RArmMessage);
                }

                // Reset timer
                elapsedTime = 0.0f;
            }
        }
        else
        {
            switch (currSetupState)
            {
            case SetupStates.AskForArmsDown:
                textUI.text = "Place your left and right hands straight down at your sides. Then press either your left or right hand trigger.";
                if (OVRInput.GetDown(OVRInput.RawButton.LIndexTrigger | OVRInput.RawButton.RIndexTrigger, OVRInput.Controller.RTouch | OVRInput.Controller.LTouch))
                {
                    // Initial left and right hand positions
                    leftHandDimens[0]  = leftHand.transform.position;
                    rightHandDimens[0] = rightHand.transform.position;
                    textStats.text     = "Left hand: " + leftHandDimens[0] + "\nRight Hand: " + rightHandDimens[0];
                    currSetupState     = SetupStates.AskForArmsUp;
                }
                break;

            case SetupStates.AskForArmsUp:
                textUI.text = "Raise your left and right hands straight up. Then press either your left or right hand trigger.";
                if (OVRInput.GetDown(OVRInput.RawButton.LIndexTrigger | OVRInput.RawButton.RIndexTrigger, OVRInput.Controller.RTouch | OVRInput.Controller.LTouch))
                {
                    Vector3 leftArmLength = (leftHand.transform.position - leftHandDimens[0]) / 2;
                    // Shoulder pos = halfway between lowered hand and raised hand
                    leftHandDimens[1] = leftHandDimens[0] + leftArmLength;
                    // Arm length - magnitude of vector from lowered hand to shoulder
                    leftHandDimens[2] = new Vector3(0, Vector3.Magnitude(leftArmLength), 0);

                    Vector3 rightArmLength = (rightHand.transform.position - rightHandDimens[0]) / 2;
                    // Shoulder pos = halfway between lowered hand and raised hand
                    rightHandDimens[1] = rightHandDimens[0] + rightArmLength;
                    // Arm length - magnitude of vector from lowered hand to shoulder
                    rightHandDimens[2] = new Vector3(0, Vector3.Magnitude(rightArmLength), 0);

                    textStats.text = "Recorded Arm Lengths: " + leftHandDimens[2].y + " (L), " + rightHandDimens[2].y + " (R)\n"
                                     + "Initial Hand Positions: " + leftHandDimens[0] + " (L), " + rightHandDimens[0] + " (R)\n"
                                     + "Shoulders: " + leftHandDimens[1] + " (L), " + rightHandDimens[1] + " (R)\n";;
                    currSetupState = SetupStates.Done;
                }
                break;

            default:     // Done
                textUI.text = "Calibrated! Arm coordinates are sent to NAO every 5 seconds. Please stand still while " +
                              "controlling NAO.";
                currState = States.Playtime;
                break;
            }
        }
    }