CARLA
 
载入中...
搜索中...
未找到
TrafficLight.h
浏览该文件的文档.
1// Copyright (c) 2017 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#include "carla/client/Map.h"
14
15namespace carla {
16namespace client {
17
18 class TrafficLight : public TrafficSign {
19
20 public:
21
22 explicit TrafficLight(ActorInitializer init) : TrafficSign(std::move(init)) {}
23
25
26 /// Return the current state of the traffic light.
27 ///
28 /// @note This function does not call the simulator, it returns the data
29 /// received in the last tick.
31
32 void SetGreenTime(float green_time);
33
34 /// @note This function does not call the simulator, it returns the data
35 /// received in the last tick.
36 float GetGreenTime() const;
37
38 void SetYellowTime(float yellow_time);
39
40 /// @note This function does not call the simulator, it returns the data
41 /// received in the last tick.
42 float GetYellowTime() const;
43
44 void SetRedTime(float red_time);
45
46 /// @note This function does not call the simulator, it returns the data
47 /// received in the last tick.
48 float GetRedTime() const;
49
50 /// @note This function does not call the simulator, it returns the data
51 /// received in the last tick.
52 float GetElapsedTime() const;
53
54 void Freeze(bool freeze);
55
56 /// @note This function does not call the simulator, it returns the data
57 /// received in the last tick.
58 bool IsFrozen() const;
59
60 /// Returns the index of the pole in the traffic light group
61 uint32_t GetPoleIndex();
62
63 /// Return all traffic lights in the group this one belongs to.
64 ///
65 /// @note This function calls the simulator
66 std::vector<SharedPtr<TrafficLight>> GetGroupTrafficLights();
67
68 // resets the timers and states of all groups
69 void ResetGroup();
70
71 std::vector<SharedPtr<Waypoint>> GetAffectedLaneWaypoints() const;
72
73 std::vector<geom::BoundingBox> GetLightBoxes() const;
74
76
77 std::vector<SharedPtr<Waypoint>> GetStopWaypoints() const;
78
79 };
80
81} // namespace client
82} // 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)
std::vector< SharedPtr< Waypoint > > GetStopWaypoints() const
std::vector< SharedPtr< Waypoint > > GetAffectedLaneWaypoints() const
void SetRedTime(float red_time)
std::string SignId
Definition RoadTypes.h:25
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133