Main Content

VehicleAsset

Vehicle asset type

Since R2025a

    Description

    The VehicleAsset object represents an asset with the Vehicle asset type in the RoadRunner project. VehicleAsset objects contain multiple properties for dimensions that you can customize to modify the size and shape of placeholder vehicle models. For information on placeholder vehicles, see Vehicle Assets (RoadRunner Scenario). You can use the VehicleAsset object to represent Vehicle actors in the scenario.

    Creation

    You can create a VehicleAsset object in these ways:

    • The getAsset function extracts an object for the asset of the specified asset type at the specified path relative to the Asset folder of the specified project. Specify the assetType argument as "VehicleAsset" to extract a VehicleAsset object.

    • The createAsset function creates an asset of the specified asset type at the specified path relative to the Asset folder of the specified project. Specify the assetType argument as "VehicleAsset" to create a VehicleAsset object. The extension you specify for the new asset must match the type specified for the assetType argument.

    Properties

    expand all

    This property is read-only.

    Relative path to the asset in the RoadRunner project, represented as a string scalar.

    This property is read-only.

    Axis-aligned bounding box used for collision detection, represented as an AlignedBox object. The AlignedBox object contains the Min, Max, Center, and Extents properties which represent the dimensions of the collision box for the asset. RoadRunner represents each property as a three-element vector.

    Vertical distance, in meters, from the wheel axle center to the bottom of the vehicle body, specified as a numeric scalar in the range [0, 10].

    Forward distance, in meters, from the vehicle origin to the center of the vehicle bounding box, specified as a numeric scalar in the range [–x, x], where x is half the width of the vehicle. The vehicle origin is on the ground, at the geometric center of the vehicle.

    Distance, in meters, from the front bumper of the vehicle to the front axle, specified as a numeric scalar in the range [0, x], where x is half the length of the vehicle.

    Distance, in meters, from the back bumper of the vehicle to the rear axle, specified as a numeric scalar in the range [0, x], where x is half the length of the vehicle.

    Dimensions of the vehicle body, in meters, specified as a three-element vector of the form [W,L,H], where W, L, and H represent the width, length, and height values, respectively. This value excludes the wheels.

    Wheel inset distance, in meters, between the outer edge of the wheel and the outer edge of the vehicle body, specified as a numeric scalar in the range [0, 5].

    Radius of the vehicle wheels, in meters, specified as a numeric scalar.

    Width of the vehicle wheels, in meters, specified as a numeric scalar in the range [0.05, 0.9].

    This property is read-only.

    Distance, in meters, between the front axle and the rear axle of the vehicle, represented as a numeric scalar.

    Examples

    collapse all

    Use createAsset to create a new VehicleAsset object in your RoadRunner project. Then, use addActor and the newly created VehicleAsset object to add a new Vehicle actor to the scenario.

    This example assumes that you have prior knowledge of working with RoadRunner in MATLAB®. Before proceeding, follow the steps outlined in Set Up MATLAB Environment for RoadRunner Authoring Functions to set up your scenario using MATLAB functions for scenario authoring.

    Use the createAsset function to create a new VehicleAsset object, customCar, in the project prj by specifying the relative path for the new asset as "Vehicles/CustomCar.rrvehicle" and the asset type as "VehicleAsset".

    customCar = createAsset(prj,"Vehicles/CustomCar.rrvehicle","VehicleAsset");

    Then, use the addActor function, specifying the scenario object scnro, the asset object customCar, and the location at which to place the actor. Place the vehicle actor car at the world origin, specified as [0 0 0].

    newCar = addActor(scnro,customCar,[0 0 0]);
    If you do not know the exact coordinates at which you want to place the actor, you can relocate the actor based on an existing point or anchor. For example, you can use findSceneAnchor to reference an existing anchor in the scene, then use anchorToPoint to relocate the actor from its current location to the location specified by the referenced anchor.

    anchorPoint = findSceneAnchor(scnro,"ScenarioStart");
    newCarPoint = newCar.InitialPoint;
    anchorToPoint(newCarPoint,anchorPoint,PosePreservation="reset-pose")

    Move the new vehicle actor to a different lane by setting its LaneOffset property to 1.

    newCar.InitialPoint.LaneOffset = 1;

    Run the simulation by using the simulateScenario function. If you do not specify a BehaviorAsset object or logic phases to alter actor behavior, the actor performs the default lane-following behavior.

    simulateScenario(rrApp)

    Version History

    Introduced in R2025a

    See Also

    | | | |

    Topics