protected WayDecision(double posX, double posY, MapExplored me) { _posX = posX; _posY = posY; _me = me; init(); }
public Brain(MapExplored mapExplored, Robot robot) { _mapExplored = mapExplored; _robot = robot; // set first waypoint // CreateNextWaypoint(); }
public Minimap(Canvas minimapArea, Canvas minimapAreaVisited, MapExplored mapExplored) { _minimapArea = minimapArea; _minimapAreaVisited = minimapAreaVisited; _mapExplored = mapExplored; _bm = new Bitmap(800, 600); _trackingMap = new MapElementStatus[800, 600]; }
private bool[,] Simplify(MapExplored mapExplored) { bool[,] mapSimplified = new bool[800 / GRID_SIZE, 600 / GRID_SIZE]; for (int i = 0; i < 800; i += GRID_SIZE) { for (int j = 0; j < 600; j += GRID_SIZE) { CreateNode(i, j, GRID_SIZE, mapExplored); } } return mapSimplified; }
public void Initialize(Canvas mapArea, Sensor sensor) { Console.WriteLine("Robot initialize"); _mapArea = mapArea; _mapExplored = new MapExplored(); _brain = new Brain(_mapExplored, this); _sensor = sensor; SetPos(StartPosition.X, StartPosition.Y); // normalize direction //SetDirection(Direction > 0 ? 360 - Direction : Direction * -1); }
public DijkstraHelper(MapExplored mapExplored) { /* * 1) Simplify MapExplored * 2) Create Edges / Vertices * 3) Calculate Path * 4) return path steps as waypoints */ _nodeMatrix = new Node[800 / GRID_SIZE, 600 / GRID_SIZE]; _nodeList = new List<Node>(); _edgeList = new List<Edge>(); Simplify(mapExplored); CreateEdges(); // create dijkstra instance _dijkstra = new Dijkstra(_edgeList, _nodeList); }
public WayDecisionCollisionBackwards(double posX, double posY, MovementObject mo, MapExplored me) : base(posX, posY, mo, me) { }
public WayDecisionCollision(double posX, double posY, MovementObject mo, MapExplored me) : base(posX, posY, me) { _mo = mo; init(); }
private void CreateNode(int startX, int startY, int range, MapExplored mapExplored) { for (int i = startX; i < startX + range; i++) { for (int j = startY; j < startY + range; j++) { MapElementStatus status = mapExplored.GetStatus(i, j); // don't create node if any pixel in range x range is blocked if (status == MapElementStatus.Blocked) { return; } } } // if node is free -> save Node node = new Node(GenerateName(startX / GRID_SIZE, startY / GRID_SIZE)); _nodeMatrix[startX / GRID_SIZE, startY / GRID_SIZE] = node; _nodeList.Add(node); }
public void Dispose() { _bm = new Bitmap(800, 600); if (_minimapArea != null) { ImageBrush brush = new ImageBrush(); brush.ImageSource = BitmapConverter.AsImage(_bm).Source; _minimapArea.Background = brush; _minimapArea.Children.Clear(); _minimapArea = null; } if (_minimapAreaVisited != null) { _minimapAreaVisited.Children.Clear(); _minimapAreaVisited = null; } _mapExplored = null; _trackingMap = null; }
public WayDecisionWaypointReachedBackwards(double posX, double posY, MapExplored me) : base(posX, posY, me) { }