CARLA
Loading...
Searching...
No Matches
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
12
13namespace carla {
14namespace client {
15
16 class TrafficLight : public TrafficSign {
17
18 public:
19
20 explicit TrafficLight(ActorInitializer init) : TrafficSign(std::move(init)) {}
21
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.
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
72
73 };
74
75} // namespace client
76} // namespace carla
Used to initialize Actor classes.
void SetGreenTime(float green_time)
void SetYellowTime(float yellow_time)
rpc::TrafficLightState GetState() const
Return the current state of the traffic light.
road::SignId GetOpenDRIVEID() const
std::vector< SharedPtr< TrafficLight > > GetGroupTrafficLights()
Return all traffic lights in the group this one belongs to.
void SetState(rpc::TrafficLightState state)
uint32_t GetPoleIndex()
Returns the index of the pole in the traffic light group.
std::vector< geom::BoundingBox > GetLightBoxes() const
TrafficLight(ActorInitializer init)
void SetRedTime(float red_time)
std::string SignId
Definition RoadTypes.h:25
This file contains definitions of common data structures used in traffic manager.