Main Content

Point

Point in RoadRunner scenario

Since R2025a

    Description

    The Point object represents a point in the current RoadRunner scenario. Points define location and orientation data for other scenario objects, such as actors. You can also use multiple points to design and modify the shape and position of a route. You can use a Point object to modify the attributes of points within your scenario.

    Creation

    To retrieve a Point object from your RoadRunner scenario, extract the InitialPoint or Point property of an actor or route, respectively. For example, carPoint = car.InitialPoint extracts the InitialPoint property of the actor car and assigns it to the variable carPoint.

    You can also use the addPoint function to add a new point to the end of the specified route at the specified position.

    Properties

    expand all

    Name of the point, specified as a string scalar or character vector.

    Note

    You can specify the Name property of Point in MATLAB®, but RoadRunner Scenario does not display the Name property of points in the user interface.

    Coordinates of the point in local space, specified as a three-element vector.

    Coordinates of the point in world space, specified as a three-element vector.

    This property is read-only.

    Route containing the point, represented as a Route object.

    This property is read-only.

    Distance of the point along the route, represented as a numeric scalar.

    This property is read-only.

    Point to which the point is anchored, represented as one of these objects:

    • Point object — Represents a point in the current scenario.

    • ScenarioAnchorPoint object — Represents a scenario anchor defined in the current scenario.

    • SceneAnchorPoint object — Represents a scene anchor defined in the scene associated to the current scenario.

    Lane from which to measure the offset of the point based on its direction of travel, specified as one of these options:

    • "leftmost"RoadRunner Scenario measures the offset of the point from the leftmost lane.

    • "rightmost"RoadRunner Scenario measures the offset of the point from the rightmost lane.

    Number of lanes to offset the point from the anchor point AnchorPoint, specified as a positive integer.

    Lateral distance to offset the point from the anchor point AnchorPoint, specified as a numeric scalar.

    Reference line that specifies how RoadRunner Scenario measures the ForwardOffset property of the actor associated to the point, specified as one of these options:

    • "origin"RoadRunner Scenario measures the ForwardOffset value from the origin of the actor.

    • "front"RoadRunner Scenario measures the ForwardOffset value from the front of the actor.

    • "back"RoadRunner Scenario measures the ForwardOffset value from the back of the actor.

    This property applies only to the point specified by the InitialPoint property of an actor.

    Reference line that specifies how RoadRunner Scenario measures the ForwardOffset property of the point with respect to the anchored actor, specified as one of these options:

    • "origin"RoadRunner Scenario measures the ForwardOffset value from the origin of the actor.

    • "front"RoadRunner Scenario measures the ForwardOffset value from the front of the actor.

    • "back"RoadRunner Scenario measures the ForwardOffset value from the back of the actor.

    To use this property, you must anchor the point to an actor.

    Longitudinal distance to the anchor point of the associated actor, specified as a numeric scalar, relative to ReferenceLine. If the anchor is in front of the actor, this value is negative.

    Travel direction of the point with respect to AnchorPoint, specified as one of these options:

    • "forward" — The point has the same travel direction as AnchorPoint.

    • "backward" — The point has the opposite travel direction of AnchorPoint.

    • "bidirectional" — The point follows both directions of travel.

    • "undirected" — The point does not follow any direction of travel.

    Point uses route timing data, specified as a logical 1 (true) or 0 (false). When set to true, the point uses route timing data. For more information on route timing data, see the Route Timing Tool (RoadRunner Scenario).

    Data Types: logical

    Time value of the point, specified as a numeric scalar. To use this property, you must set the value of the HasTime property to 1 (true) .

    Stop duration of the actor at the point, when using route timing data, specified as a numeric scalar. To use this property, you must set the value of the HasTime property to 1 (true).

    Point uses route speed data, specified as a logical 1 (true) or 0 (false). When set to true, the point uses route speed data. To use this property, you must set the value of the HasTime property to 1 (true).

    Data Types: logical

    Speed value of the point, specified as a numeric scalar. To use this property, you must set the value of the HasSpeed property to 1 (true).

    Vertical distance to offset the point from AnchorPoint, specified as a numeric scalar.

    Object Functions

    anchorToPointSet specified point as anchor
    autoAnchorAnchor point to nearest road

    Examples

    collapse all

    Use the addPoint function to add points to the route of an actor.

    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 addPoint to Create Route

    Extract the route for the actor car from the Route property of its InitialPoint property.

    rrRoute = car.InitialPoint.Route;

    Use the addPoint function to add three points to the route rrRoute at different positions.

    rrPoint = addPoint(rrRoute,[0 -10 0]);
    rrPoint2 = addPoint(rrRoute,[5 -50 0]);
    rrPoint3 = addPoint(rrRoute,[-5 -100 0]);

    Use autoAnchor to anchor the new points to the road. Specify the PosePreservation argument as "reset-pose" to specify for the points to adjust their positions to align within the nearest lane.

    autoAnchor(rrPoint,PosePreservation="reset-pose")
    autoAnchor(rrPoint2,PosePreservation="reset-pose")
    autoAnchor(rrPoint3,PosePreservation="reset-pose")

    Run the simulation by using the simulateScenario function. The actor car follows the path specified by the new route until it reaches the end.

    simulateScenario(rrApp)

    Version History

    Introduced in R2025a