public void teleopTarget(String request)
        {
            JObject msg = JObject.Parse(request);

            switch (msg["command"].ToString().Replace("\"", ""))
            {
            case "forward":
                parent.moveForward(conf.getPublicationList());
                break;

            case "backward":
                parent.moveBackward(conf.getPublicationList());
                break;

            case "left":
                parent.moveLeft(conf.getPublicationList());
                break;

            case "right":
                parent.moveRight(conf.getPublicationList());
                break;

            case "inc_velocity":
                parent.increaseVelocity();
                break;

            case "dec_velocity":
                parent.decreaseVelocity();
                break;

            case "stop":
                parent.stopTarget(conf.getPublicationList());
                break;

            case "inc_ang":
                parent.increaseAngVelocity();
                break;

            case "dec_ang":
                parent.decreaseAngVelocity();
                break;
            }
        }
Exemple #2
0
        private void Window_KeyDown_1(object sender, KeyEventArgs e)
        {
            double vel;

            switch (e.Key)
            {
            case Key.W:
                lblTargetState.Content = "Target is moving forward";
                moveForward();
                break;

            case Key.A:
                lblTargetState.Content = "Target is moving left";
                moveLeft();
                break;

            case Key.D:
                lblTargetState.Content = "Target is moving right";
                moveRight();
                break;

            case Key.S:
                lblTargetState.Content = "Target is moving backwards";
                moveBackward();
                break;

            case Key.X:
                lblTargetState.Content = "Target is stopped";
                moveStopped();
                break;

            case Key.Add:
                Double.TryParse(txtLgth.Text, out vel);
                bridgeLogic.increaseVelocity();
                updateVelocityState();
                txtLgth.Text = bridgeLogic.current_velocity.ToString();
                //txtLgth.Text = (vel + 0.1).ToString();
                break;

            case Key.Subtract:
                Double.TryParse(txtLgth.Text, out vel);
                bridgeLogic.decreaseVelocity();
                updateVelocityState();
                txtLgth.Text = bridgeLogic.current_velocity.ToString();
                //txtLgth.Text = (vel - 0.1).ToString();
                break;

            case Key.K:
                Double.TryParse(txtTheta.Text, out vel);
                //txtTheta.Text = (vel + 15).ToString();
                bridgeLogic.increaseAngVelocity();
                txtTheta.Text = radToDeg(bridgeLogic.current_angVelocity).ToString();
                break;

            case Key.L:
                Double.TryParse(txtTheta.Text, out vel);
                //txtTheta.Text = (vel - 15).ToString();
                bridgeLogic.decreaseAngVelocity();
                txtTheta.Text = radToDeg(bridgeLogic.current_angVelocity).ToString();
                break;
            }
        }