Contenido principal

setActorWorldAnglesDegrees

R2026b

Specify Euler angle heading, pitch, and roll values of vehicle actor at specified point

Since R2026b

    Description

    setActorWorldAnglesDegrees(point,heading,pitch,roll) specifies the Euler angle heading, pitch, and roll orientation values of a vehicle actor when it reaches the specified point on its route. RoadRunner applies the actor Euler angles in this intrinsic order relative to the RoadRunner world space axes: heading, pitch, and then roll. This function also sets the HasActorOrientation property of point to true.

    Note

    When you must specify values for multiple orientation angles at a point, the setActorWorldAnglesDegrees function calculates a more accurate actor orientation, than if you manually specify the individual ActorWorldHeadingDegrees, ActorWorldPitchDegrees, and ActorWorldRollDegrees properties of the corresponding Point object.

    When you specify orientation data for a Point object, RoadRunner automatically updates the associated vehicle actor to interpolate its orientation between that point and other points with orientation data. If the last point with orientation data is not the final point on the route, then all points after it inherit its orientation values. For more information on modifying actor orientation in RoadRunner, see Actor Orientation Tool (RoadRunner Scenario).

    example

    Examples

    collapse all

    Use the setActorWorldAnglesDegrees function to modify the orientation of a vehicle actor at a specified point on its route.

    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 initial location of the actor car.

    initPoint = car.InitialPoint;

    Extract the route of car from its initial location.

    rrRoute = initPoint.Route;

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

    rrPoint = addPoint(rrRoute,[0 -10 0]);
    rrPoint2 = addPoint(rrRoute,[5 -20 0]);

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

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

    Modify Actor Orientation on Route Point

    To prevent the actor from changing its orientation prematurely during simulation, enable orientation data for the first point rrPoint. Then, use setActorWorldAnglesDegrees to modify the orientation data of rrPoint2 so that the associated actor rotates its heading by -130 degrees when it reaches the point.

    rrPoint.HasActorOrientation = true;
    setActorWorldAnglesDegrees(rrPoint2,-130,0,0)

    Adjust the heading of the actor at point rrPoint2 directly.

    Tip

    When changing two or more orientation angles, use the setActorWorldAnglesDegrees function to calculate a more accurate actor orientation than if you manually specify the orientation properties of the Point object.

    rrPoint2.ActorWorldHeadingDegrees = -120;

    Simulate the scenario. The actor car gradually changes its orientation as it moves between the two points on the route until it achieves the final specified orientation value.

    simulateScenario(rrApp)

    Input Arguments

    collapse all

    Point on which to specify actor orientation data, specified as a Point object. The vehicle actor that contains the Route associated to this point adjusts its orientation to match the values specified by heading, pitch, and roll as it approaches this point during simulation.

    Heading value of the associated vehicle actor at this point, specified as a numeric scalar in the range [–180, 180). Units are in degrees relative to RoadRunner world space axes.

    Pitch value of the associated vehicle actor at this point, specified as a numeric scalar in the range [–180, 180). Units are in degrees relative to RoadRunner world space axes.

    Roll value of the associated vehicle actor at this point, specified as a numeric scalar in the range [–180, 180). Units are in degrees relative to RoadRunner world space axes.

    Limitations

    • Among actors that follow routes, RoadRunner supports orientation data for only vehicle actors.

    Version History

    Introduced in R2026b

    See Also

    | | | |

    Topics