CARLA
 
载入中...
搜索中...
未找到
LibCarla/source/carla/rpc/ActorAttribute.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
9#include "carla/MsgPack.h"
11#include "carla/rpc/String.h"
12
13#include <vector>
14
16
17#ifdef LIBCARLA_INCLUDED_FROM_UE4
21#endif // LIBCARLA_INCLUDED_FROM_UE4
22
23namespace carla {
24namespace rpc {
25
27 public:
28
29 ActorAttribute() = default;
30
31 std::string id;
32
34
35 std::string value;
36
37 std::vector<std::string> recommended_values;
38
39 bool is_modifiable = true;
40
42
43#ifdef LIBCARLA_INCLUDED_FROM_UE4
44
46 : id(FromFString(Attribute.Id)),
47 type(static_cast<ActorAttributeType>(Attribute.Type)),
48 value(FromFString(Attribute.Value)),
49 is_modifiable(false) {}
50
52 : id(FromFString(Variation.Id)),
53 type(static_cast<ActorAttributeType>(Variation.Type)),
54 is_modifiable(true),
55 restrict_to_recommended(Variation.bRestrictToRecommended) {
56 recommended_values.reserve(Variation.RecommendedValues.Num());
57 for (const auto &Item : Variation.RecommendedValues) {
58 recommended_values.push_back(FromFString(Item));
59 }
60 if (!recommended_values.empty()) {
62 }
63 }
64
65#endif // LIBCARLA_INCLUDED_FROM_UE4
66
68 };
69
71 public:
72
74
76 : id(attribute.id),
77 type(attribute.type),
78 value(attribute.value) {}
79
80 std::string id;
81
83
84 std::string value;
85
86#ifdef LIBCARLA_INCLUDED_FROM_UE4
87
90
91 operator FActorAttribute() const {
92 FActorAttribute Attribute;
93 Attribute.Id = ToFString(id);
94 Attribute.Type = static_cast<EActorAttributeType>(type);
95 Attribute.Value = ToFString(value);
96 return Attribute;
97 }
98
99#endif // LIBCARLA_INCLUDED_FROM_UE4
100
102 };
103
104} // namespace rpc
105} // namespace carla
MSGPACK_ADD_ENUM(carla::rpc::ActorAttributeType)
EActorAttributeType
List of valid types for actor attributes.
MSGPACK_DEFINE_ARRAY(id, type, value)
ActorAttribute(const FActorAttribute &Attribute)
MSGPACK_DEFINE_ARRAY(id, type, value, recommended_values, is_modifiable, restrict_to_recommended)
ActorAttribute(const FActorVariation &Variation)
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133
An actor attribute, may be an intrinsic (non-modifiable) attribute of the actor or an user-defined ac...