maliput
|
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 Id & | id () const |
Returns this Bulb instance's ID. More... | |
UniqueBulbId | unique_id () const |
Returns this Bulb instance's unique identifier. More... | |
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. More... | |
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. More... | |
const BulbColor & | color () const |
Returns the color of this bulb. More... | |
const BulbType & | type () const |
Returns the type of this bulb. More... | |
std::optional< double > | arrow_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 BoundingBox & | bounding_box () const |
Returns the bounding box of the bulb. More... | |
const BulbGroup * | bulb_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... | |
using Id = TypeSpecificIdentifier<class Bulb> |
Unique identifier for a 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.
id | The bulb's ID. It must be unique in the context of the BulbGroup that contains it. |
Inertial
space.position_bulb_group | The 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_group | The 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. |
color | The color of this bulb. |
type | The type of this bulb. |
arrow_orientation_rad | The 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. |
states | The possible states of this bulb. If this is std::nullopt or an empty vector, this bulb has states {BulbState::kOff, BulbState::kOn}. |
bounding_box | The bounding box of the bulb. See BoundingBox for details about the default value. |
common::assertion_error | When unique_id.bulb_id != id . |
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.
const BoundingBox& bounding_box | ( | ) | const |
Returns the bounding box of the bulb.
const BulbGroup* bulb_group | ( | ) | const |
const BulbColor& color | ( | ) | const |
Returns the color of this bulb.
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.
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 | ( | Bulb | ) |
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.
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.
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.
common::assertion_error | When bulb_group is nullptr. |
const std::vector<BulbState>& states | ( | ) | const |
Returns the possible states of this bulb.
const BulbType& type | ( | ) | const |
Returns the type of this bulb.
UniqueBulbId unique_id | ( | ) | const |
Returns this Bulb instance's unique identifier.
common::assertion_error | When the parent BulbGroup and TrafficLight have not been registered. |