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 {
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// query-only collision on a replayed actor, restored by ProcessReplayerFinish
136{
137 if (Actor == nullptr)
138 {
139 return;
140 }
141 Actor->SetActorEnableCollision(true);
142 TArray<UPrimitiveComponent *> Primitives;
143 Actor->GetComponents<UPrimitiveComponent>(Primitives);
144 for (UPrimitiveComponent *Primitive : Primitives)
145 {
146 const ECollisionEnabled::Type Enabled = Primitive->BodyInstance.GetCollisionEnabled(false);
147 const bool bOverlaps = Primitive->GetGenerateOverlapEvents();
148 // Only the body (root) and what ray-cast sensors hit keep query collision; the rest would only cost queries on every move.
149 const bool bSensorVisible = Primitive == Actor->GetRootComponent() ||
150 Primitive->GetCollisionResponseToChannel(ECC_GameTraceChannel2 /*SensorTrace*/) == ECR_Block;
151 const ECollisionEnabled::Type Replayed =
152 Enabled == ECollisionEnabled::NoCollision || !bSensorVisible ? ECollisionEnabled::NoCollision : ECollisionEnabled::QueryOnly;
153 if (Replayed == Enabled && !bOverlaps)
154 {
155 continue;
156 }
157 ReplayedPrimitives.Add({Primitive, static_cast<uint8>(Enabled), bOverlaps});
158 Primitive->SetGenerateOverlapEvents(false);
159 Primitive->SetCollisionEnabled(Replayed);
160 }
161}
162
163// enable / disable physics for an actor
165{
166 if (!CarlaActor)
167 {
168 return false;
169 }
170 ECarlaServerResponse Response =
171 CarlaActor->SetActorSimulatePhysics(bEnabled);
172 if (Response != ECarlaServerResponse::Success)
173 {
174 return false;
175 }
176 return true;
177}
178
179// enable / disable autopilot for an actor
180bool CarlaReplayerHelper::SetActorAutopilot(FCarlaActor* CarlaActor, bool bEnabled, bool bKeepState)
181{
182 if (!CarlaActor)
183 {
184 return false;
185 }
186 ECarlaServerResponse Response =
187 CarlaActor->SetActorAutopilot(bEnabled, bKeepState);
188 if (Response != ECarlaServerResponse::Success)
189 {
190 return false;
191 }
192 return true;
193}
194
195// replay event for creating actor
197 FVector Location,
198 FVector Rotation,
200 uint32_t DesiredId,
201 bool bIgnoreHero,
202 bool bIgnoreSpectator,
203 bool ReplaySensors)
204{
205 check(Episode != nullptr);
206 FActorDescription ActorDesc;
207 bool IsHero = false;
208
209 // prepare actor description
210 ActorDesc.UId = Description.UId;
211 ActorDesc.Id = Description.Id;
212 for (const auto &Item : Description.Attributes)
213 {
214 FActorAttribute Attr;
215 Attr.Type = static_cast<EActorAttributeType>(Item.Type);
216 Attr.Id = Item.Id;
217 Attr.Value = Item.Value;
218 ActorDesc.Variations.Add(Attr.Id, std::move(Attr));
219 // check for hero
220 if (Item.Id == "role_name" && Item.Value == "hero")
221 IsHero = true;
222 }
223
224 // check to ignore Hero or Spectator
225 if ((bIgnoreHero && IsHero) ||
226 (bIgnoreSpectator && ActorDesc.Id.StartsWith("spectator")))
227 {
228 return std::make_pair(3, 0);
229 }
230
231 auto result = TryToCreateReplayerActor(
232 Location,
233 Rotation,
234 ActorDesc,
235 DesiredId,
236 ReplaySensors);
237
238 if (result.first != 0)
239 {
240 // disable physics and autopilot on vehicles
241 if (result.second->GetActorType() == FCarlaActor::ActorType::Vehicle ||
242 result.second->GetActorType() == FCarlaActor::ActorType::Walker)
243 {
244 // ignore hero ?
245 if (!(bIgnoreHero && IsHero))
246 {
247 // disable physics
248 SetActorSimulatePhysics(result.second, false);
249 // query-only collision, so sensors still see the replayed actor
250 MakeReplayedActorQueryOnly(result.second->GetActor());
251 // disable autopilot for vehicles
252 if (result.second->GetActorType() == FCarlaActor::ActorType::Vehicle)
253 SetActorAutopilot(result.second, false, false);
254 }
255 else
256 {
257 // enable physics just in case
258 SetActorSimulatePhysics(result.second, true);
259 // enable collisions
260 result.second->GetActor()->SetActorEnableCollision(true);
261 }
262 }
263 return std::make_pair(result.first, result.second->GetActorId());
264 }
265 return std::make_pair(result.first, 0);
266}
267
268// replay event for removing actor
270{
271 check(Episode != nullptr);
272 FCarlaActor* CarlaActor = Episode->FindCarlaActor(DatabaseId);
273 if (CarlaActor == nullptr)
274 {
275 UE_LOG(LogCarla, Log, TEXT("Actor %d not found to destroy"), DatabaseId);
276 return false;
277 }
278 Episode->DestroyActor(CarlaActor->GetActorId());
279 return true;
280}
281
282// replay event for parenting actors
283bool CarlaReplayerHelper::ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId)
284{
285 check(Episode != nullptr);
286 FCarlaActor * Child = Episode->FindCarlaActor(ChildId);
287 FCarlaActor * Parent = Episode->FindCarlaActor(ParentId);
288 if(!Child)
289 {
290 UE_LOG(LogCarla, Log, TEXT("Parenting Child actors not found"));
291 return false;
292 }
293 if(!Parent)
294 {
295 UE_LOG(LogCarla, Log, TEXT("Parenting Parent actors not found"));
296 return false;
297 }
298 Child->SetParent(ParentId);
300 Parent->AddChildren(Child->GetActorId());
301 if(!Parent->IsDormant())
302 {
303 if(!Child->IsDormant())
304 {
306 Child->GetActor(),
307 Parent->GetActor(),
309 }
310 }
311 else
312 {
314 }
315 return true;
316}
317
318// reposition actors
320{
321 check(Episode != nullptr);
322 FCarlaActor* CarlaActor = Episode->FindCarlaActor(Pos1.DatabaseId);
323 FVector Location;
324 FRotator Rotation;
325 if(CarlaActor)
326 {
327 // check to assign first position or interpolate between both
328 if (Per == 0.0)
329 {
330 // assign position 1
331 Location = FVector(Pos1.Location);
332 Rotation = FRotator::MakeFromEuler(Pos1.Rotation);
333 }
334 else
335 {
336 // interpolate positions
337 Location = FMath::Lerp(FVector(Pos1.Location), FVector(Pos2.Location), Per);
338 Rotation = FMath::Lerp(FRotator::MakeFromEuler(Pos1.Rotation), FRotator::MakeFromEuler(Pos2.Rotation), Per);
339 }
340 // set new transform
341 FTransform Trans(Rotation, Location, FVector(1, 1, 1));
342 CarlaActor->SetActorGlobalTransform(Trans, ETeleportType::None);
343 return true;
344 }
345 return false;
346}
347
348// The spin from one frame to the next. A wheel can turn more than half a turn
349// between frames, so the whole turns come from the distance travelled.
350static float GetWheelSpinDelta(float Spin1, float Spin2, float Travel, float Radius)
351{
352 const float Delta = FMath::UnwindDegrees(Spin2 - Spin1);
353 if (Radius <= UE_KINDA_SMALL_NUMBER)
354 {
355 return Delta;
356 }
357 const float Expected = -FMath::RadiansToDegrees(Travel / Radius);
358 return Delta + 360.0f * FMath::RoundToFloat((Expected - Delta) / 360.0f);
359}
360
362 const CarlaRecorderAnimWheels &Wheels1,
363 const CarlaRecorderAnimWheels &Wheels2,
364 double Per,
365 float Travel)
366{
367 check(Episode != nullptr)
368 FCarlaActor *CarlaActor = Episode->FindCarlaActor(Wheels2.DatabaseId);
369 if (CarlaActor == nullptr)
370 return;
372 return;
373 ACarlaWheeledVehicle* CarlaVehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
374 check(CarlaVehicle != nullptr)
375 // Without it the wheels cannot be posed, and roll on their own instead.
376 if (!CarlaVehicle->HasCarlaVehicleAnimation())
377 return;
378
379 // Released in ProcessReplayerFinish.
380 CarlaVehicle->SetWheelAnimationOverride(true);
381 const float Alpha = static_cast<float>(Per);
382 const bool bSameWheels = Wheels1.WheelValues.size() == Wheels2.WheelValues.size();
383 for (size_t i = 0; i < Wheels2.WheelValues.size(); ++i)
384 {
385 const WheelInfo& Element2 = Wheels2.WheelValues[i];
386 const WheelInfo& Element1 = bSameWheels ? Wheels1.WheelValues[i] : Element2;
387 const int32 WheelIndex = static_cast<int32>(Element2.Location);
388 if (!CarlaVehicle->HasWheel(WheelIndex))
389 continue;
390 const float Spin = Element1.TireRotation + Alpha * GetWheelSpinDelta(
391 Element1.TireRotation, Element2.TireRotation, Travel, CarlaVehicle->GetWheelRadius(WheelIndex));
392 CarlaVehicle->SetWheelSteerDirection(Element2.Location,
393 FMath::Lerp(Element1.SteeringAngle, Element2.SteeringAngle, Alpha));
394 CarlaVehicle->SetWheelPitchAngle(Element2.Location, FMath::UnwindDegrees(Spin));
395 }
396}
397
398// reposition the camera
399bool CarlaReplayerHelper::SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation)
400{
401 check(Episode != nullptr);
402
403 // get the actor to follow
404 FCarlaActor* CarlaActor = Episode->FindCarlaActor(Id);
405 if (!CarlaActor)
406 return false;
407 // get specator pawn
408 APawn *Spectator = Episode->GetSpectatorPawn();
409 if (!Spectator)
410 return false;
411
412 FCarlaActor* CarlaSpectator = Episode->FindCarlaActor(Spectator);
413 if (!CarlaSpectator)
414 return false;
415
416 FTransform ActorTransform = CarlaActor->GetActorGlobalTransform();
417 // set the new position
418 FQuat ActorRot = ActorTransform.GetRotation();
419 FVector Pos = ActorTransform.GetTranslation() + (ActorRot.RotateVector(Offset));
420 CarlaSpectator->SetActorGlobalTransform(FTransform(ActorRot * Rotation, Pos, FVector(1,1,1)));
421
422 return true;
423}
424
426{
427 check(Episode != nullptr);
428 FCarlaActor* CarlaActor = Episode->FindCarlaActor(State.DatabaseId);
429 if(CarlaActor)
430 {
431 CarlaActor->SetTrafficLightState(static_cast<ETrafficLightState>(State.State));
432 UTrafficLightController* Controller = CarlaActor->GetTrafficLightController();
433 if(Controller)
434 {
435 Controller->SetElapsedTime(State.ElapsedTime);
436 ATrafficLightGroup* Group = Controller->GetGroup();
437 if (Group)
438 {
439 Group->SetFrozenGroup(State.IsFrozen);
440 }
441 }
442 return true;
443 }
444 return false;
445}
446
447// set the animation for Vehicles
449{
450 check(Episode != nullptr);
451 FCarlaActor *CarlaActor = Episode->FindCarlaActor(Vehicle.DatabaseId);
452 if (CarlaActor)
453 {
454 FVehicleControl Control;
455 Control.Throttle = Vehicle.Throttle;
456 Control.Steer = Vehicle.Steering;
457 Control.Brake = Vehicle.Brake;
458 Control.bHandBrake = Vehicle.bHandbrake;
459 Control.bReverse = (Vehicle.Gear < 0);
460 Control.Gear = Vehicle.Gear;
461 Control.bManualGearShift = false;
462 CarlaActor->ApplyControlToVehicle(Control, EVehicleInputPriority::User);
463 }
464}
465
466// set the openings and closings of vehicle doors
468{
469 check(Episode != nullptr);
470 FCarlaActor * CarlaActor = Episode->FindCarlaActor(DoorVehicle.DatabaseId);
471 if (CarlaActor)
472 {
473 ACarlaWheeledVehicle * Vehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
474 if (Vehicle) {
475 if(DoorVehicle.bIsOpen){
476 Vehicle->OpenDoor(static_cast<EVehicleDoor>(DoorVehicle.Doors));
477 }else{
478 Vehicle->CloseDoor(static_cast<EVehicleDoor>(DoorVehicle.Doors));
479 }
480 }
481 }
482}
483
484// set the lights for vehicles
486{
487 check(Episode != nullptr);
488 FCarlaActor * CarlaActor = Episode->FindCarlaActor(LightVehicle.DatabaseId);
489 if (CarlaActor)
490 {
491 carla::rpc::VehicleLightState LightState(LightVehicle.State);
492 CarlaActor->SetVehicleLightState(FVehicleLightState(LightState));
493 }
494}
495
497{
498 check(Episode != nullptr);
499
500 AWeather *WeatherActor = Episode->GetWeather();
501 if (WeatherActor != nullptr)
502 {
503 FWeatherParameters Params;
504 Params.Cloudiness = Weather.Cloudiness;
505 Params.Precipitation = Weather.Precipitation;
506 Params.PrecipitationDeposits = Weather.PrecipitationDeposits;
507 Params.WindIntensity = Weather.WindIntensity;
508 Params.SunAzimuthAngle = Weather.SunAzimuthAngle;
509 Params.SunAltitudeAngle = Weather.SunAltitudeAngle;
510 Params.FogDensity = Weather.FogDensity;
511 Params.FogDistance = Weather.FogDistance;
512 Params.FogFalloff = Weather.FogFalloff;
513 Params.Wetness = Weather.Wetness;
514 Params.ScatteringIntensity = Weather.ScatteringIntensity;
515 Params.MieScatteringScale = Weather.MieScatteringScale;
516 Params.RayleighScatteringScale = Weather.RayleighScatteringScale;
517 Params.DustStorm = Weather.DustStorm;
518 WeatherActor->ApplyWeather(Params);
519 }
520}
521
523{
524 check(Episode != nullptr);
525 UWorld* World = Episode->GetWorld();
526 if(World)
527 {
528 UCarlaLightSubsystem* CarlaLightSubsystem = World->GetSubsystem<UCarlaLightSubsystem>();
529 if (!CarlaLightSubsystem)
530 {
531 return;
532 }
533 auto* CarlaLight = CarlaLightSubsystem->GetLight(LightScene.LightId);
534 if (CarlaLight)
535 {
536 CarlaLight->SetLightIntensity(LightScene.Intensity);
537 CarlaLight->SetLightColor(LightScene.Color);
538 CarlaLight->SetLightOn(LightScene.bOn);
539 CarlaLight->SetLightType(static_cast<ELightType>(LightScene.Type));
540 // The replayer mutates light state server-side, outside any client
541 // request; without dirty-marking, connected clients keep serving stale
542 // is_on/intensity values from their LightManager cache.
543 CarlaLightSubsystem->SetClientStatesdirty("");
544 }
545 }
546}
547
548// set the animation for walkers
553
555{
556 check(Episode != nullptr);
557 FCarlaActor * CarlaActor = Episode->FindCarlaActor(Biker.DatabaseId);
558 if (CarlaActor == nullptr)
559 return;
560 ACarlaWheeledVehicle* CarlaVehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
561 check(CarlaVehicle != nullptr)
562 CarlaVehicle->SetSpeedAnim(Biker.ForwardSpeed);
563 CarlaVehicle->SetRotationAnim(Biker.EngineRotation);
564}
565
566// set walker bones
568{
569 check(Episode != nullptr);
570
571 FCarlaActor* CarlaActor = Episode->FindCarlaActor(WalkerBones.DatabaseId);
572 if (!CarlaActor) return;
573
574 AActor* Actor = CarlaActor->GetActor();
575 auto Walker = Cast<APawn>(Actor);
576 if (!Walker) return;
577
578 AWalkerController *Controller = Cast<AWalkerController>(Walker->GetController());
579 if (!Controller) return;
580
581 // build bones structure
582 FWalkerBoneControlIn BonesIn;
583 for (const auto &Bone : WalkerBones.Bones)
584 {
585 FTransform Trans(FRotator::MakeFromEuler(Bone.Rotation), Bone.Location, FVector(1, 1, 1));
586 BonesIn.BoneTransforms.Add(Bone.Name, Trans);
587 }
588
589 // set the pose and blend
590 Controller->SetBonesTransform(BonesIn);
591 Controller->BlendPose(1.0f);
592}
593
594// replay finish
595bool CarlaReplayerHelper::ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map<uint32_t, bool> &IsHero)
596{
597 // restore the collision MakeReplayedActorQueryOnly() reduced
598 for (const FReplayedPrimitive &Replayed : ReplayedPrimitives)
599 {
600 if (Replayed.Primitive.IsValid())
601 {
602 Replayed.Primitive->SetCollisionEnabled(static_cast<ECollisionEnabled::Type>(Replayed.CollisionEnabled));
603 Replayed.Primitive->SetGenerateOverlapEvents(Replayed.bGenerateOverlapEvents);
604 }
605 }
606 ReplayedPrimitives.Reset();
607
608 // set autopilot and physics to all AI vehicles
609 const FActorRegistry& Registry = Episode->GetActorRegistry();
610 for (auto& It : Registry)
611 {
612 FCarlaActor* CarlaActor = It.Value.Get();
613
614 // enable physics only on vehicles
615 switch (CarlaActor->GetActorType())
616 {
617
618 // vehicles
620 // check for hero
621 if (!(bIgnoreHero && IsHero[CarlaActor->GetActorId()]))
622 {
623 // stop all vehicles
624 SetActorSimulatePhysics(CarlaActor, true);
625 if (auto* CarlaVehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor()))
626 {
627 CarlaVehicle->SetWheelAnimationOverride(false);
628 }
629 SetActorVelocity(CarlaActor, FVector(0, 0, 0));
630 FVehicleControl Control;
631 Control.Throttle = 0.0f;
632 Control.Steer = 0.0f;
633 Control.Brake = 0.0f;
634 Control.bHandBrake = false;
635 Control.bReverse = false;
636 Control.Gear = 1;
637 Control.bManualGearShift = false;
638 CarlaActor->ApplyControlToVehicle(Control, EVehicleInputPriority::User);
639 }
640 break;
641
642 // walkers
644 // stop walker and give it its movement back
645 SetWalkerSpeed(CarlaActor->GetActorId(), 0.0f);
646 SetActorSimulatePhysics(CarlaActor, true);
647 break;
648 }
649 }
650 return true;
651}
652
653void CarlaReplayerHelper::SetActorVelocity(FCarlaActor *CarlaActor, FVector Velocity)
654{
655 if (!CarlaActor)
656 {
657 return;
658 }
659 CarlaActor->SetActorTargetVelocity(Velocity);
660}
661
662// set the animation speed for walkers
663void CarlaReplayerHelper::SetWalkerSpeed(uint32_t ActorId, float Speed)
664{
665 check(Episode != nullptr);
666 FCarlaActor * CarlaActor = Episode->FindCarlaActor(ActorId);
667 if (!CarlaActor)
668 {
669 return;
670 }
671 FWalkerControl Control;
672 Control.Speed = Speed;
673 CarlaActor->ApplyControlToWalker(Control);
674}
675
677{
678 check(Episode != nullptr);
679 auto World = Episode->GetWorld();
680 for (TActorIterator<AStaticMeshActor> It(World); It; ++It)
681 {
682 auto Actor = *It;
683 check(Actor != nullptr);
684 auto MeshComponent = Actor->GetStaticMeshComponent();
685 check(MeshComponent != nullptr);
686 if (MeshComponent->Mobility == EComponentMobility::Movable)
687 {
688 Actor->Destroy();
689 }
690 }
691}
EAttachmentType
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)
void MakeReplayedActorQueryOnly(AActor *Actor)
bool ProcessReplayerStateTrafficLight(CarlaRecorderStateTrafficLight State)
TArray< FReplayedPrimitive > ReplayedPrimitives
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
Euler angles of a rotation in CARLA's / Unreal's left-handed frame: x forward, y right,...
Definition Rotation.h:45
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