Main Content

roadrunner.hdmap.Bulb

R2026b

Define signal bulb in RoadRunner HD Map

Since R2026b

    Description

    A roadrunner.hdmap.Bulb object defines a signal bulb in a RoadRunner HD Map scene model. A Bulb object represents an individual light element within a traffic signal head, such as a red, yellow, or green light. Use this object to define the properties of signal bulbs, including their identity and descriptive information. 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

    bulb = roadrunner.hdmap.Bulb creates an empty signal bulb.

    bulb = roadrunner.hdmap.Bulb(PropertyName=Value) sets one or more properties of the signal bulb using name-value arguments. For example, ID="Bulb1" specifies the ID of the bulb as "Bulb1".

    example

    Properties

    expand all

    ID of the signal bulb, specified as a character vector or string scalar. Use this value to reference a Bulb object using other RoadRunner HD Map objects.

    Example: bulb = roadrunner.hdmap.Bulb(ID="BulbRed") creates a signal bulb with ID "BulbRed" in a RoadRunner HD Map.

    Data Types: char | string

    Name of the signal bulb, specified as a character vector or string scalar. This name provides a descriptive label for the bulb, such as "Red Light", "Yellow Light", or "Green Light".

    Example: bulb = roadrunner.hdmap.Bulb(ID="Bulb1", Name="Red Light") creates a signal bulb with the name "Red Light".

    Data Types: char | string

    User-defined ancillary data, specified as an array of roadrunner.hdmap.Metadata objects. This property stores additional information about the bulb, such as type, color, shape, or other custom properties.

    Examples

    collapse all

    Create a signal bulb representing the red light in a traffic signal.

    bulbMeta = roadrunner.hdmap.Metadata(Name="Color",Value="Red");
    bulbRed = roadrunner.hdmap.Bulb(ID="BulbRed",Name="Red Light",Metadata=bulbMeta)
    bulbRed = 
      Bulb with properties:
    
              ID: "BulbRed"
            Name: "Red Light"
        Metadata: [1×1 roadrunner.hdmap.Metadata]
    
    

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

    bulbStateRed = roadrunner.hdmap.BulbState(BulbRef=roadrunner.hdmap.Reference(ID="BulbRed"),State="On")
    bulbStateRed = 
      BulbState with properties:
    
        BulbReference: [1×1 roadrunner.hdmap.Reference]
                State: "On"
    
    

    Create a signal type definition with a complete bulb configuration for a traffic light.

    Create a bulb representing the red light in a traffic signal.

    bulbRed = roadrunner.hdmap.Bulb(ID="BulbRed",Name="Red Light");

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

    bulbStateRed = roadrunner.hdmap.BulbState(BulbRef=roadrunner.hdmap.Reference(ID="BulbRed"),State="On");

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

    signalStateRed = roadrunner.hdmap.SignalState(ID="Red",StateName="Red",BulbStates=bulbStateRed);

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

    signalType = roadrunner.hdmap.SignalType(ID="TrafficLight",Bulbs=bulbRed,SignalStates=signalStateRed)
    signalType = 
      SignalType with properties:
    
                  ID: "TrafficLight"
           AssetPath: [0×0 roadrunner.hdmap.RelativeAssetPath]
               Bulbs: [1×1 roadrunner.hdmap.Bulb]
        SignalStates: [1×1 roadrunner.hdmap.SignalState]
    
    

    Limitations

    • RoadRunner does not import or build traffic signal bulb information defined in RoadRunner HD Map files when you load them into a RoadRunner scene.

    Version History

    Introduced in R2026b