maliput
Bulb Class Referencefinal

Detailed Description

Models a bulb within a bulb group.

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

Classes

struct  BoundingBox
 Defines the bounding box of the bulb. More...
 

Public Types

using Id = TypeSpecificIdentifier< class Bulb >
 Unique identifier for a Bulb. More...
 

Public Member Functions

 MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN (Bulb)
 
 Bulb (const Id &id, const InertialPosition &position_bulb_group, const Rotation &orientation_bulb_group, const BulbColor &color, const BulbType &type, const std::optional< double > &arrow_orientation_rad=std::nullopt, const std::optional< std::vector< BulbState >> &states=std::nullopt, BoundingBox bounding_box=BoundingBox())
 Constructs a Bulb instance. More...
 
const Idid () const
 Returns this Bulb instance's ID. More...
 
UniqueBulbId unique_id () const
 Returns this Bulb instance's unique identifier. More...
 
const InertialPositionposition_bulb_group () const
 Returns the linear offset of this bulb's frame relative to the frame of the bulb group that contains it. More...
 
const Rotationorientation_bulb_group () const
 Returns the rotational offset of this bulb's frame relative to the frame of the bulb group that contains it. More...
 
const BulbColorcolor () const
 Returns the color of this bulb. More...
 
const BulbTypetype () const
 Returns the type of this bulb. More...
 
std::optional< doublearrow_orientation_rad () const
 Returns the arrow's orientation. More...
 
const std::vector< BulbState > & states () const
 Returns the possible states of this bulb. More...
 
BulbState GetDefaultState () const
 Returns the default state of the bulb. More...
 
bool IsValidState (const BulbState &bulb_state) const
 Returns true if bulb_state is one of this bulb's possible states. More...
 
const BoundingBoxbounding_box () const
 Returns the bounding box of the bulb. More...
 
const BulbGroupbulb_group () const
 Returns the parent BulbGroup of the bulb. More...
 
void SetBulbGroup (common::Passkey< BulbGroup >, const BulbGroup *bulb_group)
 Sets the parent BulbGroup pointer. More...
 

Member Typedef Documentation

◆ Id

using Id = TypeSpecificIdentifier<class Bulb>

Unique identifier for a Bulb.

Constructor & Destructor Documentation

◆ Bulb()

Bulb ( const Id id,
const InertialPosition position_bulb_group,
const Rotation orientation_bulb_group,
const BulbColor color,
const BulbType type,
const std::optional< double > &  arrow_orientation_rad = std::nullopt,
const std::optional< std::vector< BulbState >> &  states = std::nullopt,
BoundingBox  bounding_box = BoundingBox() 
)

Constructs a Bulb instance.

Parameters
idThe bulb's ID. It must be unique in the context of the BulbGroup that contains it.
See also
UniqueBulbId to uniquely identify a Bulb in the Inertial space.
Parameters
position_bulb_groupThe linear offset of this bulb's frame relative to the frame of the bulb group that contains it. The origin of this bulb's frame should approximate the bulb's CoM.
orientation_bulb_groupThe rotational offset of this bulb's frame relative to the frame of the bulb group that contains it. The +Z axis should align with the bulb's "up" direction and the +X axis should point in the direction that the bulb is facing. Following a right-handed coordinate frame, the +Y axis should point left when facing the +X direction.
colorThe color of this bulb.
typeThe type of this bulb.
arrow_orientation_radThe orientation of the arrow when type is BulbType::kArrow. This is the angle along the bulb's +X axis relative to the bulb's +Y axis. For example, an angle of zero means the bulb's arrow is pointing along the bulb's +Y axis, which means it's a right-turn arrow when viewed by an approaching vehicle. Similarly, an angle of PI/2 points in the bulb's +Z direction (i.e., forward from an approaching vehicle's perspective), and an angle of PI points to in the bulb's -Y direction (i.e., left from an approaching vehicle's perspective). This parameter must be defined when type is BulbType::kArrow, otherwise an exception will be thrown. An exception will also be thrown if this parameter is defined for non-arrow BulbType values.
statesThe possible states of this bulb. If this is std::nullopt or an empty vector, this bulb has states {BulbState::kOff, BulbState::kOn}.
bounding_boxThe bounding box of the bulb. See BoundingBox for details about the default value.
Exceptions
common::assertion_errorWhen unique_id.bulb_id != id.

Member Function Documentation

◆ arrow_orientation_rad()

std::optional<double> arrow_orientation_rad ( ) const

Returns the arrow's orientation.

Only applicable if type() returns BulbType::kArrow. See constructor's documentation for semantics.

◆ bounding_box()

const BoundingBox& bounding_box ( ) const

Returns the bounding box of the bulb.

◆ bulb_group()

const BulbGroup* bulb_group ( ) const

Returns the parent BulbGroup of the bulb.

When this bulb has not been registered in a BulbGroup, this method returns nullptr.

◆ color()

const BulbColor& color ( ) const

Returns the color of this bulb.

◆ GetDefaultState()

BulbState GetDefaultState ( ) const

Returns the default state of the bulb.

The priority order is BulbState::kOff, BulbState::kBlinking, then BulbState::kOn. For example, if a bulb can be in states {BulbState::kOff, BulbState::kOn}, its default state will be BulbState::kOff. Likewise, if a bulb can be in states {BulbState::kOn, BulbState::kBlinking}, its default state will be BulbState::kBlinking. The only case where the default state is BulbState::kOn is when this is the bulb's only possible state.

◆ id()

const Id& id ( ) const

Returns this Bulb instance's ID.

◆ IsValidState()

bool IsValidState ( const BulbState bulb_state) const

Returns true if bulb_state is one of this bulb's possible states.

◆ MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN()

MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN ( Bulb  )

◆ orientation_bulb_group()

const Rotation& orientation_bulb_group ( ) const

Returns the rotational offset of this bulb's frame relative to the frame of the bulb group that contains it.

◆ position_bulb_group()

const InertialPosition& position_bulb_group ( ) const

Returns the linear offset of this bulb's frame relative to the frame of the bulb group that contains it.

◆ SetBulbGroup()

void SetBulbGroup ( common::Passkey< BulbGroup ,
const BulbGroup bulb_group 
)

Sets the parent BulbGroup pointer.

This method is thought to be called once by bulb_group at its construct time.

Exceptions
common::assertion_errorWhen bulb_group is nullptr.

◆ states()

const std::vector<BulbState>& states ( ) const

Returns the possible states of this bulb.

◆ type()

const BulbType& type ( ) const

Returns the type of this bulb.

◆ unique_id()

UniqueBulbId unique_id ( ) const

Returns this Bulb instance's unique identifier.

Exceptions
common::assertion_errorWhen the parent BulbGroup and TrafficLight have not been registered.
See also
SetBulbGroup() and
BulbGroup::SetTrafficLight().

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