CARLA
 
载入中...
搜索中...
未找到
CarlaReplayerHelper.cpp
浏览该文件的文档.
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#include "Carla.h"
9
27#include "Components/BoxComponent.h"
28#include "Engine/StaticMeshActor.h"
29
33
34
35#include "EngineUtils.h"
36
37// create or reuse an actor for replaying
39 FVector &Location,
40 FVector &Rotation,
41 FActorDescription &ActorDesc,
42 uint32_t DesiredId,
43 bool SpawnSensors)
44{
45 check(Episode != nullptr);
46
47 // check type of actor we need
48 if (ActorDesc.Id.StartsWith("traffic."))
49 {
50 FCarlaActor* CarlaActor = FindTrafficLightAt(Location);
51 if (CarlaActor != nullptr)
52 {
53 // reuse that actor
54 return std::pair<int, FCarlaActor*>(2, CarlaActor);
55 }
56 else
57 {
58 // actor not found
59 UE_LOG(LogCarla, Log, TEXT("TrafficLight not found"));
60 return std::pair<int, FCarlaActor*>(0, nullptr);
61 }
62 }
63 else if (SpawnSensors || !ActorDesc.Id.StartsWith("sensor."))
64 {
65 // check if an actor of that type already exist with same id
66 if (Episode->GetActorRegistry().Contains(DesiredId))
67 {
68 auto* CarlaActor = Episode->FindCarlaActor(DesiredId);
69 const FActorDescription *desc = &CarlaActor->GetActorInfo()->Description;
70 if (desc->Id == ActorDesc.Id)
71 {
72 // we don't need to create, actor of same type already exist
73 // relocate
74 FRotator Rot = FRotator::MakeFromEuler(Rotation);
75 FTransform Trans2(Rot, Location, FVector(1, 1, 1));
76 CarlaActor->SetActorGlobalTransform(Trans2);
77 return std::pair<int, FCarlaActor*>(2, CarlaActor);
78 }
79 }
80 // create the transform
81 FRotator Rot = FRotator::MakeFromEuler(Rotation);
82 FTransform Trans(Rot, FVector(0, 0, 100000), FVector(1, 1, 1));
83 // create as new actor
84 TPair<EActorSpawnResultStatus, FCarlaActor*> Result = Episode->SpawnActorWithInfo(Trans, ActorDesc, DesiredId);
85 if (Result.Key == EActorSpawnResultStatus::Success)
86 {
87 // relocate
88 FTransform Trans2(Rot, Location, FVector(1, 1, 1));
89 Result.Value->SetActorGlobalTransform(Trans2);
90 ALargeMapManager * LargeMapManager = UCarlaStatics::GetLargeMapManager(Episode->GetWorld());
91 if (LargeMapManager)
92 {
93 LargeMapManager->OnActorSpawned(*Result.Value);
94 }
95 return std::pair<int, FCarlaActor*>(1, Result.Value);
96 }
97 else
98 {
99 UE_LOG(LogCarla, Log, TEXT("Actor could't be created by replayer"));
100 return std::pair<int, FCarlaActor*>(0, Result.Value);
101 }
102 }
103 else
104 {
105 // actor ignored
106 return std::pair<int, FCarlaActor*>(0, nullptr);
107 }
108}
109
111{
112 check(Episode != nullptr);
113 auto World = Episode->GetWorld();
114 check(World != nullptr);
115
116 // get its position (truncated as int's)
117 int x = static_cast<int>(Location.X);
118 int y = static_cast<int>(Location.Y);
119 int z = static_cast<int>(Location.Z);
120
121 const FActorRegistry &Registry = Episode->GetActorRegistry();
122 // through all actors in registry
123 for (auto It = Registry.begin(); It != Registry.end(); ++It)
124 {
125 FCarlaActor* CarlaActor = It.Value().Get();
127 {
128 FVector vec = CarlaActor->GetActorGlobalLocation();
129 int x2 = static_cast<int>(vec.X);
130 int y2 = static_cast<int>(vec.Y);
131 int z2 = static_cast<int>(vec.Z);
132 if ((x2 == x) && (y2 == y) && (z2 == z))
133 {
134 // actor found
135 return CarlaActor;
136 }
137 }
138 }
139 // actor not found
140 return nullptr;
141}
142
143// enable / disable physics for an actor
145{
146 if (!CarlaActor)
147 {
148 return false;
149 }
150 ECarlaServerResponse Response =
151 CarlaActor->SetActorSimulatePhysics(bEnabled);
152 if (Response != ECarlaServerResponse::Success)
153 {
154 return false;
155 }
156 return true;
157}
158
159// enable / disable autopilot for an actor
160bool CarlaReplayerHelper::SetActorAutopilot(FCarlaActor* CarlaActor, bool bEnabled, bool bKeepState)
161{
162 if (!CarlaActor)
163 {
164 return false;
165 }
166 ECarlaServerResponse Response =
167 CarlaActor->SetActorAutopilot(bEnabled, bKeepState);
168 if (Response != ECarlaServerResponse::Success)
169 {
170 return false;
171 }
172 return true;
173}
174
175// replay event for creating actor
177 FVector Location,
178 FVector Rotation,
180 uint32_t DesiredId,
181 bool bIgnoreHero,
182 bool bIgnoreSpectator,
183 bool ReplaySensors)
184{
185 check(Episode != nullptr);
186 FActorDescription ActorDesc;
187 bool IsHero = false;
188
189 // prepare actor description
190 ActorDesc.UId = Description.UId;
191 ActorDesc.Id = Description.Id;
192 for (const auto &Item : Description.Attributes)
193 {
194 FActorAttribute Attr;
195 Attr.Type = static_cast<EActorAttributeType>(Item.Type);
196 Attr.Id = Item.Id;
197 Attr.Value = Item.Value;
198 ActorDesc.Variations.Add(Attr.Id, std::move(Attr));
199 // check for hero
200 if (Item.Id == "role_name" && Item.Value == "hero")
201 IsHero = true;
202 }
203
204 // check to ignore Hero or Spectator
205 if ((bIgnoreHero && IsHero) ||
206 (bIgnoreSpectator && ActorDesc.Id.StartsWith("spectator")))
207 {
208 return std::make_pair(3, 0);
209 }
210
211 auto result = TryToCreateReplayerActor(
212 Location,
213 Rotation,
214 ActorDesc,
215 DesiredId,
216 ReplaySensors);
217
218 if (result.first != 0)
219 {
220 // disable physics and autopilot on vehicles
221 if (result.second->GetActorType() == FCarlaActor::ActorType::Vehicle ||
222 result.second->GetActorType() == FCarlaActor::ActorType::Walker)
223 {
224 // ignore hero ?
225 if (!(bIgnoreHero && IsHero))
226 {
227 // disable physics
228 SetActorSimulatePhysics(result.second, false);
229 // disable collisions
230 result.second->GetActor()->SetActorEnableCollision(true);
231 auto RootComponent = Cast<UPrimitiveComponent>(
232 result.second->GetActor()->GetRootComponent());
233 RootComponent->SetSimulatePhysics(false);
234 RootComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
235 // disable autopilot for vehicles
236 if (result.second->GetActorType() == FCarlaActor::ActorType::Vehicle)
237 SetActorAutopilot(result.second, false, false);
238 }
239 else
240 {
241 // enable physics just in case
242 SetActorSimulatePhysics(result.second, true);
243 // enable collisions
244 result.second->GetActor()->SetActorEnableCollision(true);
245 }
246 }
247 return std::make_pair(result.first, result.second->GetActorId());
248 }
249 return std::make_pair(result.first, 0);
250}
251
252// replay event for removing actor
254{
255 check(Episode != nullptr);
256 FCarlaActor* CarlaActor = Episode->FindCarlaActor(DatabaseId);
257 if (CarlaActor == nullptr)
258 {
259 UE_LOG(LogCarla, Log, TEXT("Actor %d not found to destroy"), DatabaseId);
260 return false;
261 }
262 Episode->DestroyActor(CarlaActor->GetActorId());
263 return true;
264}
265
266// replay event for parenting actors
267bool CarlaReplayerHelper::ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId)
268{
269 check(Episode != nullptr);
270 FCarlaActor * Child = Episode->FindCarlaActor(ChildId);
271 FCarlaActor * Parent = Episode->FindCarlaActor(ParentId);
272 if(!Child)
273 {
274 UE_LOG(LogCarla, Log, TEXT("Parenting Child actors not found"));
275 return false;
276 }
277 if(!Parent)
278 {
279 UE_LOG(LogCarla, Log, TEXT("Parenting Parent actors not found"));
280 return false;
281 }
282 Child->SetParent(ParentId);
284 Parent->AddChildren(Child->GetActorId());
285 if(!Parent->IsDormant())
286 {
287 if(!Child->IsDormant())
288 {
290 Child->GetActor(),
291 Parent->GetActor(),
293 }
294 }
295 else
296 {
298 }
299 return true;
300}
301
302// reposition actors
303bool CarlaReplayerHelper::ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime, bool bIgnoreSpectator)
304{
305 check(Episode != nullptr);
306 FCarlaActor* CarlaActor = Episode->FindCarlaActor(Pos1.DatabaseId);
307 FVector Location;
308 FRotator Rotation;
309 if(CarlaActor)
310 {
311 //Hot fix to avoid spectator we should investigate why this case is possible here
312 if(bIgnoreSpectator && CarlaActor->GetActor()->GetClass()->GetFName().ToString().Contains("Spectator"))
313 {
314 return false;
315 }
316 // check to assign first position or interpolate between both
317 if (Per == 0.0)
318 {
319 // assign position 1
320 Location = FVector(Pos1.Location);
321 Rotation = FRotator::MakeFromEuler(Pos1.Rotation);
322 }
323 else
324 {
325 // interpolate positions
326 Location = FMath::Lerp(FVector(Pos1.Location), FVector(Pos2.Location), Per);
327 Rotation = FMath::Lerp(FRotator::MakeFromEuler(Pos1.Rotation), FRotator::MakeFromEuler(Pos2.Rotation), Per);
328 }
329 // set new transform
330 FTransform Trans(Rotation, Location, FVector(1, 1, 1));
331 CarlaActor->SetActorGlobalTransform(Trans, ETeleportType::None);
332 return true;
333 }
334 return false;
335}
336
338{
339 check(Episode != nullptr)
340 FCarlaActor *CarlaActor = Episode->FindCarlaActor(VehicleAnimWheels.DatabaseId);
341 if (CarlaActor == nullptr)
342 return;
344 return;
345 ACarlaWheeledVehicle* CarlaVehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
346 check(CarlaVehicle != nullptr)
347 USkeletalMeshComponent* SkeletalMesh = CarlaVehicle->GetMesh();
348 check(SkeletalMesh != nullptr)
349 UVehicleAnimInstance* VehicleAnim = Cast<UVehicleAnimInstance>(SkeletalMesh->GetAnimInstance());
350 check(VehicleAnim != nullptr)
351
352 for (uint32_t i = 0; i < VehicleAnimWheels.WheelValues.size(); ++i)
353 {
354 const WheelInfo& Element = VehicleAnimWheels.WheelValues[i];
355 VehicleAnim->SetWheelRotYaw(static_cast<uint8>(Element.Location), Element.SteeringAngle);
356 VehicleAnim->SetWheelPitchAngle(static_cast<uint8>(Element.Location), Element.TireRotation);
357 }
358}
359
360// reposition the camera
361bool CarlaReplayerHelper::SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation)
362{
363 check(Episode != nullptr);
364
365 // get the actor to follow
366 FCarlaActor* CarlaActor = Episode->FindCarlaActor(Id);
367 if (!CarlaActor)
368 return false;
369 // get specator pawn
370 APawn *Spectator = Episode->GetSpectatorPawn();
371 if (!Spectator)
372 return false;
373
374 FCarlaActor* CarlaSpectator = Episode->FindCarlaActor(Spectator);
375 if (!CarlaSpectator)
376 return false;
377
378 FTransform ActorTransform = CarlaActor->GetActorGlobalTransform();
379 // set the new position
380 FQuat ActorRot = ActorTransform.GetRotation();
381 FVector Pos = ActorTransform.GetTranslation() + (ActorRot.RotateVector(Offset));
382 CarlaSpectator->SetActorGlobalTransform(FTransform(ActorRot * Rotation, Pos, FVector(1,1,1)));
383
384 return true;
385}
386
388{
389 check(Episode != nullptr);
390 FCarlaActor* CarlaActor = Episode->FindCarlaActor(State.DatabaseId);
391 if(CarlaActor)
392 {
393 CarlaActor->SetTrafficLightState(static_cast<ETrafficLightState>(State.State));
394 UTrafficLightController* Controller = CarlaActor->GetTrafficLightController();
395 if(Controller)
396 {
397 Controller->SetElapsedTime(State.ElapsedTime);
398 ATrafficLightGroup* Group = Controller->GetGroup();
399 if (Group)
400 {
401 Group->SetFrozenGroup(State.IsFrozen);
402 }
403 }
404 return true;
405 }
406 return false;
407}
408
409// set the animation for Vehicles
411{
412 check(Episode != nullptr);
413 FCarlaActor *CarlaActor = Episode->FindCarlaActor(Vehicle.DatabaseId);
414 if (CarlaActor)
415 {
416 FVehicleControl Control;
417 Control.Throttle = Vehicle.Throttle;
418 Control.Steer = Vehicle.Steering;
419 Control.Brake = Vehicle.Brake;
420 Control.bHandBrake = Vehicle.bHandbrake;
421 Control.bReverse = (Vehicle.Gear < 0);
422 Control.Gear = Vehicle.Gear;
423 Control.bManualGearShift = false;
424 CarlaActor->ApplyControlToVehicle(Control, EVehicleInputPriority::User);
425 }
426}
427
428// set the openings and closings of vehicle doors
430{
431 check(Episode != nullptr);
432 FCarlaActor * CarlaActor = Episode->FindCarlaActor(DoorVehicle.DatabaseId);
433 if (CarlaActor)
434 {
435 ACarlaWheeledVehicle * Vehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
436 if (Vehicle) {
437 if(DoorVehicle.bIsOpen){
438 Vehicle->OpenDoor(static_cast<EVehicleDoor>(DoorVehicle.Doors));
439 }else{
440 Vehicle->CloseDoor(static_cast<EVehicleDoor>(DoorVehicle.Doors));
441 }
442 }
443 }
444}
445
446// set the lights for vehicles
448{
449 check(Episode != nullptr);
450 FCarlaActor * CarlaActor = Episode->FindCarlaActor(LightVehicle.DatabaseId);
451 if (CarlaActor)
452 {
453 carla::rpc::VehicleLightState LightState(LightVehicle.State);
454 CarlaActor->SetVehicleLightState(FVehicleLightState(LightState));
455 }
456}
457
459{
460 check(Episode != nullptr);
461 UWorld* World = Episode->GetWorld();
462 if(World)
463 {
464 UCarlaLightSubsystem* CarlaLightSubsystem = World->GetSubsystem<UCarlaLightSubsystem>();
465 if (!CarlaLightSubsystem)
466 {
467 return;
468 }
469 auto* CarlaLight = CarlaLightSubsystem->GetLight(LightScene.LightId);
470 if (CarlaLight)
471 {
472 CarlaLight->SetLightIntensity(LightScene.Intensity);
473 CarlaLight->SetLightColor(LightScene.Color);
474 CarlaLight->SetLightOn(LightScene.bOn);
475 CarlaLight->SetLightType(static_cast<ELightType>(LightScene.Type));
476 }
477 }
478}
479
480// set the animation for walkers
485
487{
488 check(Episode != nullptr);
489 FCarlaActor * CarlaActor = Episode->FindCarlaActor(Biker.DatabaseId);
490 if (CarlaActor == nullptr)
491 return;
492 ACarlaWheeledVehicle* CarlaVehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
493 check(CarlaVehicle != nullptr)
494 CarlaVehicle->SetSpeedAnim(Biker.ForwardSpeed);
495 CarlaVehicle->SetRotationAnim(Biker.EngineRotation);
496}
497
498// set walker bones
500{
501 check(Episode != nullptr);
502
503 FCarlaActor* CarlaActor = Episode->FindCarlaActor(WalkerBones.DatabaseId);
504 if (!CarlaActor) return;
505
506 AActor* Actor = CarlaActor->GetActor();
507 auto Walker = Cast<APawn>(Actor);
508 if (!Walker) return;
509
510 AWalkerController *Controller = Cast<AWalkerController>(Walker->GetController());
511 if (!Controller) return;
512
513 // build bones structure
514 FWalkerBoneControlIn BonesIn;
515 for (const auto &Bone : WalkerBones.Bones)
516 {
517 FTransform Trans(FRotator::MakeFromEuler(Bone.Rotation), Bone.Location, FVector(1, 1, 1));
518 BonesIn.BoneTransforms.Add(Bone.Name, Trans);
519 }
520
521 // set the pose and blend
522 Controller->SetBonesTransform(BonesIn);
523 Controller->BlendPose(1.0f);
524}
525
526// replay finish
527bool CarlaReplayerHelper::ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map<uint32_t, bool> &IsHero)
528{
529 // set autopilot and physics to all AI vehicles
530 const FActorRegistry& Registry = Episode->GetActorRegistry();
531 for (auto& It : Registry)
532 {
533 FCarlaActor* CarlaActor = It.Value.Get();
534
535 // enable physics only on vehicles
536 switch (CarlaActor->GetActorType())
537 {
538
539 // vehicles
541 // check for hero
542 if (!(bIgnoreHero && IsHero[CarlaActor->GetActorId()]))
543 {
544 // stop all vehicles
545 SetActorSimulatePhysics(CarlaActor, true);
546 SetActorVelocity(CarlaActor, FVector(0, 0, 0));
547 FVehicleControl Control;
548 Control.Throttle = 0.0f;
549 Control.Steer = 0.0f;
550 Control.Brake = 0.0f;
551 Control.bHandBrake = false;
552 Control.bReverse = false;
553 Control.Gear = 1;
554 Control.bManualGearShift = false;
555 CarlaActor->ApplyControlToVehicle(Control, EVehicleInputPriority::User);
556 }
557 break;
558
559 // walkers
561 // stop walker
562 SetWalkerSpeed(CarlaActor->GetActorId(), 0.0f);
563 break;
564 }
565 }
566 return true;
567}
568
569void CarlaReplayerHelper::SetActorVelocity(FCarlaActor *CarlaActor, FVector Velocity)
570{
571 if (!CarlaActor)
572 {
573 return;
574 }
575 CarlaActor->SetActorTargetVelocity(Velocity);
576}
577
578// set the animation speed for walkers
579void CarlaReplayerHelper::SetWalkerSpeed(uint32_t ActorId, float Speed)
580{
581 check(Episode != nullptr);
582 FCarlaActor * CarlaActor = Episode->FindCarlaActor(ActorId);
583 if (!CarlaActor)
584 {
585 return;
586 }
587 FWalkerControl Control;
588 Control.Speed = Speed;
589 CarlaActor->ApplyControlToWalker(Control);
590}
591
593{
594 check(Episode != nullptr);
595 auto World = Episode->GetWorld();
596 for (TActorIterator<AStaticMeshActor> It(World); It; ++It)
597 {
598 auto Actor = *It;
599 check(Actor != nullptr);
600 auto MeshComponent = Actor->GetStaticMeshComponent();
601 check(MeshComponent != nullptr);
602 if (MeshComponent->Mobility == EComponentMobility::Movable)
603 {
604 Actor->Destroy();
605 }
606 }
607}
EAttachmentType
ELightType
Definition CarlaLight.h:23
ECarlaServerResponse
EVehicleDoor
Type of door to open/close
EActorAttributeType
List of valid types for actor attributes.
Base class for CARLA wheeled vehicles.
void SetRotationAnim(float Rotation)
void SetSpeedAnim(float Speed)
void OnActorSpawned(const FCarlaActor &CarlaActor)
Class which implements the state changing of traffic lights
void SetFrozenGroup(bool InFreeze)
void BlendPose(float Blend)
void SetBonesTransform(const FWalkerBoneControlIn &WalkerBones)
void SetWalkerSpeed(uint32_t ActorId, float Speed)
std::pair< int, FCarlaActor * > TryToCreateReplayerActor(FVector &Location, FVector &Rotation, FActorDescription &ActorDesc, uint32_t DesiredId, bool SpawnSensors)
void ProcessReplayerWalkerBones(const CarlaRecorderWalkerBones &Walker)
bool ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map< uint32_t, bool > &IsHero)
void SetActorVelocity(FCarlaActor *CarlaActor, FVector Velocity)
void ProcessReplayerAnimVehicleWheels(CarlaRecorderAnimWheels Vehicle)
void ProcessReplayerLightScene(CarlaRecorderLightScene LightScene)
void ProcessReplayerDoorVehicle(CarlaRecorderDoorVehicle DoorVehicle)
void ProcessReplayerAnimWalker(CarlaRecorderAnimWalker Walker)
bool ProcessReplayerStateTrafficLight(CarlaRecorderStateTrafficLight State)
FCarlaActor * FindTrafficLightAt(FVector Location)
bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId)
bool SetActorSimulatePhysics(FCarlaActor *CarlaActor, bool bEnabled)
void ProcessReplayerAnimVehicle(CarlaRecorderAnimVehicle Vehicle)
bool ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime, bool bIgnoreSpectator)
bool SetActorAutopilot(FCarlaActor *CarlaActor, bool bEnabled, bool bKeepState=false)
bool ProcessReplayerEventDel(uint32_t DatabaseId)
void ProcessReplayerLightVehicle(CarlaRecorderLightVehicle LightVehicle)
std::pair< int, uint32_t > ProcessReplayerEventAdd(FVector Location, FVector Rotation, CarlaRecorderActorDescription Description, uint32_t DesiredId, bool bIgnoreHero, bool bIgnoreSpectator, bool ReplaySensors)
void ProcessReplayerAnimBiker(CarlaRecorderAnimBiker Biker)
bool SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation)
A registry of all the Carla actors.
bool Contains(uint32 Id) const
auto begin() const noexcept
auto end() const noexcept
A view over an actor and its properties.
Definition CarlaActor.h:25
ActorType GetActorType() const
Definition CarlaActor.h:86
virtual ECarlaServerResponse SetActorAutopilot(bool, bool bKeepState=false)
Definition CarlaActor.h:321
bool IsDormant() const
Definition CarlaActor.h:71
AActor * GetActor()
Definition CarlaActor.h:91
virtual ECarlaServerResponse SetVehicleLightState(const FVehicleLightState &)
Definition CarlaActor.h:274
virtual ECarlaServerResponse ApplyControlToVehicle(const FVehicleControl &, const EVehicleInputPriority &)
Definition CarlaActor.h:289
void SetParent(IdType InParentId)
Definition CarlaActor.h:116
void SetAttachmentType(carla::rpc::AttachmentType InAttachmentType)
Definition CarlaActor.h:141
FTransform GetActorGlobalTransform() const
void SetActorGlobalTransform(const FTransform &Transform, ETeleportType Teleport=ETeleportType::TeleportPhysics)
virtual ECarlaServerResponse ApplyControlToWalker(const FWalkerControl &)
Definition CarlaActor.h:399
FVector GetActorGlobalLocation() const
void AddChildren(IdType ChildId)
Definition CarlaActor.h:126
virtual UTrafficLightController * GetTrafficLightController()
Definition CarlaActor.h:369
IdType GetActorId() const
Definition CarlaActor.h:81
ECarlaServerResponse SetActorTargetVelocity(const FVector &Velocity)
virtual ECarlaServerResponse SetActorSimulatePhysics(bool bEnabled)
virtual ECarlaServerResponse SetTrafficLightState(const ETrafficLightState &)
Definition CarlaActor.h:359
void PutActorToSleep(carla::rpc::ActorId ActorId)
FCarlaActor * FindCarlaActor(FCarlaActor::IdType ActorId)
Find a Carla actor by id.
TPair< EActorSpawnResultStatus, FCarlaActor * > SpawnActorWithInfo(const FTransform &Transform, FActorDescription thisActorDescription, FCarlaActor::IdType DesiredId=0)
Spawns an actor based on ActorDescription at Transform.
APawn * GetSpectatorPawn() const
const FActorRegistry & GetActorRegistry() const
void AttachActors(AActor *Child, AActor *Parent, EAttachmentType InAttachmentType=EAttachmentType::Rigid, const FString &SocketName="")
Attach Child to Parent.
bool DestroyActor(AActor *Actor)
UCarlaLight * GetLight(int Id)
static ALargeMapManager * GetLargeMapManager(const UObject *WorldContextObject)
Maps a controller from OpenDrive.
void SetElapsedTime(float InElapsedTime)
ATrafficLightGroup * GetGroup()
Defines the physical appearance of a vehicle whitch is obtained by the sensors.
std::vector< CarlaRecorderActorAttribute > Attributes
An actor attribute, may be an intrinsic (non-modifiable) attribute of the actor or an user-defined ac...
A description of a Carla Actor with all its variation.
TMap< FString, FActorAttribute > Variations
User selected variations of the actor.
uint32 UId
UId of the definition in which this description was based.
EVehicleWheelLocation Location