Main Content

roadrunner.hdmap.SignalStateReference

R2026b

Define reference to signal state in RoadRunner HD Map

Since R2026b

    Description

    A roadrunner.hdmap.SignalStateReference references a signal head and its associated state in a signal phase within a RoadRunner HD Map scene model. A SignalStateReference object links a specific signal type to one of its defined signal states, establishing which bulb configuration a particular signal head displays during a phase interval. Use this object within phase definitions to coordinate multiple signal heads at a junction. For an example of how to create a complete T-junction with roads, maneuver lanes, and traffic signal phases that include bulb-level signal control, see Build Signalized Junction Using RoadRunner HD Map.

    Creation

    Description

    signalStateRef = roadrunner.hdmap.SignalStateReference creates an empty signal state reference.

    signalStateRef = roadrunner.hdmap.SignalStateReference(PropertyName=Value) sets one or more properties of the signal state reference using name-value arguments. For example, SignalTypeRef=roadrunner.hdmap.Reference(ID="SignalWest") specifies for the reference to point to a signal type with ID "SignalWest".

    example

    Properties

    expand all

    Reference to the signal type, specified as a roadrunner.hdmap.Reference object. This reference must specify the ID property value of a roadrunner.hdmap.SignalType object, and identifies the signal head to which the signal state applies.

    Example: signalStateRef = roadrunner.hdmap.SignalStateReference(SignalTypeRef=roadrunner.hdmap.Reference(ID="TrafficLight3Bulb")) creates a signal state reference that references a signal type with the ID "TrafficLight3Bulb".

    Reference to the signal state, specified as a roadrunner.hdmap.Reference object. This reference must specify the ID property of a roadrunner.hdmap.SignalState object, and identifies the signal state assigned to the signal type.

    Example: signalStateRef = roadrunner.hdmap.SignalStateReference(SignalStateRef=roadrunner.hdmap.Reference(ID="Green")) creates a signal state reference that references a signal state with the ID "Green".

    Examples

    collapse all

    Create signal state references by creating a signal type definition with a complete bulb configuration for a traffic light, then add the signal state references to a phase to control traffic signal behavior during that phase interval.

    Create a bulb representing the green light of a traffic signal.

    bulbGreen = roadrunner.hdmap.Bulb(ID="BulbGreen",Name="Green Light");

    Create a bulb state that sets the green bulb to "On".

    bulbStateGreen = roadrunner.hdmap.BulbState(BulbRef=roadrunner.hdmap.Reference(ID="BulbGreen"),State="On");

    Create a signal state representing the green signal configuration. This signal state defines the bulb state for the green bulb.

    signalStateGreen = roadrunner.hdmap.SignalState(ID="Green",StateName="Green",BulbStates=bulbStateGreen);

    Create a signal type that includes the bulb and signal state.

    signalType = roadrunner.hdmap.SignalType(ID="TrafficLight",Bulbs=bulbGreen,SignalStates=signalStateGreen);

    Create a phase in which east–west traffic has green lights.

    ewGreen = roadrunner.hdmap.Phase(ID="ewGreen",Name="East-West Green",Time=20);

    Create signal state references for the three signals at the junction.

    signalStateRefWest = roadrunner.hdmap.SignalStateReference(SignalTypeRef=roadrunner.hdmap.Reference(ID="TrafficLight"), ...
        SignalStateRef=roadrunner.hdmap.Reference(ID="Green"));
    signalStateRefEast = roadrunner.hdmap.SignalStateReference(SignalTypeRef=roadrunner.hdmap.Reference(ID="TrafficLight"), ...
        SignalStateRef=roadrunner.hdmap.Reference(ID="Green"));
    signalStateRefSouth = roadrunner.hdmap.SignalStateReference(SignalTypeRef=roadrunner.hdmap.Reference(ID="TrafficLight"), ...
        SignalStateRef=roadrunner.hdmap.Reference(ID="Red"));

    Add the signal state references to the phase.

    ewGreen.SignalStateReferences(end+1) = signalStateRefWest;
    ewGreen.SignalStateReferences(end+1) = signalStateRefEast;
    ewGreen.SignalStateReferences(end+1) = signalStateRefSouth;

    Display the phase containing signal state references.

    disp(ewGreen)
      Phase with properties:
    
                           ID: "ewGreen"
                         Name: "East-West Green"
                         Time: 20
           JunctionLaneStates: [0×1 roadrunner.hdmap.JunctionLaneState]
        SignalStateReferences: [3×1 roadrunner.hdmap.SignalStateReference]
    

    Limitations

    • RoadRunner does not import or apply phase to signal state mapping information defined in RoadRunner HD Map files when you load them into a RoadRunner scene.

    Version History

    Introduced in R2026b