Set cost value of cells in vehicle costmap
Mark Rectangular Obstacle on Vehicle Costmap
Create a 10-by-15 meter vehicle costmap. Cells have a side length of 1 meter.
costmap = vehicleCostmap(10,15);
Define a set of (x,y) coordinates that correspond to a 3-by-5 meter rectangle.
[x,y] = meshgrid(2:4,2:6); xyPoints = [x(:),y(:)];
Mark the rectangle as an obstacle by increasing the cost of its cells to 0.9.
costVal = 0.9; setCosts(costmap,xyPoints,costVal); plot(costmap) title('Costmap with Rectangular Obstacle')
costVals — Cost of points
M-element real-valued vector
Cost of points in
xyPoints, specified as an
M-element real-valued vector.
0.8 specifies the cost of a single
[0.2 0.5 0.8] specifies the cost of three
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Introduced in R2018a