示例#1
0
        // Move fuctions
        private void StopMovement()
        {
            MotorSpeedModels speed = new MotorSpeedModels();

            speed.ForwardSpeed  = 0;
            speed.BackwardSpeed = 0;
            speed.LeftSpeed     = 0;
            speed.RightSpeed    = 0;
            MovementTimer.Stop();
            LemurianHub.LemurianMove("stop", speed);
        }
示例#2
0
        public void LemurianMove(string direction, MotorSpeedModels speed)
        {
            // only get movement controls from the master controller and
            // send the navigation info only to the motor
            var masterId = SignalRClients["master"];
            var motorId  = SignalRClients["motor"];

            if (ControllerMotorPass())
            {
                LemurianHubContext.Clients.Client(motorId).MoveRobot(direction, speed.ForwardSpeed, speed.BackwardSpeed, speed.LeftSpeed, speed.RightSpeed);
            }
        }
示例#3
0
        public MainPage()
        {
            this.InitializeComponent();
            SelectPage("loading");
            ledStripLights = new LEDStripLight();
            notifiers      = new MainPageNotifiers();
            speed          = new MotorSpeedModels();

            ApplicationView.PreferredLaunchViewSize      = new Size(700, 450);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            // When the app loses focus make sure to shut down the bot
            Window.Current.Activated += Current_Activated;
        }
示例#4
0
        private string MoveCommands(string returnMessage, MessageReplyModels messageReply, Match m, string key)
        {
            MotorSpeedModels speed = new MotorSpeedModels();
            var direction          = messageReply.Methods[key][0];

            speed.ForwardSpeed  = Convert.ToInt32(messageReply.Methods[key][1]);
            speed.BackwardSpeed = Convert.ToInt32(messageReply.Methods[key][2]);
            speed.LeftSpeed     = Convert.ToInt32(messageReply.Methods[key][3]);
            speed.RightSpeed    = Convert.ToInt32(messageReply.Methods[key][4]);
            var timer = messageReply.Methods[key][5];

            if (timer == _INT)
            {
                timer         = m.Groups[2].Value;
                returnMessage = returnMessage.Replace(_INT, timer);
            }

            MoveFunctions(timer, direction, speed);

            return(returnMessage);
        }
示例#5
0
        private void MoveFunctions(string timer, string direction, MotorSpeedModels speed)
        {
            MovementTimer.Stop();

            if (direction == "Stop")
            {
                MovementStatus = false;
            }
            else
            {
                MovementStatus = true;
            }

            if (MovementStatus & direction != "Stop")
            {
                MovementTimer.Interval = Convert.ToInt32(timer) * 1000;
                LemurianHub.LemurianMove(direction.ToLower(), speed);
                MovementTimer.Start();
            }
            else
            {
                StopMovement();
            }
        }
示例#6
0
 private async void LemurianMove(string direction, MotorSpeedModels speed)
 {
     // Send this data to the Server
     await LemurianHub.Invoke("LemurianMove", new object[] { direction, speed });
 }