Пример #1
0
        public RobotAndWallTests()
        {
            var map = TestMap1Factory.Create();

            environment = new DefaultEnvironment(map);
            robot       = new LineAndWallDetectorRobot(environment);
        }
 public WallsAndLinesDemoBrainTests()
 {
     map         = TestMap1Factory.Create();
     environment = new DefaultEnvironment(map);
     robot       = new LineAndWallDetectorRobot(environment, 50);
     brain       = new WallsAndLinesDemoBrain(robot);
 }
 public WallsAndLinesDemoBrain(LineAndWallDetectorRobot robot) : base(robot)
 {
     robot.OnLineAppears    += Robot_OnLineAppears;
     robot.OnLineDisappears += Robot_OnLineDisappears;
     robot.OnWallOnLeft     += Robot_OnWallOnLeft;
     robot.OnNoWallOnLeft   += Robot_OnNoWallOnLeft;
     robot.OnWallOnRight    += Robot_OnWallOnRight;
     robot.OnNoWallOnRight  += Robot_OnNoWallOnRight;
 }
Пример #4
0
        public WallAndLineDetectorRobotTests()
        {
            var map = new Map(100, 100);

            environment = new DefaultEnvironment(map);
            robot       = new LineAndWallDetectorRobot(environment);
            SubscribeToAllRobotEvents();

            map.DrawVLine(x: 60, y1: 0, y2: 99, value: 255);  // Wall
            map.DrawVLine(x: 20, y1: 0, y2: 99, value: 1);    // Line
            robot.Orientation = 0.0;
        }
Пример #5
0
        public RobotViewModel(LineAndWallDetectorRobot robot)
        {
            this.robot = robot;
            this.Image = new BitmapImage
            {
                UriSource = new Uri(@"ms-appx:///Assets/Robot.png")
            };
            ImageCenterPoint       = new Vector3(16.0F, 25.0F, 0.0F);
            ImageCenterTranslation = new Vector3(-16.0F, -25.0F, 0.0F);

            timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(500)
            };
            timer.Tick += Timer_Tick;
        }
Пример #6
0
        public MainPage()
        {
            this.InitializeComponent();
            environment           = new DefaultEnvironment(new Map(1, 1)); // Did not load the map yet...
            EnvironmentTickSource = new EnvironmentTickSource(environment, SimulationCycleLengthMs);

            var robot = new LineAndWallDetectorRobot(environment);

            Brain = new WallsAndLinesDemoBrain(robot);

            new LogCollector(Brain, this.LogViewModel); // Ctor performs registrations

            this.RobotViewModel = new RobotViewModel(robot);
            RobotImage.Source   = RobotViewModel.Image;

            this.MapViewModel = new MapViewModel();

            InitButtonCommands();
        }
Пример #7
0
        public MainPage()
        {
            this.InitializeComponent();
            environment = new DefaultEnvironment(new Map(1, 1)); // Did not load the map yet...
            var robot = new LineAndWallDetectorRobot(environment, wallSensorMaxDistance: 50);
            var brain = new WallsAndLinesDemoBrain(robot);

            brain.AddCommand(new GenericSingleStateCommand(new FollowingLineState(5.0)));

            this.RobotViewModel = new RobotViewModel(robot);
            RobotImage.Source   = RobotViewModel.Image;

            this.MapViewModel = new MapViewModel();

            SimulationTickTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(500)
            };
            SimulationTickTimer.Tick += SimulationTickTimer_Tick;
        }
        public MainPage()
        {
            this.InitializeComponent();
            environment           = new DefaultEnvironment(new Map(1, 1)); // Did not load the map yet...
            EnvironmentTickSource = new EnvironmentTickSource(environment, SimulationCycleLengthMs);

            var robot = new LineAndWallDetectorRobot(environment);

            Brain = new WallsAndLinesDemoBrain(robot);

            var collector = new LogCollector(Brain, this.LogViewModel);

            this.RobotViewModel = new RobotViewModel(robot);
            RobotImage.Source   = RobotViewModel.Image;

            this.MapViewModel = new MapViewModel();

            FollowLineCommand      = new CommandButtonCommand(Brain, new FollowingLineState(5.0));
            FollowLeftWallCommand  = new CommandButtonCommand(Brain, new FollowingWallOnLeftState());
            FollowRightWallCommand = new CommandButtonCommand(Brain, new FollowingWallOnRightState());
        }
Пример #9
0
 public WallsAndLinesDemoBrain(LineAndWallDetectorRobot robot, StandBase stand) : base(robot, stand)
 {
     CurrentState            = new SelfDiagnosticState(this);
     robot.OnLineAppears    += Robot_OnLineAppears;
     robot.OnLineDisappears += Robot_OnLineDisappears;
 }