Main Content

vehicleDimensions

Store vehicle dimensions

Description

The vehicleDimensions object stores vehicle dimensions. The figure shows the dimensions that are included in the vehicleDimensions.

Vehicle diagram with position, width, height, length, rear overhang, wheelbase, and front overhang labeled

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 ClassificationLengthWidthHeightWheelbaseFront OverhangRear Overhang
Automobile (sedan)4.7 m1.8 m1.4 m2.8 m0.9 m1.0 m
Motorcycle2.2 m0.6 m1.5 m1.51 m0.37 m0.32 m

Creation

Description

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(l,w,h) creates a vehicleDimensions object and sets the Length, Width, and Height properties.

vdims = vehicleDimensions(___,Name,Value) uses one or more name-value pair arguments to set the Wheelbase, FrontOverhang, RearOverhang, and WorldUnits properties. Name is the property name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

example

Properties

expand all

Length of vehicle, specified as a positive real scalar.

Data Types: double

Width of vehicle, specified as a positive real scalar.

Data Types: double

Height of vehicle, specified as a positive real scalar.

Data Types: double

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.

Data Types: double

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.

Data Types: double

The distance between the front and rear axles of the vehicle, specified as a positive real scalar.

Data Types: double

Units of measurement, specified as a character array. The units do not affect the values of measurements.

Examples

collapse all

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'

Tips

  • The Length of the vehicle is the sum of the Wheelbase, FrontOverhang, and RearOverhang. If you change FrontOverhang, then the value of Wheelbase automatically adjusts to keep Length constant. Any change resulting in a negative wheelbase causes an error.

  • You can use the vehicle dimensions to define a vehicleCostmap that 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.

Extended Capabilities

Version History

Introduced in R2018a