CARLA
 
载入中...
搜索中...
未找到
LibCarla/source/carla/rpc/VehicleLightState.h
浏览该文件的文档.
1// Copyright (c) 2020 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
15#endif // LIBCARLA_INCLUDED_FROM_UE4
16
17namespace carla {
18namespace 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.
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
52
55
56#ifdef LIBCARLA_INCLUDED_FROM_UE4
57
72
73 operator FVehicleLightState() const {
74 FVehicleLightState Lights; // By default all False
82 if (FLAG_ENABLED(light_state, LightState::Fog)) Lights.Fog = true;
86 return Lights;
87 }
88
89#endif // LIBCARLA_INCLUDED_FROM_UE4
90
91 /// Returns the current light state as an enum type
93 return static_cast<LightState>(light_state);
94 }
95
96 /// Returns the current light state as a value type
98 return light_state;
99 }
100
101 /// Lights state flag, all turned off by default
103
104 MSGPACK_DEFINE_ARRAY(light_state)
105
106 };
107
108} // namespace rpc
109} // namespace carla
#define FLAG_ENABLED(flag, value)
#define SET_FLAG(flag, value)
Defines the physical appearance of a vehicle whitch is obtained by the sensors.
VehicleLightState(const FVehicleLightState &InLightState)
LightState GetLightStateEnum() const
Returns the current light state as an enum type
flag_type GetLightStateAsValue() const
Returns the current light state as a value type
flag_type light_state
Lights state flag, all turned off by default
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133