CARLA
Light.cpp
Go to the documentation of this file.
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 
8 #include "carla/client/Light.h"
10 
11 #include <assert.h>
12 
13 namespace carla {
14 namespace client {
15 
17 
19  assert(_light_manager && "No light_manager");
20  return _light_manager->GetColor(_id);
21 }
22 
23 float Light::GetIntensity() const {
24  assert(_light_manager && "No light_manager");
25  return _light_manager->GetIntensity(_id);
26 }
27 
29  assert(_light_manager && "No light_manager");
30  return _light_manager->GetLightGroup(_id);
31 }
32 
34  assert(_light_manager && "No light_manager");
35  return _light_manager->GetLightState(_id);
36 }
37 
38 bool Light::IsOn() const {
39  assert(_light_manager && "No light_manager");
40  return _light_manager->IsActive(_id) == true;
41 }
42 
43 bool Light::IsOff() const {
44  assert(_light_manager && "No light_manager");
45  return _light_manager->IsActive(_id) == false;
46 }
47 
48 void Light::SetColor(Color color) {
49  assert(_light_manager && "No light_manager");
50  _light_manager->SetColor(_id, color);
51 }
52 
53 void Light::SetIntensity(float intensity) {
54  assert(_light_manager && "No light_manager");
55  _light_manager->SetIntensity(_id, intensity);
56 }
57 
59  assert(_light_manager && "No light_manager");
60  _light_manager->SetLightGroup(_id, group);
61 }
62 
63 void Light::SetLightState(const LightState& state) {
64  assert(_light_manager && "No light_manager");
65  _light_manager->SetLightState(_id, state);
66 }
67 
68 void Light::TurnOn() {
69  assert(_light_manager && "No light_manager");
70  _light_manager->SetActive(_id, true);
71 }
72 
74  assert(_light_manager && "No light_manager");
75  _light_manager->SetActive(_id, false);
76 }
77 
78 
79 } // namespace client
80 } // namespace carla
bool IsOff() const
Definition: Light.cpp:43
LightState GetLightState() const
Definition: Light.cpp:33
void SetLightGroup(LightGroup group)
Definition: Light.cpp:58
void SetLightState(const LightState &state)
Definition: Light.cpp:63
void SetColor(Color color)
Definition: Light.cpp:48
A 32-bit BGRA color.
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99
void SetIntensity(float intensity)
Definition: Light.cpp:53
bool IsOn() const
Definition: Light.cpp:38
float GetIntensity() const
Definition: Light.cpp:23
Color GetColor() const
Definition: Light.cpp:18
SharedPtr< LightManager > _light_manager
Definition: Light.h:72
LightGroup GetLightGroup() const
Definition: Light.cpp:28