48 if (
nullptr!= Cast<ACarlaWheeledVehicle>(
Actor))
53 else if (
nullptr!= Cast<ACharacter>(
Actor))
58 else if (
nullptr!= Cast<ATrafficLightBase>(
Actor))
63 else if (
nullptr!= Cast<ATrafficSignBase>(
Actor))
68 else if (
nullptr!= Cast<ASensor>(
Actor))
84 for (
auto &&Tag : SemanticTags)
87 if ((Tag!= crp::CityObjectLabel::None) && (Tag!= crp::CityObjectLabel::Other))
92 return (Str.EndsWith(TEXT(
"s"))? Str.LeftChop(1) : Str);
96 return TEXT(
"unknown");
108 bool IsDormant = CarlaActor && (CarlaActor->
IsDormant());
123 IdType Id = ++FActorRegistry::ID_COUNTER;
126 if (DesiredId!= 0 && Id!= DesiredId) {
128 if (!
Actors.Contains(DesiredId))
145 TEXT(
"This actor's memory address is already registered, "
146 "either you forgot to deregister the actor "
147 "or the actor was garbage collected."));
153 TSharedPtr<FCarlaActor> View =
157 TSharedPtr<FCarlaActor>& Result =
ActorDatabase.Emplace(Id, MoveTemp(View));
173 if (!CarlaActor)
return;
197 check(
Actor!=
nullptr);
211TSharedPtr<FCarlaActor> FActorRegistry::MakeCarlaActor(
218 auto Info = MakeShared<FActorInfo>();
220 Info->Description = std::move(Description);
227 if (
Info->Description.Id.IsEmpty())
234 Info->SerializedData.id = Id;
236 Info->SerializedData.description =
Info->Description;
238 Info->SerializedData.bounding_box =
Info->BoundingBox;
240 Info->SerializedData.semantic_tags.reserve(
Info->SemanticTags.Num());
242 for (
auto &&Tag :
Info->SemanticTags)
244 using tag_t =
decltype(
Info->SerializedData.semantic_tags)::value_type;
245 Info->SerializedData.semantic_tags.emplace_back(
static_cast<tag_t
>(Tag));
248 auto *Sensor = Cast<ASensor>(&
Actor);
249 if (Sensor!=
nullptr)
252 const auto &Token = Sensor->GetToken();
253 Info->SerializedData.stream_token =
decltype(
Info->SerializedData.stream_token)(
254 std::begin(Token.data),
255 std::end(Token.data));
260 TSharedPtr<FCarlaActor> CarlaActor =
263 std::move(
Info), Type,
UE_LOG(LogCarla, Log, TEXT("UActorDispatcher::Destroying actor: '%s' %x"), *Id, Actor)
FString CarlaGetRelevantTagAsString(const TSet< crp::CityObjectLabel > &SemanticTags)
static FCarlaActor::ActorType FActorRegistry_GetActorType(const AActor *Actor)
TSharedPtr< FCarlaActor > MakeCarlaActor(IdType Id, AActor &Actor, FActorDescription Description, carla::rpc::ActorState InState) const
DatabaseType ActorDatabase
TMap< IdType, AActor * > Actors
TMap< AActor *, IdType > Ids
void PutActorToSleep(IdType Id, UCarlaEpisode *CarlaEpisode)
TSharedPtr< const FActorInfo > carla::rpc::ActorState InState
TSharedPtr< const FActorInfo > Info
TSharedPtr< const FActorInfo > carla::rpc::ActorState UWorld Actor
static void GetTagsOfTaggedActor(const AActor &Actor, TSet< crp::CityObjectLabel > &Tags)
检索已标记的角色的标记。CityObjectLabel::None 为 未添加到数组中。
static FString GetTagAsString(crp::CityObjectLabel Tag)
检索已标记的角色的标记。CityObjectLabel::None 为 未添加到数组中。
FCarlaActor::IdType IdType
FCarlaActor * Register(AActor &Actor, FActorDescription Description, IdType DesiredId=0)
名称 参与者注册函数
void Deregister(IdType Id)
FCarlaActor * FindCarlaActor(IdType Id)
static TSharedPtr< FCarlaActor > ConstructCarlaActor(IdType ActorId, AActor *Actor, TSharedPtr< const FActorInfo > Info, ActorType Type, carla::rpc::ActorState InState, UWorld *World)
IdType GetActorId() const
void PutActorToSleep(UCarlaEpisode *CarlaEpisode)
static FBoundingBox GetActorBoundingBox(const AActor *Actor, uint8 InTagQueried=0xFF)
计算给定 Carla actor 的边界框。
包含CARLA流处理相关头文件和Boost.Asio网络库头文件。 包含CARLA的调试功能相关定义。 包含CARLA流处理的端点(EndPoint)类定义。 包含CARLA流处理的令牌(Token)类...