Main Content

get

Get calculations on scene elements of RoadRunner Scenario in MATLAB

Since R2024b

    Description

    rayIntersection = get(scenarioServ,"RayIntersectionPoint",sourcePoint,rayDirection) returns the point of intersection of a ray with the closest surface in its path. The ray starts at the point specified by the sourcePoint coordinates and travels in the direction rayDirection.

    example

    Examples

    collapse all

    This example workflow assumes that:

    • You have a RoadRunner license, and the product is installed.

    • You have a RoadRunner Scenario license, and the product is installed.

    Create a roadrunner object to launch the RoadRunner application, which then connects to the project folder at the specified path for use. For example:

    rrApp = roadrunner("C:\ScenarioServices_proj");

    Open the scenario file LaneChangeInterruptsSwerve.rrscenario that is included with the RoadRunner Scenario application.

    openScenario(rrApp,"LaneChangeInterruptsSwerve");

    Connect to the RoadRunner Scenario server to enable cosimulation by creating a ScenarioSimulation object named scenarioSim.

    scenarioSim = createSimulation(rrApp);

    Get a ScenarioServices object named scenarioServ by using the scenarioSim object.

    scenarioServ = get(scenarioSim,"ScenarioServices");

    Initialize the source and direction of travel of a ray. The source is a set of x, y, and z coordinates that denote the point of origin of the ray. The direction is a 1-by-3 vector that indicates the path of the ray.

    sourcePoint = [1 2 3];
    rayDirection = [0 0 -1];

    Start the simulation.

    set(scenarioSim,"SimulationCommand","Start");

    Determine the point of intersection of the ray with the closest surface in its direction of travel.

    intersection_pt = get(scenarioServ,"RayIntersectionPoint",...
                      sourcePoint,rayDirection);

    Input Arguments

    collapse all

    ScenarioServices object that corresponds to the RoadRunner scene or scenario in which you want to calculate point of intersection of a ray with the closest surface in its direction of travel, specified as a ScenarioServices object.

    Example: scenarioServ

    Point of origin of a ray, specified as a 1-by-3 or 3-by-1 double array.

    Example: [4 -9 5]

    Direction of travel of a ray, specified as a 1-by-3 or 3-by-1 double array.

    Example: [0 0 1]

    Output Arguments

    collapse all

    Point of intersection of a ray with the closest surface in its direction of travel, returned as a double array.

    Example: [1.0000 2.0000 1.0000]

    Version History

    Introduced in R2024b