CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
rpc
LibCarla/source/carla/rpc/VehicleLightState.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/MsgPack.h
"
10
11
#ifdef LIBCARLA_INCLUDED_FROM_UE4
12
#include <
util/enable-ue4-macros.h
>
13
#include "
Carla/Vehicle/VehicleLightState.h
"
14
#include <
util/disable-ue4-macros.h
>
15
#endif
// LIBCARLA_INCLUDED_FROM_UE4
16
17
namespace
carla
{
18
namespace
rpc
{
19
20
#define SET_FLAG(flag, value) flag |= static_cast<flag_type>(value)
21
22
#define FLAG_ENABLED(flag, value) flag & static_cast<flag_type>(value)
23
24
/// Defines the physical appearance of a vehicle whitch is obtained
25
/// by the sensors.
26
class
VehicleLightState
{
27
public
:
28
29
using
flag_type
= uint32_t;
30
31
/// Can be used as flags
32
enum class
LightState
:
flag_type
{
33
None
= 0,
34
Position
= 0x1,
35
LowBeam = 0x1 << 1,
36
HighBeam = 0x1 << 2,
37
Brake = 0x1 << 3,
38
RightBlinker = 0x1 << 4,
39
LeftBlinker = 0x1 << 5,
40
Reverse = 0x1 << 6,
41
Fog = 0x1 << 7,
42
Interior = 0x1 << 8,
43
Special1 = 0x1 << 9,
// E.g: sirens
44
Special2 = 0x1 << 10,
45
All
= 0xFFFFFFFF
46
};
47
48
VehicleLightState
() =
default
;
49
50
VehicleLightState
(
LightState
light_state
)
51
:
light_state
(static_cast<
flag_type
>(
light_state
)) {}
52
53
VehicleLightState
(
flag_type
light_state
)
54
:
light_state
(
light_state
) {}
55
56
#ifdef LIBCARLA_INCLUDED_FROM_UE4
57
58
VehicleLightState
(
const
FVehicleLightState
&InLightState) {
59
light_state
=
static_cast<
flag_type
>
(
LightState::None
);
60
if
(InLightState.
Position
)
SET_FLAG
(
light_state
,
LightState::Position
);
61
if
(InLightState.
LowBeam
)
SET_FLAG
(
light_state
,
LightState::LowBeam
);
62
if
(InLightState.
HighBeam
)
SET_FLAG
(
light_state
,
LightState::HighBeam
);
63
if
(InLightState.
Brake
)
SET_FLAG
(
light_state
,
LightState::Brake
);
64
if
(InLightState.
RightBlinker
)
SET_FLAG
(
light_state
,
LightState::RightBlinker
);
65
if
(InLightState.
LeftBlinker
)
SET_FLAG
(
light_state
,
LightState::LeftBlinker
);
66
if
(InLightState.
Reverse
)
SET_FLAG
(
light_state
,
LightState::Reverse
);
67
if
(InLightState.
Fog
)
SET_FLAG
(
light_state
,
LightState::Fog
);
68
if
(InLightState.
Interior
)
SET_FLAG
(
light_state
,
LightState::Interior
);
69
if
(InLightState.
Special1
)
SET_FLAG
(
light_state
,
LightState::Special1
);
70
if
(InLightState.
Special2
)
SET_FLAG
(
light_state
,
LightState::Special2
);
71
}
72
73
operator
FVehicleLightState
()
const
{
74
FVehicleLightState
Lights;
// By default all False
75
if
(
FLAG_ENABLED
(
light_state
,
LightState::Position
)) Lights.
Position
=
true
;
76
if
(
FLAG_ENABLED
(
light_state
,
LightState::LowBeam
)) Lights.
LowBeam
=
true
;
77
if
(
FLAG_ENABLED
(
light_state
,
LightState::HighBeam
)) Lights.
HighBeam
=
true
;
78
if
(
FLAG_ENABLED
(
light_state
,
LightState::Brake
)) Lights.
Brake
=
true
;
79
if
(
FLAG_ENABLED
(
light_state
,
LightState::RightBlinker
)) Lights.
RightBlinker
=
true
;
80
if
(
FLAG_ENABLED
(
light_state
,
LightState::LeftBlinker
)) Lights.
LeftBlinker
=
true
;
81
if
(
FLAG_ENABLED
(
light_state
,
LightState::Reverse
)) Lights.
Reverse
=
true
;
82
if
(
FLAG_ENABLED
(
light_state
,
LightState::Fog
)) Lights.
Fog
=
true
;
83
if
(
FLAG_ENABLED
(
light_state
,
LightState::Interior
)) Lights.
Interior
=
true
;
84
if
(
FLAG_ENABLED
(
light_state
,
LightState::Special1
)) Lights.
Special1
=
true
;
85
if
(
FLAG_ENABLED
(
light_state
,
LightState::Special2
)) Lights.
Special2
=
true
;
86
return
Lights;
87
}
88
89
#endif
// LIBCARLA_INCLUDED_FROM_UE4
90
91
/// Returns the current light state as an enum type
92
LightState
GetLightStateEnum
()
const
{
93
return
static_cast<
LightState
>
(
light_state
);
94
}
95
96
/// Returns the current light state as a value type
97
flag_type
GetLightStateAsValue
()
const
{
98
return
light_state
;
99
}
100
101
/// Lights state flag, all turned off by default
102
flag_type
light_state
=
static_cast<
flag_type
>
(
LightState::None
);
103
104
MSGPACK_DEFINE_ARRAY(
light_state
)
105
106
};
107
108
}
// namespace rpc
109
}
// namespace carla
CarlaRecorderPacketId::Position
@ Position
Definition
CarlaRecorder.h:57
EVehicleDoor::All
@ All
Definition
CarlaWheeledVehicle.h:76
FLAG_ENABLED
#define FLAG_ENABLED(flag, value)
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:22
SET_FLAG
#define SET_FLAG(flag, value)
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:20
MsgPack.h
VehicleLightState.h
carla::rpc::VehicleLightState::VehicleLightState
VehicleLightState(const FVehicleLightState &InLightState)
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:58
carla::rpc::VehicleLightState::flag_type
uint32_t flag_type
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:29
carla::rpc::VehicleLightState::GetLightStateEnum
LightState GetLightStateEnum() const
Returns the current light state as an enum type.
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:92
carla::rpc::VehicleLightState::VehicleLightState
VehicleLightState(flag_type light_state)
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:53
carla::rpc::VehicleLightState::LightState
LightState
Can be used as flags.
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:32
carla::rpc::VehicleLightState::LightState::Special1
@ Special1
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:43
carla::rpc::VehicleLightState::LightState::HighBeam
@ HighBeam
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:36
carla::rpc::VehicleLightState::LightState::Position
@ Position
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:34
carla::rpc::VehicleLightState::LightState::LowBeam
@ LowBeam
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:35
carla::rpc::VehicleLightState::LightState::Reverse
@ Reverse
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:40
carla::rpc::VehicleLightState::LightState::None
@ None
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:33
carla::rpc::VehicleLightState::LightState::Brake
@ Brake
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:37
carla::rpc::VehicleLightState::LightState::Special2
@ Special2
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:44
carla::rpc::VehicleLightState::LightState::Fog
@ Fog
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:41
carla::rpc::VehicleLightState::LightState::LeftBlinker
@ LeftBlinker
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:39
carla::rpc::VehicleLightState::LightState::RightBlinker
@ RightBlinker
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:38
carla::rpc::VehicleLightState::LightState::Interior
@ Interior
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:42
carla::rpc::VehicleLightState::VehicleLightState
VehicleLightState()=default
carla::rpc::VehicleLightState::GetLightStateAsValue
flag_type GetLightStateAsValue() const
Returns the current light state as a value type.
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:97
carla::rpc::VehicleLightState::VehicleLightState
VehicleLightState(LightState light_state)
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:50
carla::rpc::VehicleLightState::light_state
flag_type light_state
Lights state flag, all turned off by default.
Definition
LibCarla/source/carla/rpc/VehicleLightState.h:102
disable-ue4-macros.h
enable-ue4-macros.h
carla::rpc
Definition
DebugShapeDrawer.h:11
carla::rpc::MapLayer::None
@ None
Definition
MapLayer.h:20
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
FVehicleLightState
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:13
FVehicleLightState::LeftBlinker
bool LeftBlinker
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:32
FVehicleLightState::Reverse
bool Reverse
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:35
FVehicleLightState::Position
bool Position
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:17
FVehicleLightState::Interior
bool Interior
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:41
FVehicleLightState::Special2
bool Special2
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:47
FVehicleLightState::LowBeam
bool LowBeam
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:20
FVehicleLightState::Special1
bool Special1
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:44
FVehicleLightState::Brake
bool Brake
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:26
FVehicleLightState::HighBeam
bool HighBeam
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:23
FVehicleLightState::RightBlinker
bool RightBlinker
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:29
FVehicleLightState::Fog
bool Fog
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Vehicle/VehicleLightState.h:38
Generated by
1.18.0