Main Content

groundTruthArea

Ground truth area centered at ego vehicle origin

Since R2025a

    Description

    A groundTruthArea object represents a rectangular ground truth area centered at the origin of an ego vehicle in the xy-plane of the world coordinate system. For more information about the world coordinate system, see World Coordinate System. Use this object to specify a ground truth area around the ego vehicle in a RoadRunner Scenario to store the ground truth information in the ASAM Open Simulation Interface (OSI)® format during scenario simulation. The ground truth area describes the simulated environment of the scenario, including all the simulated objects within that area.

    Creation

    Description

    gtArea = groundTruthArea(egoID,area) specifies a ground truth area, gtArea, in the xy-plane of the world coordinate system by using the spatial distances area centered around the origin of the ego vehicle with ID egoID in the RoadRunner scenario.

    example

    Input Arguments

    expand all

    Actor ID of the ego vehicle in the RoadRunner scenario, specified as a positive integer.

    This argument sets the EgoVehicleID property.

    Data Types: double

    Ground truth area in the xy-plane centered around the ego vehicle, specified as a two-element row vector of the form [xDist yDist] or a three-element row vector of the form [xDist yDist zDist]. The origin of the ego vehicle is located at the midpoint of its rear axle. The xDist and the yDist values specify the spatial distance measured from the origin of the ego vehicle along the positive direction of the x-axis and y-axis, respectively. The origin of the ego vehicle constitutes the center of the rectangle. The length and width of the rectangle are twice the magnitude of xDist and yDist, respectively. The value of zDist represents an offset of the ego vehicle origin along the positive direction of the z-axis. Units are in meters.

    This argument sets the Area property.

    Data Types: double

    Properties

    expand all

    This property is read-only after object creation. To set this property, use the egoID argument when calling the groundTruthArea function.

    Actor ID of the ego vehicle in the RoadRunner scenario, specified as a positive integer.

    Data Types: double

    This property is read-only after object creation. To set this property, use the area argument when calling the groundTruthArea function.

    Ground truth area in the xy-plane centered around the ego vehicle, specified as a two-element row vector of the form [xDist yDist] or a three-element row vector of the form [xDist yDist zDist]. The origin of the ego vehicle is located at the midpoint of its rear axle. The xDist and the yDist values specify the spatial distance measured from the origin of the ego vehicle along the positive direction of the x-axis and y-axis, respectively. The origin of the ego vehicle constitutes the center of the rectangle. The length and width of the rectangle are twice the magnitude of xDist and yDist, respectively. The value of zDist represents an offset of the ego vehicle origin along the positive direction of the z-axis. Units are in meters.

    Data Types: double

    Examples

    collapse all

    Create a roadrunner object to launch the RoadRunner application. Replace "C:\RR\MyProject" with the path to a RoadRunner project folder on your computer.

    rrApp = roadrunner(ProjectFolder="C:\RR\MyProject");

    Open the scenario file TrajectoryCutIn.rrscenario. This scenario is included with the RoadRunner Scenario application.

    openScenario(rrApp,"TrajectoryCutIn");

    Connect MATLAB® to the RoadRunner Scenario simulation by creating a ScenarioSimulation object, scenarioSim.

    scenarioSim = createSimulation(rrApp);

    Specify the area for which you want to store ground truth information in OSI form during simulation by creating a groundTruthArea object, gtArea.

    egoID = 1;
    area = [40 40 0];
    gtArea = groundTruthArea(egoID,area);

    Create an openSimulationInterface object, for storing RoadRunner Scenario simulation data in OSI format.

    osiData = openSimulationInterface(scenarioSim,gtArea);

    Start the RoadRunner simulation, storing the scenario simulation data in OSI format by using the openSimulationInterface object.

    startRoadRunnerSimulation(osiData);

    Specify a custom filename for an output binary file, with a .txt extension, and write the ground truth OSI data to the OSI trace file.

    write(osiData,"testEgoFollowSpeed.txt");

    Version History

    Introduced in R2025a