CARLA
Loading...
Searching...
No Matches
CarlaReplayerHelper.cpp
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
8#include "Carla.h"
9
28
29#include <util/ue-header-guard-begin.h>
30#include "Components/BoxComponent.h"
31#include "Engine/StaticMeshActor.h"
32#include <util/ue-header-guard-end.h>
33
37
38
39
40#include "EngineUtils.h"
41
42// create or reuse an actor for replaying
44 FVector &Location,
45 FVector &Rotation,
46 FActorDescription &ActorDesc,
47 uint32_t DesiredId,
48 bool SpawnSensors)
49{
50 check(Episode != nullptr);
51
52 // check type of actor we need
53 if (ActorDesc.Id.StartsWith("traffic."))
54 {
55 FCarlaActor* CarlaActor = FindTrafficSignAt(Location);
56 if (CarlaActor != nullptr)
57 {
58 // reuse that actor
59 return std::pair<int, FCarlaActor*>(2, CarlaActor);
60 }
61 else
62 {
63 // actor not found
64 UE_LOG(LogCarla, Log, TEXT("TrafficLight not found"));
65 return std::pair<int, FCarlaActor*>(0, nullptr);
66 }
67 }
68 else if (SpawnSensors || !ActorDesc.Id.StartsWith("sensor."))
69 {
70 // create the transform
71 FRotator Rot = FRotator::MakeFromEuler(Rotation);
72 FTransform Trans(Rot, FVector(0, 0, 100000), FVector(1, 1, 1));
73 // create as new actor
74 TPair<EActorSpawnResultStatus, FCarlaActor*> Result = Episode->SpawnActorWithInfo(Trans, ActorDesc, DesiredId);
75 if (Result.Key == EActorSpawnResultStatus::Success)
76 {
77 // relocate
78 FTransform Trans2(Rot, Location, FVector(1, 1, 1));
79 Result.Value->SetActorGlobalTransform(Trans2);
80 ALargeMapManager * LargeMapManager = UCarlaStatics::GetLargeMapManager(Episode->GetWorld());
81 if (LargeMapManager)
82 {
83 LargeMapManager->OnActorSpawned(*Result.Value);
84 }
85 return std::pair<int, FCarlaActor*>(1, Result.Value);
86 }
87 else
88 {
89 UE_LOG(LogCarla, Log, TEXT("Actor could't be created by replayer"));
90 return std::pair<int, FCarlaActor*>(0, Result.Value);
91 }
92 }
93 else
94 {
95 // actor ignored
96 return std::pair<int, FCarlaActor*>(0, nullptr);
97 }
98}
99
101{
102 check(Episode != nullptr);
103 auto World = Episode->GetWorld();
104 check(World != nullptr);
105
106 // get its position (truncated as int's)
107 int x = static_cast<int>(Location.X);
108 int y = static_cast<int>(Location.Y);
109 int z = static_cast<int>(Location.Z);
110
111 const FActorRegistry &Registry = Episode->GetActorRegistry();
112 // through all actors in registry
113 for (auto It = Registry.begin(); It != Registry.end(); ++It)
114 {
115 FCarlaActor* CarlaActor = It->Value.Get();
118 {
119 FVector vec = CarlaActor->GetActorGlobalLocation();
120 int x2 = static_cast<int>(vec.X);
121 int y2 = static_cast<int>(vec.Y);
122 int z2 = static_cast<int>(vec.Z);
123 if ((x2 == x) && (y2 == y) && (z2 == z))
124 {
125 // actor found
126 return CarlaActor;
127 }
128 }
129 }
130 // actor not found
131 return nullptr;
132}
133
134// enable / disable physics for an actor
136{
137 if (!CarlaActor)
138 {
139 return false;
140 }
141 ECarlaServerResponse Response =
142 CarlaActor->SetActorSimulatePhysics(bEnabled);
143 if (Response != ECarlaServerResponse::Success)
144 {
145 return false;
146 }
147 return true;
148}
149
150// enable / disable autopilot for an actor
151bool CarlaReplayerHelper::SetActorAutopilot(FCarlaActor* CarlaActor, bool bEnabled, bool bKeepState)
152{
153 if (!CarlaActor)
154 {
155 return false;
156 }
157 ECarlaServerResponse Response =
158 CarlaActor->SetActorAutopilot(bEnabled, bKeepState);
159 if (Response != ECarlaServerResponse::Success)
160 {
161 return false;
162 }
163 return true;
164}
165
166// replay event for creating actor
168 FVector Location,
169 FVector Rotation,
171 uint32_t DesiredId,
172 bool bIgnoreHero,
173 bool bIgnoreSpectator,
174 bool ReplaySensors)
175{
176 check(Episode != nullptr);
177 FActorDescription ActorDesc;
178 bool IsHero = false;
179
180 // prepare actor description
181 ActorDesc.UId = Description.UId;
182 ActorDesc.Id = Description.Id;
183 for (const auto &Item : Description.Attributes)
184 {
185 FActorAttribute Attr;
186 Attr.Type = static_cast<EActorAttributeType>(Item.Type);
187 Attr.Id = Item.Id;
188 Attr.Value = Item.Value;
189 ActorDesc.Variations.Add(Attr.Id, std::move(Attr));
190 // check for hero
191 if (Item.Id == "role_name" && Item.Value == "hero")
192 IsHero = true;
193 }
194
195 // check to ignore Hero or Spectator
196 if ((bIgnoreHero && IsHero) ||
197 (bIgnoreSpectator && ActorDesc.Id.StartsWith("spectator")))
198 {
199 return std::make_pair(3, 0);
200 }
201
202 auto result = TryToCreateReplayerActor(
203 Location,
204 Rotation,
205 ActorDesc,
206 DesiredId,
207 ReplaySensors);
208
209 if (result.first != 0)
210 {
211 // disable physics and autopilot on vehicles
212 if (result.second->GetActorType() == FCarlaActor::ActorType::Vehicle ||
213 result.second->GetActorType() == FCarlaActor::ActorType::Walker)
214 {
215 // ignore hero ?
216 if (!(bIgnoreHero && IsHero))
217 {
218 // disable physics
219 SetActorSimulatePhysics(result.second, false);
220 // disable collisions
221 result.second->GetActor()->SetActorEnableCollision(false);
222 // disable autopilot for vehicles
223 if (result.second->GetActorType() == FCarlaActor::ActorType::Vehicle)
224 SetActorAutopilot(result.second, false, false);
225 }
226 else
227 {
228 // enable physics just in case
229 SetActorSimulatePhysics(result.second, true);
230 // enable collisions
231 result.second->GetActor()->SetActorEnableCollision(true);
232 }
233 }
234 return std::make_pair(result.first, result.second->GetActorId());
235 }
236 return std::make_pair(result.first, 0);
237}
238
239// replay event for removing actor
241{
242 check(Episode != nullptr);
243 FCarlaActor* CarlaActor = Episode->FindCarlaActor(DatabaseId);
244 if (CarlaActor == nullptr)
245 {
246 UE_LOG(LogCarla, Log, TEXT("Actor %d not found to destroy"), DatabaseId);
247 return false;
248 }
249 Episode->DestroyActor(CarlaActor->GetActorId());
250 return true;
251}
252
253// replay event for parenting actors
254bool CarlaReplayerHelper::ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId)
255{
256 check(Episode != nullptr);
257 FCarlaActor * Child = Episode->FindCarlaActor(ChildId);
258 FCarlaActor * Parent = Episode->FindCarlaActor(ParentId);
259 if(!Child)
260 {
261 UE_LOG(LogCarla, Log, TEXT("Parenting Child actors not found"));
262 return false;
263 }
264 if(!Parent)
265 {
266 UE_LOG(LogCarla, Log, TEXT("Parenting Parent actors not found"));
267 return false;
268 }
269 Child->SetParent(ParentId);
271 Parent->AddChildren(Child->GetActorId());
272 if(!Parent->IsDormant())
273 {
274 if(!Child->IsDormant())
275 {
277 Child->GetActor(),
278 Parent->GetActor(),
280 }
281 }
282 else
283 {
285 }
286 return true;
287}
288
289// reposition actors
291{
292 check(Episode != nullptr);
293 FCarlaActor* CarlaActor = Episode->FindCarlaActor(Pos1.DatabaseId);
294 FVector Location;
295 FRotator Rotation;
296 if(CarlaActor)
297 {
298 // check to assign first position or interpolate between both
299 if (Per == 0.0)
300 {
301 // assign position 1
302 Location = FVector(Pos1.Location);
303 Rotation = FRotator::MakeFromEuler(Pos1.Rotation);
304 }
305 else
306 {
307 // interpolate positions
308 Location = FMath::Lerp(FVector(Pos1.Location), FVector(Pos2.Location), Per);
309 Rotation = FMath::Lerp(FRotator::MakeFromEuler(Pos1.Rotation), FRotator::MakeFromEuler(Pos2.Rotation), Per);
310 }
311 // set new transform
312 FTransform Trans(Rotation, Location, FVector(1, 1, 1));
313 CarlaActor->SetActorGlobalTransform(Trans, ETeleportType::None);
314 return true;
315 }
316 return false;
317}
318
319// The spin from one frame to the next. A wheel can turn more than half a turn
320// between frames, so the whole turns come from the distance travelled.
321static float GetWheelSpinDelta(float Spin1, float Spin2, float Travel, float Radius)
322{
323 const float Delta = FMath::UnwindDegrees(Spin2 - Spin1);
324 if (Radius <= UE_KINDA_SMALL_NUMBER)
325 {
326 return Delta;
327 }
328 const float Expected = -FMath::RadiansToDegrees(Travel / Radius);
329 return Delta + 360.0f * FMath::RoundToFloat((Expected - Delta) / 360.0f);
330}
331
333 const CarlaRecorderAnimWheels &Wheels1,
334 const CarlaRecorderAnimWheels &Wheels2,
335 double Per,
336 float Travel)
337{
338 check(Episode != nullptr)
339 FCarlaActor *CarlaActor = Episode->FindCarlaActor(Wheels2.DatabaseId);
340 if (CarlaActor == nullptr)
341 return;
343 return;
344 ACarlaWheeledVehicle* CarlaVehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
345 check(CarlaVehicle != nullptr)
346 // Without it the wheels cannot be posed, and roll on their own instead.
347 if (!CarlaVehicle->HasCarlaVehicleAnimation())
348 return;
349
350 // Released in ProcessReplayerFinish.
351 CarlaVehicle->SetWheelAnimationOverride(true);
352 const float Alpha = static_cast<float>(Per);
353 const bool bSameWheels = Wheels1.WheelValues.size() == Wheels2.WheelValues.size();
354 for (size_t i = 0; i < Wheels2.WheelValues.size(); ++i)
355 {
356 const WheelInfo& Element2 = Wheels2.WheelValues[i];
357 const WheelInfo& Element1 = bSameWheels ? Wheels1.WheelValues[i] : Element2;
358 const int32 WheelIndex = static_cast<int32>(Element2.Location);
359 if (!CarlaVehicle->HasWheel(WheelIndex))
360 continue;
361 const float Spin = Element1.TireRotation + Alpha * GetWheelSpinDelta(
362 Element1.TireRotation, Element2.TireRotation, Travel, CarlaVehicle->GetWheelRadius(WheelIndex));
363 CarlaVehicle->SetWheelSteerDirection(Element2.Location,
364 FMath::Lerp(Element1.SteeringAngle, Element2.SteeringAngle, Alpha));
365 CarlaVehicle->SetWheelPitchAngle(Element2.Location, FMath::UnwindDegrees(Spin));
366 }
367}
368
369// reposition the camera
370bool CarlaReplayerHelper::SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation)
371{
372 check(Episode != nullptr);
373
374 // get the actor to follow
375 FCarlaActor* CarlaActor = Episode->FindCarlaActor(Id);
376 if (!CarlaActor)
377 return false;
378 // get specator pawn
379 APawn *Spectator = Episode->GetSpectatorPawn();
380 if (!Spectator)
381 return false;
382
383 FCarlaActor* CarlaSpectator = Episode->FindCarlaActor(Spectator);
384 if (!CarlaSpectator)
385 return false;
386
387 FTransform ActorTransform = CarlaActor->GetActorGlobalTransform();
388 // set the new position
389 FQuat ActorRot = ActorTransform.GetRotation();
390 FVector Pos = ActorTransform.GetTranslation() + (ActorRot.RotateVector(Offset));
391 CarlaSpectator->SetActorGlobalTransform(FTransform(ActorRot * Rotation, Pos, FVector(1,1,1)));
392
393 return true;
394}
395
397{
398 check(Episode != nullptr);
399 FCarlaActor* CarlaActor = Episode->FindCarlaActor(State.DatabaseId);
400 if(CarlaActor)
401 {
402 CarlaActor->SetTrafficLightState(static_cast<ETrafficLightState>(State.State));
403 UTrafficLightController* Controller = CarlaActor->GetTrafficLightController();
404 if(Controller)
405 {
406 Controller->SetElapsedTime(State.ElapsedTime);
407 ATrafficLightGroup* Group = Controller->GetGroup();
408 if (Group)
409 {
410 Group->SetFrozenGroup(State.IsFrozen);
411 }
412 }
413 return true;
414 }
415 return false;
416}
417
418// set the animation for Vehicles
420{
421 check(Episode != nullptr);
422 FCarlaActor *CarlaActor = Episode->FindCarlaActor(Vehicle.DatabaseId);
423 if (CarlaActor)
424 {
425 FVehicleControl Control;
426 Control.Throttle = Vehicle.Throttle;
427 Control.Steer = Vehicle.Steering;
428 Control.Brake = Vehicle.Brake;
429 Control.bHandBrake = Vehicle.bHandbrake;
430 Control.bReverse = (Vehicle.Gear < 0);
431 Control.Gear = Vehicle.Gear;
432 Control.bManualGearShift = false;
433 CarlaActor->ApplyControlToVehicle(Control, EVehicleInputPriority::User);
434 }
435}
436
437// set the openings and closings of vehicle doors
439{
440 check(Episode != nullptr);
441 FCarlaActor * CarlaActor = Episode->FindCarlaActor(DoorVehicle.DatabaseId);
442 if (CarlaActor)
443 {
444 ACarlaWheeledVehicle * Vehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
445 if (Vehicle) {
446 if(DoorVehicle.bIsOpen){
447 Vehicle->OpenDoor(static_cast<EVehicleDoor>(DoorVehicle.Doors));
448 }else{
449 Vehicle->CloseDoor(static_cast<EVehicleDoor>(DoorVehicle.Doors));
450 }
451 }
452 }
453}
454
455// set the lights for vehicles
457{
458 check(Episode != nullptr);
459 FCarlaActor * CarlaActor = Episode->FindCarlaActor(LightVehicle.DatabaseId);
460 if (CarlaActor)
461 {
462 carla::rpc::VehicleLightState LightState(LightVehicle.State);
463 CarlaActor->SetVehicleLightState(FVehicleLightState(LightState));
464 }
465}
466
468{
469 check(Episode != nullptr);
470
471 AWeather *WeatherActor = Episode->GetWeather();
472 if (WeatherActor != nullptr)
473 {
474 FWeatherParameters Params;
475 Params.Cloudiness = Weather.Cloudiness;
476 Params.Precipitation = Weather.Precipitation;
477 Params.PrecipitationDeposits = Weather.PrecipitationDeposits;
478 Params.WindIntensity = Weather.WindIntensity;
479 Params.SunAzimuthAngle = Weather.SunAzimuthAngle;
480 Params.SunAltitudeAngle = Weather.SunAltitudeAngle;
481 Params.FogDensity = Weather.FogDensity;
482 Params.FogDistance = Weather.FogDistance;
483 Params.FogFalloff = Weather.FogFalloff;
484 Params.Wetness = Weather.Wetness;
485 Params.ScatteringIntensity = Weather.ScatteringIntensity;
486 Params.MieScatteringScale = Weather.MieScatteringScale;
487 Params.RayleighScatteringScale = Weather.RayleighScatteringScale;
488 Params.DustStorm = Weather.DustStorm;
489 WeatherActor->ApplyWeather(Params);
490 }
491}
492
494{
495 check(Episode != nullptr);
496 UWorld* World = Episode->GetWorld();
497 if(World)
498 {
499 UCarlaLightSubsystem* CarlaLightSubsystem = World->GetSubsystem<UCarlaLightSubsystem>();
500 if (!CarlaLightSubsystem)
501 {
502 return;
503 }
504 auto* CarlaLight = CarlaLightSubsystem->GetLight(LightScene.LightId);
505 if (CarlaLight)
506 {
507 CarlaLight->SetLightIntensity(LightScene.Intensity);
508 CarlaLight->SetLightColor(LightScene.Color);
509 CarlaLight->SetLightOn(LightScene.bOn);
510 CarlaLight->SetLightType(static_cast<ELightType>(LightScene.Type));
511 // The replayer mutates light state server-side, outside any client
512 // request; without dirty-marking, connected clients keep serving stale
513 // is_on/intensity values from their LightManager cache.
514 CarlaLightSubsystem->SetClientStatesdirty("");
515 }
516 }
517}
518
519// set the animation for walkers
524
526{
527 check(Episode != nullptr);
528 FCarlaActor * CarlaActor = Episode->FindCarlaActor(Biker.DatabaseId);
529 if (CarlaActor == nullptr)
530 return;
531 ACarlaWheeledVehicle* CarlaVehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
532 check(CarlaVehicle != nullptr)
533 CarlaVehicle->SetSpeedAnim(Biker.ForwardSpeed);
534 CarlaVehicle->SetRotationAnim(Biker.EngineRotation);
535}
536
537// set walker bones
539{
540 check(Episode != nullptr);
541
542 FCarlaActor* CarlaActor = Episode->FindCarlaActor(WalkerBones.DatabaseId);
543 if (!CarlaActor) return;
544
545 AActor* Actor = CarlaActor->GetActor();
546 auto Walker = Cast<APawn>(Actor);
547 if (!Walker) return;
548
549 AWalkerController *Controller = Cast<AWalkerController>(Walker->GetController());
550 if (!Controller) return;
551
552 // build bones structure
553 FWalkerBoneControlIn BonesIn;
554 for (const auto &Bone : WalkerBones.Bones)
555 {
556 FTransform Trans(FRotator::MakeFromEuler(Bone.Rotation), Bone.Location, FVector(1, 1, 1));
557 BonesIn.BoneTransforms.Add(Bone.Name, Trans);
558 }
559
560 // set the pose and blend
561 Controller->SetBonesTransform(BonesIn);
562 Controller->BlendPose(1.0f);
563}
564
565// replay finish
566bool CarlaReplayerHelper::ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map<uint32_t, bool> &IsHero)
567{
568 // set autopilot and physics to all AI vehicles
569 const FActorRegistry& Registry = Episode->GetActorRegistry();
570 for (auto& It : Registry)
571 {
572 FCarlaActor* CarlaActor = It.Value.Get();
573
574 // enable physics only on vehicles
575 switch (CarlaActor->GetActorType())
576 {
577
578 // vehicles
580 // check for hero
581 if (!(bIgnoreHero && IsHero[CarlaActor->GetActorId()]))
582 {
583 // stop all vehicles
584 SetActorSimulatePhysics(CarlaActor, true);
585 if (auto* CarlaVehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor()))
586 {
587 CarlaVehicle->SetWheelAnimationOverride(false);
588 }
589 // ProcessReplayerEventAdd also disabled collision on replayed
590 // vehicles; restore it or they are left permanently undrivable
591 // (no wheel contact) after the replay ends.
592 if (CarlaActor->GetActor())
593 {
594 CarlaActor->GetActor()->SetActorEnableCollision(true);
595 }
596 SetActorVelocity(CarlaActor, FVector(0, 0, 0));
597 FVehicleControl Control;
598 Control.Throttle = 0.0f;
599 Control.Steer = 0.0f;
600 Control.Brake = 0.0f;
601 Control.bHandBrake = false;
602 Control.bReverse = false;
603 Control.Gear = 1;
604 Control.bManualGearShift = false;
605 CarlaActor->ApplyControlToVehicle(Control, EVehicleInputPriority::User);
606 }
607 break;
608
609 // walkers
611 // stop walker
612 SetWalkerSpeed(CarlaActor->GetActorId(), 0.0f);
613 break;
614 }
615 }
616 return true;
617}
618
619void CarlaReplayerHelper::SetActorVelocity(FCarlaActor *CarlaActor, FVector Velocity)
620{
621 if (!CarlaActor)
622 {
623 return;
624 }
625 CarlaActor->SetActorTargetVelocity(Velocity);
626}
627
628// set the animation speed for walkers
629void CarlaReplayerHelper::SetWalkerSpeed(uint32_t ActorId, float Speed)
630{
631 check(Episode != nullptr);
632 FCarlaActor * CarlaActor = Episode->FindCarlaActor(ActorId);
633 if (!CarlaActor)
634 {
635 return;
636 }
637 FWalkerControl Control;
638 Control.Speed = Speed;
639 CarlaActor->ApplyControlToWalker(Control);
640}
641
643{
644 check(Episode != nullptr);
645 auto World = Episode->GetWorld();
646 for (TActorIterator<AStaticMeshActor> It(World); It; ++It)
647 {
648 auto Actor = *It;
649 check(Actor != nullptr);
650 auto MeshComponent = Actor->GetStaticMeshComponent();
651 check(MeshComponent != nullptr);
652 if (MeshComponent->Mobility == EComponentMobility::Movable)
653 {
654 Actor->Destroy();
655 }
656 }
657}
EAttachmentType
float y
float x
float z
ELightType
Definition CarlaLight.h:30
static float GetWheelSpinDelta(float Spin1, float Spin2, float Travel, float Radius)
ECarlaServerResponse
EVehicleDoor
Type of door to open/close.
EActorAttributeType
List of valid types for actor attributes.
Base class for CARLA wheeled vehicles.
float GetWheelRadius(int32 WheelIndex) const
Radius of the wheel at WheelIndex, in cm, as last applied through the physics control.
bool HasCarlaVehicleAnimation() const
Whether the animation blueprint derives from UCarlaVehicleAnimationInstance, which is what draws the ...
void SetWheelAnimationOverride(bool bEnabled)
While the wheel animation is overridden the wheels show only the values set through the wheel setters...
void SetWheelSteerDirection(EVehicleWheelLocation WheelLocation, float AngleInDeg)
Set the rotation of the car wheels indicated by the user 0 = FL_VehicleWheel, 1 = FR_VehicleWheel,...
bool HasWheel(int32 WheelIndex) const
void SetRotationAnim(float Rotation)
void SetSpeedAnim(float Speed)
void SetWheelPitchAngle(EVehicleWheelLocation WheelLocation, float AngleInDeg)
Spin angle of a wheel, in degrees. Purely visual, wheel animation override only.
void OnActorSpawned(const FCarlaActor &CarlaActor)
Class which implements the state changing of traffic lights.
void SetFrozenGroup(bool InFreeze)
Possesses every walker pawn.
void BlendPose(float Blend)
void SetBonesTransform(const FWalkerBoneControlIn &WalkerBones)
void ApplyWeather(const FWeatherParameters &WeatherParameters)
Update the weather parameters and notifies it to the blueprint's event.
Definition Weather.cpp:2597
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(const CarlaRecorderAnimWheels &Wheels1, const CarlaRecorderAnimWheels &Wheels2, double Per, float Travel)
void ProcessReplayerLightScene(CarlaRecorderLightScene LightScene)
FCarlaActor * FindTrafficSignAt(FVector Location)
void ProcessReplayerDoorVehicle(CarlaRecorderDoorVehicle DoorVehicle)
void ProcessReplayerAnimWalker(CarlaRecorderAnimWalker Walker)
bool ProcessReplayerStateTrafficLight(CarlaRecorderStateTrafficLight State)
bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId)
bool SetActorSimulatePhysics(FCarlaActor *CarlaActor, bool bEnabled)
void ProcessReplayerAnimVehicle(CarlaRecorderAnimVehicle Vehicle)
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 ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime)
void ProcessReplayerWeather(const CarlaRecorderWeather &Weather)
bool SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation)
A registry of all the Carla actors.
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:436
bool IsDormant() const
Definition CarlaActor.h:71
AActor * GetActor()
Definition CarlaActor.h:91
virtual ECarlaServerResponse SetVehicleLightState(const FVehicleLightState &)
Definition CarlaActor.h:364
virtual ECarlaServerResponse ApplyControlToVehicle(const FVehicleControl &, const EVehicleInputPriority &)
Definition CarlaActor.h:404
void SetParent(IdType InParentId)
Definition CarlaActor.h:116
void SetAttachmentType(carla::rpc::AttachmentType InAttachmentType)
Definition CarlaActor.h:189
FTransform GetActorGlobalTransform() const
void SetActorGlobalTransform(const FTransform &Transform, ETeleportType Teleport=ETeleportType::TeleportPhysics)
virtual ECarlaServerResponse ApplyControlToWalker(const FWalkerControl &)
Definition CarlaActor.h:504
FVector GetActorGlobalLocation() const
void AddChildren(IdType ChildId)
Definition CarlaActor.h:126
virtual UTrafficLightController * GetTrafficLightController()
Definition CarlaActor.h:474
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:464
void PutActorToSleep(carla::rpc::ActorId ActorId)
FCarlaActor * FindCarlaActor(FCarlaActor::IdType ActorId)
Find a Carla actor by id.
AWeather * GetWeather() const
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)
Attach Child to Parent.
bool DestroyActor(AActor *Actor)
void SetClientStatesdirty(FString ClientThatUpdate)
Flag every registered client (except ClientThatUpdate) so their LightManager re-queries light states.
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