CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
client
TrafficLight.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
#include "
carla/client/TrafficSign.h
"
10
#include "
carla/rpc/TrafficLightState.h
"
11
#include "
carla/geom/BoundingBox.h
"
12
13
namespace
carla
{
14
namespace
client
{
15
16
class
TrafficLight
:
public
TrafficSign
{
17
18
public
:
19
20
explicit
TrafficLight
(
ActorInitializer
init) :
TrafficSign
(
std
::move(init)) {}
21
22
void
SetState
(
rpc::TrafficLightState
state);
23
24
/// Return the current state of the traffic light.
25
///
26
/// @note This function does not call the simulator, it returns the data
27
/// received in the last tick.
28
rpc::TrafficLightState
GetState
()
const
;
29
30
void
SetGreenTime
(
float
green_time);
31
32
/// @note This function does not call the simulator, it returns the data
33
/// received in the last tick.
34
float
GetGreenTime
()
const
;
35
36
void
SetYellowTime
(
float
yellow_time);
37
38
/// @note This function does not call the simulator, it returns the data
39
/// received in the last tick.
40
float
GetYellowTime
()
const
;
41
42
void
SetRedTime
(
float
red_time);
43
44
/// @note This function does not call the simulator, it returns the data
45
/// received in the last tick.
46
float
GetRedTime
()
const
;
47
48
/// @note This function does not call the simulator, it returns the data
49
/// received in the last tick.
50
float
GetElapsedTime
()
const
;
51
52
void
Freeze
(
bool
freeze);
53
54
/// @note This function does not call the simulator, it returns the data
55
/// received in the last tick.
56
bool
IsFrozen
()
const
;
57
58
/// Returns the index of the pole in the traffic light group
59
uint32_t
GetPoleIndex
();
60
61
/// Return all traffic lights in the group this one belongs to.
62
///
63
/// @note This function calls the simulator
64
std::vector<SharedPtr<TrafficLight>>
GetGroupTrafficLights
();
65
66
// resets the timers and states of all groups
67
void
ResetGroup
();
68
69
std::vector<geom::BoundingBox>
GetLightBoxes
()
const
;
70
71
road::SignId
GetOpenDRIVEID
()
const
;
72
73
};
74
75
}
// namespace client
76
}
// namespace carla
BoundingBox.h
TrafficLightState.h
TrafficSign.h
carla::client::ActorInitializer
Used to initialize Actor classes.
Definition
client/detail/ActorState.h:112
carla::client::TrafficLight::ResetGroup
void ResetGroup()
Definition
TrafficLight.cpp:74
carla::client::TrafficLight::SetGreenTime
void SetGreenTime(float green_time)
Definition
TrafficLight.cpp:22
carla::client::TrafficLight::SetYellowTime
void SetYellowTime(float yellow_time)
Definition
TrafficLight.cpp:30
carla::client::TrafficLight::GetElapsedTime
float GetElapsedTime() const
Definition
TrafficLight.cpp:46
carla::client::TrafficLight::GetState
rpc::TrafficLightState GetState() const
Return the current state of the traffic light.
Definition
TrafficLight.cpp:18
carla::client::TrafficLight::GetOpenDRIVEID
road::SignId GetOpenDRIVEID() const
Definition
TrafficLight.cpp:82
carla::client::TrafficLight::GetGroupTrafficLights
std::vector< SharedPtr< TrafficLight > > GetGroupTrafficLights()
Return all traffic lights in the group this one belongs to.
Definition
TrafficLight.cpp:64
carla::client::TrafficLight::SetState
void SetState(rpc::TrafficLightState state)
Definition
TrafficLight.cpp:14
carla::client::TrafficLight::IsFrozen
bool IsFrozen() const
Definition
TrafficLight.cpp:55
carla::client::TrafficLight::GetPoleIndex
uint32_t GetPoleIndex()
Returns the index of the pole in the traffic light group.
Definition
TrafficLight.cpp:59
carla::client::TrafficLight::GetLightBoxes
std::vector< geom::BoundingBox > GetLightBoxes() const
Definition
TrafficLight.cpp:78
carla::client::TrafficLight::Freeze
void Freeze(bool freeze)
Definition
TrafficLight.cpp:50
carla::client::TrafficLight::TrafficLight
TrafficLight(ActorInitializer init)
Definition
TrafficLight.h:20
carla::client::TrafficLight::GetRedTime
float GetRedTime() const
Definition
TrafficLight.cpp:42
carla::client::TrafficLight::GetGreenTime
float GetGreenTime() const
Definition
TrafficLight.cpp:26
carla::client::TrafficLight::SetRedTime
void SetRedTime(float red_time)
Definition
TrafficLight.cpp:38
carla::client::TrafficLight::GetYellowTime
float GetYellowTime() const
Definition
TrafficLight.cpp:34
carla::client::TrafficSign::TrafficSign
TrafficSign(ActorInitializer init)
Definition
TrafficSign.h:19
carla::client
Definition
BasicAgent.h:24
carla::road::SignId
std::string SignId
Definition
RoadTypes.h:25
carla::rpc::TrafficLightState
TrafficLightState
Definition
LibCarla/source/carla/rpc/TrafficLightState.h:16
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
std
Definition
CarlaRecorderCollision.h:31
Generated by
1.18.0