maliput
TrafficLight Class Referencefinal

Detailed Description

Models a traffic light.

A traffic light is a physical signaling device typically located at road intersections. It contains one or more groups of light bulbs with varying colors and shapes. The lighting patterns of the bulbs signify right-of-way rule information to the agents navigating the intersection (e.g., vehicles, bicyclists, pedestrians, etc.). Typically, an intersection will be managed by multiple traffic lights.

Note that traffic lights are physical manifestations of underlying right-of-way rules and thus naturally have lower signal-to-noise ratio relative to the underlying rules. Thus, oracular agents should directly use the underlying right-of-way rules instead of traffic lights when navigating intersections. TrafficLight exists for testing autonomous vehicles that do not have access to right-of-way rules.

#include <include/maliput/api/rules/traffic_lights.h>

Public Types

using Id = TypeSpecificIdentifier< TrafficLight >
 Unique identifier for a traffic light. More...
 

Public Member Functions

 MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN (TrafficLight)
 
 TrafficLight (const Id &id, const InertialPosition &position_road_network, const Rotation &orientation_road_network, std::vector< std::unique_ptr< BulbGroup >> bulb_groups, std::vector< LaneId > related_lanes)
 Constructs a TrafficLight instance. More...
 
const Idid () const
 Returns this traffic light's unique identifier. More...
 
const InertialPositionposition_road_network () const
 Returns this traffic light's frame's position within the road network's frame. More...
 
const Rotationorientation_road_network () const
 
std::vector< const BulbGroup * > bulb_groups () const
 Returns the bulb groups contained within this traffic light. More...
 
const BulbGroupGetBulbGroup (const BulbGroup::Id &id) const
 Gets the specified BulbGroup. Returns nullptr if id is unrecognized. More...
 
const std::vector< LaneId > & related_lanes () const
 Returns the lanes that this traffic light is physically relevant to. More...
 
std::map< UniqueBulbId, BulbStateInitialBulbStates () const
 Returns the initial bulb state for every bulb in this traffic light. More...
 

Member Typedef Documentation

◆ Id

Unique identifier for a traffic light.

Constructor & Destructor Documentation

◆ TrafficLight()

TrafficLight ( const Id id,
const InertialPosition position_road_network,
const Rotation orientation_road_network,
std::vector< std::unique_ptr< BulbGroup >>  bulb_groups,
std::vector< LaneId related_lanes 
)

Constructs a TrafficLight instance.

Parameters
idThe traffic light's ID. It must be unique in the context of the TrafficLightBook that contains it.
position_road_networkThe linear offset of the traffic light's frame relative to the road network's frame. The traffic light frame's origin should approximate the traffic light's CoM.
orientation_road_networkThe rotational offset of the traffic light's frame relative to the road network's frame. The traffic light's frame's +Z axis points in the traffic light's "up" direction. No constraints are placed on the orientations of the +X and +Y axes. However, it's recommended that they correspond, if possible, to the orientations of the bulb group frames within this traffic light. In particular, when the traffic light only has one bulb group, all three axes of both the traffic light and bulb group should ideally match, if possible.
bulb_groupsThe bulb groups that are part of this traffic light. There must not be BulbGroups with the same BulbGroup::Ids. Null bulb groups are not allowed.
related_lanesThe lanes that this traffic light is physically relevant to. For example, a traffic light at an intersection is relevant to the lanes that face it. This captures a spatial/geometric fact about the traffic light placement, not a rule relationship. The precise semantic meaning (e.g., right-of-way) is determined by the rule system, not by this field. It is the backend's responsibility to populate this. May be empty if the traffic light is not associated with specific lanes.
Exceptions
common::traffic_light_book_errorWhen there are BulbGroups with the same BulbGroup::Id in bulb_groups.
common::traffic_light_book_errorWhen any of the BulbGroup in bulb_groups is nullptr.

Member Function Documentation

◆ bulb_groups()

std::vector< const BulbGroup * > bulb_groups ( ) const

Returns the bulb groups contained within this traffic light.

◆ GetBulbGroup()

const BulbGroup * GetBulbGroup ( const BulbGroup::Id id) const

Gets the specified BulbGroup. Returns nullptr if id is unrecognized.

◆ id()

const Id& id ( ) const

Returns this traffic light's unique identifier.

◆ InitialBulbStates()

std::map< UniqueBulbId, BulbState > InitialBulbStates ( ) const

Returns the initial bulb state for every bulb in this traffic light.

The map is keyed by UniqueBulbId and the value is the initial BulbState. For bulbs without an explicitly specified initial state, BulbState::kOff is used.

◆ MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN()

MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN ( TrafficLight  )

◆ orientation_road_network()

const Rotation& orientation_road_network ( ) const

◆ position_road_network()

const InertialPosition& position_road_network ( ) const

Returns this traffic light's frame's position within the road network's frame.

◆ related_lanes()

const std::vector<LaneId>& related_lanes ( ) const

Returns the lanes that this traffic light is physically relevant to.

This captures which lanes the traffic light faces or is associated with from a spatial perspective. It is distinct from rule-lane associations: a rule's zone (LaneSRange) defines the precise region where the rule applies, while this field captures the physical placement relationship.


The documentation for this class was generated from the following files: