Plot parking space
plot( plots a bird's-eye view of a
parking space. Use this plot to examine the dimensions, angle, color, and type of a parking
space before adding it to a parking lot.
sets the visibility of the parking space origin to
Create Parking Lot Using Predefined Layout
Explore the various parking lots that you can create by using predefined layouts as well as the options for configuring those layouts.
Define the parking space used to populate the parking lot. Modify the width, length, or angle of the space and the width and strength of its lane markings. Plot the parking space.
width = 2.6; % m length = 5.5; % m angle = 90; % deg markingWidth = 0.15; markingStrength = 1; space = parkingSpace(Width=width, ... Length=length, ... Angle=angle, ... MarkingWidth=markingWidth, ... MarkingStrength=markingStrength); plot(space)
Create a driving scenario containing a 50-by-50 meter parking lot. Specify a predefined parking lot layout and a minimum driving lane width. The generated parking lot fills with as many parking spaces that fit the layout as possible given the minimum driving lane width constraint. Modify the parking space, layout type, and driving lane width, and observe the effects on the parking lot. For example:
As you increase the size of the parking space or the minimum driving lane width, the number of parking grids that fit in the middle of the parking lot decreases.
If you select the
VerticalWithEdgeslayout, one edge has fewer spaces than the others. This edge contains a driving lane of width
DrivingLaneWidththat enables vehicles to enter the parking lot.
scenario = drivingScenario; vertices = [0 0; 50 0; 50 -50; 0 -50]; parkingLayout = "Vertical"; drivingLaneWidth = 2.6; % m parkingLot(scenario,vertices, ... ParkingSpace=space, ... ParkingLayout=parkingLayout, ... DrivingLaneWidth=drivingLaneWidth); plot(scenario)
Create Parking Lot Containing Multiple Space Types
Create a parking lot that contains a mixture of parking spaces, no-parking areas, and accessible spaces.
Define the parking space to use in the parking lot. Use the default settings. Plot the space.
space = parkingSpace; plot(space,Origin="off")
Define the no-parking areas to use in the parking lot. Specify a color of white and a width that is one meter less than the width of the default parking space. Plot the space.
noSpace = parkingSpace(Type="NoParking",Width=(space.Width - 1),MarkingColor="White"); plot(noSpace,Origin="off")
Define the accessible parking space to use in the parking lot. Specify a width that is one meter more than the width of the default parking space. Plot the space.
accessibleSpace = parkingSpace(Type="Accessible",Width=(space.Width + 1)); plot(accessibleSpace,Origin="off")
Create a driving scenario containing a parking lot with a nonrectangular layout. Plot the parking lot and display the edge numbers along which you can add parking spaces.
scenario = drivingScenario; vertices = [0 0; 32 -10.5; 32 -50.5; 25 -57.5; 0 -57.5]; lot = parkingLot(scenario,vertices); plot(scenario,ParkingLotEdges="on")
Insert default parking spaces along the first three edges of the parking lot. To avoid overlapping parking spaces, make these adjustments to the insertions:
Along edge 1, insert only 10 spaces.
Along edge 2, offset the spaces by 5 meters from the first vertex of the edge.
Along edge 3, offset the spaces by 3 meters from the first vertex of the edge.
numSpaces = 10; insertParkingSpaces(lot,space,numSpaces,Edge=1) insertParkingSpaces(lot,space,Edge=2,Offset=5) insertParkingSpaces(lot,space,Edge=3,Offset=3)
In the center of the parking lot, insert a 2-by-10 grid of parking spaces containing 8 columns of default spaces, 1 column of no-parking areas, and 1 column of accessible spaces.
insertParkingSpaces(lot,[space noSpace accessibleSpace],[8 1 1],Position=[12 -18],Rows=2)
visibility — Visibility of parking space origin
"on" (default) |
Visibility of parking space origin, specified as
"off". The origin is located on the upper-left corner of the
Introduced in R2021b