setCosts
Set cost value of cells in vehicle costmap
Description
Examples
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')
Input Arguments
costmap
— Costmap
vehicleCostmap
object
Costmap, specified as a vehicleCostmap
object.
xyPoints
— Points
M-by-2 real-valued matrix
Points, specified as an M-by-2 real-valued matrix that represents the (x, y) coordinates of M points.
Example: [3.4 2.6]
specifies a single point at (3.4, 2.6)
Example: [3 2;3 3;4 7]
specifies three points: (3, 2), (3, 3), and (4,
7)
costVals
— Cost of points
M-element real-valued vector
Cost of points in xyPoints
, specified as an
M-element real-valued vector.
Example: 0.8
specifies the cost of a single
point
Example: [0.2 0.5 0.8]
specifies the cost of three
points
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2018a
See Also
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)