CARLA
 
载入中...
搜索中...
未找到
Light.cpp
浏览该文件的文档.
1
2// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
3// de Barcelona (UAB).
4//
5// This work is licensed under the terms of the MIT license.
6// For a copy, see <https://opensource.org/licenses/MIT>.
7
10
11#include <assert.h>
12
13namespace carla {
14namespace client {
15
17
19 auto light_manager = _light_manager.lock();
20 assert(light_manager && "No light_manager");
21 return light_manager->GetColor(_id);
22}
23
24float Light::GetIntensity() const {
25 auto light_manager = _light_manager.lock();
26 assert(light_manager && "No light_manager");
27 return light_manager->GetIntensity(_id);
28}
29
31 auto light_manager = _light_manager.lock();
32 assert(light_manager && "No light_manager");
33 return light_manager->GetLightGroup(_id);
34}
35
37 auto light_manager = _light_manager.lock();
38 assert(light_manager && "No light_manager");
39 return light_manager->GetLightState(_id);
40}
41
42bool Light::IsOn() const {
43 auto light_manager = _light_manager.lock();
44 assert(light_manager && "No light_manager");
45 return light_manager->IsActive(_id) == true;
46}
47
48bool Light::IsOff() const {
49 auto light_manager = _light_manager.lock();
50 assert(light_manager && "No light_manager");
51 return light_manager->IsActive(_id) == false;
52}
53
55 auto light_manager = _light_manager.lock();
56 assert(light_manager && "No light_manager");
57 light_manager->SetColor(_id, color);
58}
59
60void Light::SetIntensity(float intensity) {
61 auto light_manager = _light_manager.lock();
62 assert(light_manager && "No light_manager");
63 light_manager->SetIntensity(_id, intensity);
64}
65
67 auto light_manager = _light_manager.lock();
68 assert(light_manager && "No light_manager");
69 light_manager->SetLightGroup(_id, group);
70}
71
72void Light::SetLightState(const LightState& state) {
73 auto light_manager = _light_manager.lock();
74 assert(light_manager && "No light_manager");
75 light_manager->SetLightState(_id, state);
76}
77
79 auto light_manager = _light_manager.lock();
80 assert(light_manager && "No light_manager");
81 light_manager->SetActive(_id, true);
82}
83
85 auto light_manager = _light_manager.lock();
86 assert(light_manager && "No light_manager");
87 light_manager->SetActive(_id, false);
88}
89
90
91} // namespace client
92} // namespace carla
void SetLightState(const LightState &state)
Definition Light.cpp:72
LightGroup GetLightGroup() const
Definition Light.cpp:30
Color GetColor() const
Definition Light.cpp:18
LightState GetLightState() const
Definition Light.cpp:36
bool IsOn() const
Definition Light.cpp:42
float GetIntensity() const
Definition Light.cpp:24
bool IsOff() const
Definition Light.cpp:48
void SetColor(Color color)
Definition Light.cpp:54
void SetIntensity(float intensity)
Definition Light.cpp:60
WeakPtr< LightManager > _light_manager
Definition Light.h:72
void SetLightGroup(LightGroup group)
Definition Light.cpp:66
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133