public Simulator(Robot r, Map m) { this.Robot = r; this.Map = m; this.Robot.Env = this.Map; }
private void connectButton_Click(object sender, RoutedEventArgs e) { this.realTimeRobot = new Robot(); this.realTimeRobot.ChangePosition += new Robot.RobotMovingHandler(updateRobotPosition); this.realTimeRobot.SendingMessage += new Robot.RobotSendingMessage(displayRobotMessage); this.simulator = new Simulator(); this.simulator.Robot = this.realTimeRobot; this.mappingThread = new Thread(this.Connector.run); this.mappingThread.Start(); }
public Simulator(Robot r) { this.Robot = r; }
private void dfsExplore_Click(object sender, RoutedEventArgs e) { this.displayConsoleMessage("Exploring using DFS..."); Robot robot = new Robot(); this.map = new Map(mapDescriptor); this.simulator = new Simulator(robot, map); this.simulator.Robot.ChangePosition += new Robot.RobotMovingHandler(updateRobotPosition); this.simulator.Robot.SendingMessage += new Robot.RobotSendingMessage(displayRobotMessage); this.timeLimit = UserSetting.TimeLimit; this.coverageLimit = UserSetting.CoverageLimit; timer.Start(); if (exploreThread!=null) exploreThread.Abort(); exploreThread = new Thread(this.simulator.dfsExplore); exploreThread.Start(); }
public Simulator(Robot r) { this.Robot = r; this.Map = new Map(); }
private void setUpSimulator() { Robot robot = new Robot(); robot.X = init_Y; robot.Y = init_X; robot.Dir = 'D'; this.map = new Map(mapDescriptor); this.simulator = new Simulator(robot, map); this.simulator.Robot.ChangePosition += new Robot.RobotMovingHandler(updateRobotPosition); this.simulator.Robot.SendingMessage += new Robot.RobotSendingMessage(displayRobotMessage); this.timeLimit = UserSetting.TimeLimit; this.TimerProgressbar.Value = 100; this.coverageLimit = UserSetting.CoverageLimit; }
private void exploreButton_Click(object sender, RoutedEventArgs e) { if (radioButtons[1]) { dfsExplore(); return; } else if (!radioButtons[0]) { this.displayConsoleMessage("Please Select Exploration Algorithm!"); return; } this.displayConsoleMessage("Exploring using wall follower!!!"); Robot robot = new Robot(); this.map = new Map(mapDescriptor); this.simulator = new Simulator(robot, map); this.simulator.Robot.ChangePosition += new Robot.RobotMovingHandler(updateRobotPosition); this.simulator.Robot.SendingMessage += new Robot.RobotSendingMessage(displayRobotMessage); this.timeLimit = UserSetting.TimeLimit; this.coverageLimit = UserSetting.CoverageLimit; timer.Start(); exploreThread = new Thread(this.simulator.wallfollowerExplore); exploreThread.Start(); }
private void OnReceive(IAsyncResult ar) { var socket = (Socket)ar.AsyncState; int received = testSocket.EndReceive(ar); var receivedData = new byte[received]; Array.Copy(byteData, receivedData, received); string desc = Encoding.ASCII.GetString(receivedData, 0, received); if (desc[desc.Length - 1] == 'F') { Robot robot = new Robot(); string path = robot.realTimeShortestPath(desc); this.shortestPath = "A"; if (path != null) { this.shortestPath += path; } else { //no solution this.shortestPath = "B"; } sendShortestPath(this.shortestPath); } if (desc.Length != 0) { OnReceivingData(desc); } testSocket.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None, OnReceive, testSocket); }