Home > src > BN_pol_rec > functions > findClosestRoad.m

findClosestRoad

PURPOSE ^

ta bort path??

SYNOPSIS ^

function [roadNo,cost_this, pxNo] = findClosestRoad(roadPoints, positionRoad_no, point, costMap, oponent_pos)

DESCRIPTION ^

ta bort path??
-----------------------RS040217-----------------------------------

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 
0003 function [roadNo,cost_this,  pxNo] = findClosestRoad(roadPoints, positionRoad_no, point, costMap, oponent_pos)
0004     
0005 %ta bort path??
0006 %-----------------------RS040217-----------------------------------
0007 
0008 
0009 
0010 %-------------------------------------------------------------------
0011 roadNo  = 0; pxNo = []; noChildren = 0;path = []; markedNodes = zeros(size(costMap)); val = 0; predList =[]; 
0012 markedNodes = zeros(size(costMap));
0013 %[newNode, roadNo, pxNo, noChildren, markedNodes] = getFieldCandiadte(roadPoints, positionRoad_no, point , costMap, markedNodes, oponent_pos);
0014 %predList = [predList; newNode point];
0015 nodeList = [point];
0016 idx = 1; 
0017 %pathList = [point];
0018 [sx1, sy1] = size(nodeList);
0019 
0020 while (roadNo == 0) && (sx1 > 0)
0021   [val, idx] = min(nodeList(:,3));
0022      if val == inf
0023          disp('ERROR: PATH NOT FOUND', oponent_pos)
0024          return;
0025      end;
0026      nodeToExpand = nodeList(idx, :);
0027      [nodeList] = removeElem(idx, nodeList);
0028      [newNode,cost_this, roadNo, pxNo, markedNodes] = getFieldCandiadte(roadPoints, positionRoad_no, nodeToExpand, costMap, markedNodes, oponent_pos);    
0029      roadNo = roadNo; newNode = newNode; noChildren = noChildren; pxNo = pxNo; markedNodes = markedNodes;
0030      nodeList = [nodeList; newNode];
0031     % predList = [predList; newNode nodeToExpand];
0032      [sx1, sy1] = size(nodeList);
0033 end; 
0034 
0035 if (roadNo == 0)
0036     disp('Road not found')
0037 end;
0038  
0039 %  [sxp, syp] = size(predList);
0040 %  Node = pxNo;
0041 %  path = [Node];
0042 %  parentFound = 1;
0043 %  while parentFound > 0
0044 %      [parentNode, parentFound] = getParent(Node, predList, point);
0045 %      parentFound = parentFound;
0046 %      path = [parentNode; path];
0047 %      Node = parentNode;
0048 %  end;
0049 %  for i = 1:length(path(:,1))
0050 %      roadPoints(path(i,1),path(i,2)) = 1;
0051 %  end;
0052  roadPoints = roadPoints;

Generated on Wed 16-Mar-2005 09:17:47 by m2html © 2003