Store vehicle dimensions
vehicleDimensions object stores vehicle dimensions. The
figure shows the dimensions that are included in the
The position of the vehicle is often represented as a single point located on the ground at the center of the rear axle, as indicated by the red dot in the figure. This position corresponds to the natural center of rotation of the vehicle.
The table lists typical vehicle types and their corresponding dimensions.
|Vehicle Classification||Length||Width||Height||Wheelbase||Front Overhang||Rear Overhang|
|Automobile (sedan)||4.7 m||1.8 m||1.4 m||2.8 m||0.9 m||1.0 m|
|Motorcycle||2.2 m||0.6 m||1.5 m||1.51 m||0.37 m||0.32 m|
vdims = vehicleDimensions creates a
vehicleDimensions object with a default length of 4.7 m,
width of 1.8 m, and height of 1.4 m.
vdims = vehicleDimensions(___,
uses one or more name-value pair arguments to set the
Name is the property name and
Value is the corresponding value.
must appear inside single quotes (
' '). You can specify
several name and value pair arguments in any order as
Length — Length of vehicle
4.7 (default) | positive real scalar
Length of vehicle, specified as a positive real scalar.
Width — Width of vehicle
1.8 (default) | positive real scalar
Width of vehicle, specified as a positive real scalar.
Height — Height of vehicle
1.4 (default) | positive real scalar
Height of vehicle, specified as a positive real scalar.
FrontOverhang — Front overhang of vehicle
0.9 (default) | real scalar
Front overhang of vehicle, specified as a real scalar. The front overhang
is the distance between the front of the vehicle and the front axle.
FrontOverhang can be negative.
RearOverhang — Rear overhang of vehicle
1.0 (default) | real scalar
Rear overhang of vehicle, specified as a real scalar. The rear overhang is
the distance between the rear of the vehicle and the rear axle.
RearOverhang can be negative.
Wheelbase — Distance between axles
2.8 (default) | positive real scalar
The distance between the front and rear axles of the vehicle, specified as a positive real scalar.
WorldUnits — Units of measurement
'meters' (default) | character array
Units of measurement, specified as a character array. The units do not affect the values of measurements.
Specify Dimensions of a Motorcycle
Store the dimensions of a motorcycle with length 2.2, width 0.6, and height 1.5 meters. Also specify the distance that the motorcycle extends ahead of the front axle and behind the rear axle.
vdims = vehicleDimensions(2.2,0.6,1.5, ... 'FrontOverhang',0.37,'RearOverhang',0.32)
vdims = vehicleDimensions with properties: Length: 2.2000 Width: 0.6000 Height: 1.5000 Wheelbase: 1.5100 RearOverhang: 0.3200 FrontOverhang: 0.3700 WorldUnits: 'meters'
Lengthof the vehicle is the sum of the
RearOverhang. If you change
FrontOverhang, then the value of
Wheelbaseautomatically adjusts to keep
Lengthconstant. Any change resulting in a negative wheelbase causes an error.
You can use the vehicle dimensions to define a
vehicleCostmapthat represents the planning search space around a vehicle. Path planning algorithms, such as
pathPlannerRRT, use vehicle dimensions to find a path for the vehicle to follow.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
All inputs to
vehicleDimensionsmust be compile-time constants.
Introduced in R2018a