Main Content

getAttribute

Return static attribute of actor

Since R2022a

    Description

    staticAttr = getAttribute(actor,attribute) returns the value of the specified static attribute for the ActorModel object actor.

    example

    Examples

    collapse all

    Create a roadrunner object to launch the RoadRunner application, and open the project at the specified project location.

    rrApp = roadrunner("C:\Project\TestRoute")

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

    openScenario(rrApp,"TrajectoryCutIn");

    Create a ScenarioSimulation object ScenarioSim.

    ScenarioSim = createSimulation(rrApp);
    

    Start the simulation.

    set(ScenarioSim,"SimulationCommand","Start")
    

    Pause the simulation.

    set(ScenarioSim,"SimulationCommand","Pause")
    

    Get the ActorSimulation objects corresponding to all actors in the scenario.

    actorsAll = get(ss,"ActorSimulation")

    Get the static specifications of the first actor.

    actormodel = get(actorsAll{1},"ActorModel")

    Get the paint color of the first actor.

    pc = getAttribute(actormodel,"PaintColor")

    Input Arguments

    collapse all

    Actor from which to return static attribute, specified as an ActorModel object.

    Example: actor

    Static attribute of actor, specified as one of these values.

    ParameterDescription
    "ID"Actor identifier, returned as a positive integer
    "Name"Actor name, returned as a string
    "PaintColor"Color of the actor
    "BoundingBox"Bounding box of the actor
    "WheelSpec"Wheel specifications of vehicle-type actor
    "TrafficSignalSpec"Static specifications of traffic signal actor
    "TrafficSignalControllerSpec"Static specifications of traffic signal controller

    Example: "PaintColor"

    Data Types: char | string

    Output Arguments

    collapse all

    Value of static attribute of actor, returned as one of these data types:

    ParameterOutput Data Type
    "ID"uint64
    "Name"char
    "PaintColor"PaintColor structure
    "BoundingBox"BoundingBox structure
    "WheelSpec"WheelSpec structure
    "TrafficSignalSpec"TrafficSignalSpec structure
    "TrafficSignalControllerSpec"TrafficSignalControllerSpec structure

    More About

    collapse all

    PaintColor Structure

    This table describes the fields of the PaintColor structure:

    Field NameDescription
    rRed color, returned as a uint32 value.
    gGreen color, returned as a uint32 value.
    bBlue color, returned as a uint32 value.
    aTransparency of the color (alpha), returned as a uint32 value.

    BoundingBox Structure

    This table describes the fields of the BoundingBox structure:

    Field NameDescription
    MinThe bounding box corner with minimal x-, y- and z- values, returned as a 1-by-3 array.
    MaxThe bounding box corner with maximal x-, y- and z- values, returned as a 1-by-3 array.

    WheelSpec Structure

    This table describes the fields of the WheelSpec structure:

    Field NameDescription
    AxleIndexAxle index of a wheel. The front-most axle has the starting index value of zero, with index values increasing towards the vehicle rear. Returned as a uint32 value.
    WheelOffsetx-, y- and z- coordinates of the wheel center, in the vehicle coordinate system. Returned as a 1-by-3 vector.
    WheelRadiusRadius of the wheel in meters. Returned as a double.

    TrafficSignalSpec Structure

    This table describes the fields of the TrafficSignalSpec structure:

    Field NameDescription
    SignalHead

    Signal head specifications, returned as a structure of type SignalHead.

    SignalPosition

    World coordinates of the point of attachment of a signal head to a traffic signal pole, returned as a 1-by-3 double array.

    SignalStatus

    Status of a traffic signal, returned as an enumeration variable.

    The value of the variable can be:

    • Active — Traffic signal is connected to a controller. The traffic signal is also part of one or more signal phases.

    • Inactive — Traffic signal not connected to a controller.

    NumSignalPhaseState

    Number of signal phases for a traffic signal, returned as a uint32 scalar.

    SignalPhaseState

    Information about each signal phase, returned as a structure array of type SignalPhaseState. The structure array can have a maximum of 1000 elements.

    For more information about signal phases, see the Signal Tool (RoadRunner).

    NumSupportedTurnTypes

    Number of turn types supported by a traffic signal, returned as a uint32 scalar.

    SupportedTurnTypes

    Supported turn types, returned as an enumeration array, with the following possible values:

    • Straight — Drive straight

    • Left — Left turn

    • Right — Right turn

    • U-Left — Left U-turn

    • U-Right — Right U-turn

    • Custom — Custom turn

    NumBulbConfigurations

    Number of signal bulb configurations for the specified traffic signal, returned as a uint32 scalar.

    BulbConfigurations

    Configuration information about signal bulbs, returned as a structure array of type BulbConfigurations.

    NumTurnConfigurations

    Number of turn configurations for the specified traffic signal, returned as a uint32 scalar.

    TurnConfigurations

    Turn configuration information for a traffic signal, returned as a structure array of type TurnConfigurations.

    This table describes the fields of the SignalHead structure:

    Field NameDescription
    SignalID

    Universal unique identifier (UUID) of traffic signal, returned first as a uint8 row vector.

    To convert the row vector into its alphanumeric form, use the char function, which returns the UUID as a character array.

    ControllerID

    UUID of traffic signal controller, returned first as a uint8 row vector.

    To convert the row vector into its alphanumeric form, use the char function, which returns the UUID as a character array.

    This table describes the fields of the SignalPhaseState structure array:

    Field NameDescription
    NumConfigurationIndex

    Number of intervals in a phase, returned as a uint32 scalar.

    ConfigurationIndex

    Configuration index of traffic signal in each interval of a signal phase, returned as a uint32 vector of dimensions 1-by-n. n is the number of intervals within a phase. The maximum value of n is 3.

    The configuration index indicates the configuration of a traffic signal. For example, if the red bulb of a traffic signal is in the "On" state, and the green and yellow bulbs are "Off", then the traffic signal is red. A certain configuration index is assigned to every such possible configuration.

    This table describes the fields of the BulbConfigurations structure array:

    Field NameDescription
    ConfigurationNumber

    Configuration number of traffic signal, returned as a uint32 scalar. Configuration number indicates the overall configuration of a traffic signal - for example, green. That is, the red and yellow bulbs of a traffic signal are in the "Off" state, and the green bulb is in the "On" state.

    This field corresponds to the ConfigurationIndex field of the SignalPhaseState structure.

    NumBulbConfiguration

    Number of bulb configurations for the specified signal, returned as a uint32 scalar.

    BulbConfiguration

    Bulb name and state, returned as a structure array of type BulbConfiguration.

    This table describes the fields of the BulbConfiguration structure array:

    Field NameDescription
    BulbName

    Name of the bulb, returned first as a uint8 row vector.

    This field corresponds to the Node Name of the bulb as seen in the RoadRunner application.

    To obtain a readable word, you must convert the uint8 row vector into a character array by using the char function.

    BulbState

    State of signal bulb, returned as an enumeration variable.

    Possible values of the variable are:

    • On — The bulb is switched on.

    • Off — The bulb is switched off.

    • Blinking — The bulb is blinking on and off.

    This table describes the fields of the TurnCofigurations structure array:

    Field NameDescription
    ConfigurationNumber

    Configuration number of traffic signal, returned as a uint32 scalar. The configuration number indicates the configuration of a traffic signal - for example, green. That is, the red and yellow bulbs of a traffic signal are in the "Off" state, and the green bulb is in the "On" state.

    This field corresponds to the ConfigurationIndex field of the SignalPhaseState structure.

    NumTurnState

    Total number of turn states, returned as a uint32 scalar.

    TurnState

    Turn type in combination with configuration type (maneuver signalization), returned as a structure array of type TurnState.

    For more information about maneuver signalization, see the Maneuver Tool (RoadRunner).

    This table describes the fields of the TurnState structure array:

    Field NameDescription
    TurnType

    Turn types, returned as an enumeration variable.

    Possible values of the variable are:

    • Straight — Drive straight

    • Left — Left turn

    • Right — Right turn

    • UTurnLeft — Left U-turn

    • UTurnRight — Right U-Turn

    • Custom — Custom turn

    Every turn type has a corresponding configuration type (maneuver signalization). The turn type and configuration type together comprise a turn state, which determines the allowed turns at a traffic signal.

    ConfigurationType

    Maneuver signalization, returned as an enumeration variable.

    The value of the variable can be:

    • Green — Go. This value corresponds to the Go always maneuver signalization.

    • Yellow — Go slow. This value corresponds to the Yield maneuver signalization.

    • Red — Stop. This value corresponds to the Stop maneuver signalization.

    • Permitted — Stop. Then, start and yield right of way. This value corresponds to the Stop/Yield maneuver signalization.

    • Ready — Prepare to go.

    • Custom — Custom movement.

    A configuration type (maneuver signalization) is assigned to every turn type. The configuration type and turn type together comprise a turn state, which determines the allowed turns at a traffic signal.

    TrafficSignalControllerSpec Structure

    This table describes the fields of the TrafficSignalControllerSpec structure:

    Field NameDescription
    ControllerID

    UUID of traffic signal controller, returned first as a uint8 row vector.

    To convert the row vector into its alphanumeric form, use the char function, which returns the UUID as a character array.

    NumTrafficSignalControllerPhases

    Number of phases, returned as a uint32 scalar.

    TrafficSignalControllerPhases

    Information about the phases of a traffic signal controller, returned as a structure array of type TrafficSignalControllerPhase. The structure array can have a maximum of 1000 elements.

    This table describes the fields of the TrafficSignalControllerPhase structure array:

    Field NameDescription
    PhaseName

    Name of the phase, returned first as a uint8 row vector.

    To obtain a readable word, you must convert the uint8 row vector into a character array by using the char function.

    NumPhaseInterval

    Number of intervals in the phase, returned as a uint32 scalar.

    PhaseInterval

    Information about the phase interval, returned as a 1-by-n structure array of type PhaseInterval, where n is the number of intervals within a phase. The maximum value of n is 3.

    This table describes the fields of the PhaseInterval structure array:

    Field NameDescription
    IntervalName

    Name of the interval, returned first as a uint8 row vector.

    To obtain a readable word, you must convert the uint8 row vector into a character array by using the char function.

    IntervalType

    Interval type, informing about allowed turn types at a junction, returned as an enumeration variable.

    The value of the variable can be:

    • Green — Green interval of a phase, where certain road maneuvers in a junction are highlighted in green signalization.

    • Yellow — Yellow interval of a phase, where certain road maneuvers in a junction are highlighted in yellow signalization.

    • Red — Red interval of a phase, where certain road maneuvers in a junction are highlighted in red signalization.

    • Custom — Custom road maneuver configuration.

    This field corresponds to the Interval Type of a phase interval, as seen in the RoadRunner application.

    IntervalTime

    Time duration of an interval, returned as a double.

    Version History

    Introduced in R2022a

    expand all