예제 #1
0
        private static void SelectedCommand(Command cmd)
        {
            switch (cmd)
            {
            case Command.Forward:
                ExploreCommander.GoForward();
                break;

            case Command.Backward:
                ExploreCommander.GoBackward();
                break;
            }
        }
예제 #2
0
        public void Follow()
        {
            if (Dist < 400)
            {
                if (Consts.LastCommand != Command.Backward)
                {
                    ExploreCommander.GoBackward();
                    Consts.LastCommand = Command.Backward;
                }
                Thread.Sleep(200);
            }
            if (Mathematics.IsEqual(slope, Mathematics.Degree(OwnRobots.CurrentRobot), 4))
            {
                if (Consts.LastCommand != Command.Stop)
                {
                    ExploreCommander.Stop();
                    //ExploreCommander.GoForward();
                    Consts.LastCommand = Command.Stop;
                }
            }
            if (!Mathematics.IsEqual(slope, Mathematics.Degree(OwnRobots.CurrentRobot), 4))
            {
                ExploreCommander.Turn(slope, Command.Stop);
            }

            if (Dist < 600 && !Mathematics.IsEqual(slope, Mathematics.Degree(OwnRobots.CurrentRobot), 4))
            {
                ExploreCommander.Turn(slope, Command.Stop);
            }
            //else if (Mathematics.IsEqual(slope, Mathematics.Degree(OwnRobots.CurrentRobot), 4) && Dist < 700)
            //{
            //    if (Consts.LastCommand != Command.Stop)
            //    {
            //        ExploreCommander.Stop();
            //        Consts.LastCommand = Command.Stop;
            //        Console.WriteLine("deg==curr && dist<700");
            //    }
            //}
        }