CARLA
Loading...
Searching...
No Matches
CarlaActor.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
7#include "CarlaActor.h"
8
14#include "Carla/Game/Tagger.h"
20
25#include <carla/rpc/MapInfo.h>
26#include <carla/rpc/MapLayer.h>
38
39#include <util/ue-header-guard-begin.h>
40#include "Components/CapsuleComponent.h"
41#include "GameFramework/CharacterMovementComponent.h"
42#include <util/ue-header-guard-end.h>
43
45 IdType ActorId,
46 AActor* Actor,
47 TSharedPtr<const FActorInfo> Info,
49 UWorld* World)
50 : TheActor(Actor),
51 Info(std::move(Info)),
52 Id(ActorId),
53 State(InState),
54 World(World)
55{
56}
58 IdType ActorId,
59 AActor* Actor,
60 TSharedPtr<const FActorInfo> Info,
62 UWorld* World)
63 : FCarlaActor(ActorId, Actor, Info, InState, World)
64{
66 ActorData = MakeShared<FVehicleData>();
67}
69 IdType ActorId,
70 AActor* Actor,
71 TSharedPtr<const FActorInfo> Info,
73 UWorld* World)
74 : FCarlaActor(ActorId, Actor, Info, InState, World)
75{
77 ActorData = MakeShared<FActorSensorData>();
78}
80 IdType ActorId,
81 AActor* Actor,
82 TSharedPtr<const FActorInfo> Info,
84 UWorld* World)
85 : FCarlaActor(ActorId, Actor, Info, InState, World)
86{
88 ActorData = MakeShared<FTrafficSignData>();
89}
91 IdType ActorId,
92 AActor* Actor,
93 TSharedPtr<const FActorInfo> Info,
95 UWorld* World)
96 : FCarlaActor(ActorId, Actor, Info, InState, World)
97{
99 ActorData = MakeShared<FTrafficLightData>();
100}
102 IdType ActorId,
103 AActor* Actor,
104 TSharedPtr<const FActorInfo> Info,
106 UWorld* World)
107 : FCarlaActor(ActorId, Actor, Info, InState, World)
108{
110 ActorData = MakeShared<FWalkerData>();
111}
113 IdType ActorId,
114 AActor* Actor,
115 TSharedPtr<const FActorInfo> Info,
117 UWorld* World)
118 : FCarlaActor(ActorId, Actor, Info, InState, World)
119{
121 ActorData = MakeShared<FActorData>();
122}
123
124TSharedPtr<FCarlaActor> FCarlaActor::ConstructCarlaActor(
125 IdType ActorId,
126 AActor* Actor,
127 TSharedPtr<const FActorInfo> Info,
128 ActorType Type,
130 UWorld* World)
131{
132 switch(Type)
133 {
135 return MakeShared<FTrafficSignActor>(ActorId, Actor, std::move(Info), InState, World);
136 break;
138 return MakeShared<FTrafficLightActor>(ActorId, Actor, std::move(Info), InState, World);
139 break;
141 return MakeShared<FVehicleActor>(ActorId, Actor, std::move(Info), InState, World);
142 break;
144 return MakeShared<FWalkerActor>(ActorId, Actor, std::move(Info), InState, World);
145 break;
147 return MakeShared<FSensorActor>(ActorId, Actor, std::move(Info), InState, World);
148 break;
149 default:
150 return MakeShared<FOtherActor>(ActorId, Actor, std::move(Info), InState, World);
151 break;
152 }
153}
154
155// Base FCarlaActor functions ---------------------
156
158{
160 if (ActorData)
161 {
162 ActorData->RecordActorData(this, CarlaEpisode);
163 }
164 if (AActor* Actor = TheActor.Get())
165 {
166 Actor->Destroy();
167 }
168 TheActor = nullptr;
169}
170
172{
173 TheActor = ActorData->RespawnActor(CarlaEpisode, *Info);
174 if (TheActor == nullptr)
175 {
176 UE_LOG(LogCarla, Error, TEXT("Could not wake up dormant actor %d at location %s"), GetActorId(), *(ActorData->GetLocalTransform(CarlaEpisode).GetLocation().ToString()));
177 return;
178 }
180 ActorData->RestoreActorData(this, CarlaEpisode);
181}
182
184{
185 if (IsDormant())
186 {
187 FTransform Transform = FTransform(
188 ActorData->Rotation,
189 ActorData->Location.ToFVector(),
190 ActorData->Scale);
191 ALargeMapManager* LargeMap =
193 if (LargeMap)
194 {
195 Transform = LargeMap->GlobalToLocalTransform(Transform);
196 }
197 return Transform;
198 }
199 else
200 {
201 return GetActor()->GetActorTransform();
202 }
203}
204
206{
207 if (IsDormant())
208 {
209 return FTransform(
210 ActorData->Rotation,
211 ActorData->Location.ToFVector(),
212 ActorData->Scale);
213 }
214 else
215 {
216 const AActor* Actor = GetActor();
217 if (Actor == nullptr)
218 {
219 // Streamed out by World Partition behind the registry's back; there is
220 // no live transform to read. Identity beats dereferencing null until
221 // stream-out converts these entries to dormant.
222 return FTransform::Identity;
223 }
224 FTransform Transform = Actor->GetActorTransform();
225 ALargeMapManager* LargeMap =
227 if (LargeMap)
228 {
229 Transform = LargeMap->LocalToGlobalTransform(Transform);
230 }
231 return Transform;
232 }
233}
234
236{
237 if (IsDormant())
238 {
239 FVector Location = ActorData->Location.ToFVector();
240 ALargeMapManager* LargeMap =
242 if (LargeMap)
243 {
244 Location = LargeMap->GlobalToLocalLocation(Location);
245 }
246 return Location;
247 }
248 else
249 {
250 return GetActor()->GetActorLocation();
251 }
252}
253
255{
256 if (IsDormant())
257 {
258 return ActorData->Location.ToFVector();
259 }
260 else
261 {
262 FVector Location = GetActor()->GetActorLocation();
263 ALargeMapManager* LargeMap =
265 if (LargeMap)
266 {
267 Location = LargeMap->LocalToGlobalLocation(Location);
268 }
269 return Location;
270 }
271}
272
273void FCarlaActor::SetActorLocalLocation(const FVector& Location, ETeleportType TeleportType)
274{
275 if (IsDormant())
276 {
277 FVector GlobalLocation = Location;
278 ALargeMapManager* LargeMap =
280 if (LargeMap)
281 {
282 GlobalLocation = LargeMap->LocalToGlobalLocation(GlobalLocation);
283 }
284 ActorData->Location = FDVector(GlobalLocation);
285 }
286 else
287 {
288 GetActor()->SetActorRelativeLocation(
289 Location,
290 false,
291 nullptr,
292 TeleportType);
293 }
294}
295
297 const FVector& Location, ETeleportType TeleportType)
298{
299 if (IsDormant())
300 {
301 ActorData->Location = FDVector(Location);;
302 }
303 else
304 {
305 FVector LocalLocation = Location;
306 ALargeMapManager* LargeMap =
308 if (LargeMap)
309 {
310 LocalLocation = LargeMap->GlobalToLocalLocation(Location);
311 }
312 GetActor()->SetActorRelativeLocation(
313 LocalLocation,
314 false,
315 nullptr,
316 TeleportType);
317 }
318}
319
321 const FTransform& Transform, ETeleportType TeleportType)
322{
323 if (IsDormant())
324 {
325 FTransform GlobalTransform = Transform;
326 ALargeMapManager* LargeMap =
328 if (LargeMap)
329 {
330 GlobalTransform =
331 LargeMap->LocalToGlobalTransform(GlobalTransform);
332 }
333 ActorData->Location = FDVector(GlobalTransform.GetLocation());
334 ActorData->Rotation = GlobalTransform.GetRotation();
335 ActorData->Scale = GlobalTransform.GetScale3D();
336 }
337 else
338 {
339 GetActor()->SetActorRelativeTransform(
340 Transform,
341 false,
342 nullptr,
343 TeleportType);
344 }
345}
346
348 const FTransform& Transform, ETeleportType TeleportType)
349{
350 if (IsDormant())
351 {
352 ActorData->Location = FDVector(Transform.GetLocation());
353 ActorData->Rotation = Transform.GetRotation();
354 ActorData->Scale = Transform.GetScale3D();
355 }
356 else
357 {
358 FTransform LocalTransform = Transform;
359 ALargeMapManager* LargeMap =
361 if (LargeMap)
362 {
363 LocalTransform =
364 LargeMap->GlobalToLocalTransform(LocalTransform);
365 }
366 GetActor()->SetActorTransform(
367 LocalTransform,
368 false,
369 nullptr,
370 TeleportType);
371 }
372}
373
375{
377 {
378 return MirroredVelocity;
379 }
380 if (IsDormant())
381 {
382 return ActorData->Velocity;
383 }
384 else
385 {
386 return GetActor()->GetVelocity();
387 }
388}
389
391{
393 {
394 return FMath::RadiansToDegrees(MirroredAngularVelocity);
395 }
396 if (IsDormant())
397 {
398 return ActorData->AngularVelocity;
399 }
400 else
401 {
402 UPrimitiveComponent* Primitive =
403 Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
404 if (Primitive)
405 {
406 return Primitive->GetPhysicsAngularVelocityInDegrees();
407 }
408 }
409 return FVector();
410}
411
413{
414 if (IsDormant())
415 {
416 ActorData->Velocity = Velocity;
417 }
418 else
419 {
420 auto RootComponent = Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
421 if (RootComponent == nullptr)
422 {
424 }
425 RootComponent->SetPhysicsLinearVelocity(
426 Velocity,
427 false,
428 "None");
429 }
431}
432
434{
435 if (IsDormant())
436 {
437 ActorData->AngularVelocity = AngularVelocity;
438 }
439 else
440 {
441 UPrimitiveComponent* RootComponent = Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
442 if (RootComponent == nullptr)
443 {
445 }
446 RootComponent->SetPhysicsAngularVelocityInDegrees(
447 AngularVelocity,
448 false,
449 "None");
450 }
452}
453
455{
456 if (IsDormant())
457 {
458 }
459 else
460 {
461 auto RootComponent = Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
462 if (RootComponent == nullptr)
463 {
465 }
466 RootComponent->AddImpulse(
467 Impulse,
468 "None",
469 false);
470 }
472}
473
475 const FVector& Impulse, const FVector& Location)
476{
477 if (IsDormant())
478 {
479 }
480 else
481 {
482 auto RootComponent = Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
483 if (RootComponent == nullptr)
484 {
486 }
487
488 UE_LOG(LogCarla, Warning, TEXT("AddImpulseAtLocation: Experimental feature, use carefully."));
489
490 RootComponent->AddImpulseAtLocation(
491 Impulse,
492 Location,
493 "None");
494 }
496}
497
499{
500 if (IsDormant())
501 {
502 }
503 else
504 {
505 auto RootComponent = Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
506 if (RootComponent == nullptr)
507 {
509 }
510 RootComponent->AddForce(
511 Force,
512 "None",
513 false);
514 }
516}
517
519 const FVector& Force, const FVector& Location)
520{
521 if (IsDormant())
522 {
523 }
524 else
525 {
526 auto RootComponent = Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
527 if (RootComponent == nullptr)
528 {
530 }
531
532 UE_LOG(LogCarla, Warning, TEXT("AddForceAtLocation: Experimental feature, use carefully."));
533
534 RootComponent->AddForceAtLocation(
535 Force,
536 Location,
537 "None");
538 }
540}
541
543{
544 if (IsDormant())
545 {
546 }
547 else
548 {
549 auto RootComponent = Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
550 if (RootComponent == nullptr)
551 {
553 }
554 RootComponent->AddAngularImpulseInDegrees(
555 AngularInpulse,
556 "None",
557 false);
558 }
560}
561
563{
564 if (IsDormant())
565 {
566 }
567 else
568 {
569 auto RootComponent = Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
570 if (RootComponent == nullptr)
571 {
573 }
574 RootComponent->AddTorqueInDegrees(
575 Torque,
576 "None",
577 false);
578 }
580}
581
583{
584 if (IsDormant())
585 {
586 ActorData->bSimulatePhysics = bEnabled;
587 }
588 else
589 {
590 // In the rest of actors, the physics is controlled with the UPrimitiveComponent, so we use
591 // that for disable it.
592 auto RootComponent = Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
593 if (RootComponent == nullptr)
594 {
596 }
597
598 RootComponent->SetSimulatePhysics(bEnabled);
599 RootComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
600 }
602}
603
605{
606 if (IsDormant())
607 {
608 }
609 else
610 {
611 GetActor()->SetActorEnableCollision(bEnabled);
612 }
614}
615
617{
618 if (IsDormant())
619 {
620 }
621 else
622 {
623 auto RootComponent = Cast<UPrimitiveComponent>(GetActor()->GetRootComponent());
624 if (RootComponent == nullptr)
625 {
627 }
628 RootComponent->SetEnableGravity(bEnabled);
629 }
631}
632
634{
635 if (IsDormant())
636 {
637 const FActorData* Data = GetActorData();
638 if (Data == nullptr)
639 {
641 }
642 Rig = Data->Rig;
644 }
645 const AActor* Actor = GetActor();
646 if (Actor == nullptr)
647 {
649 }
650 Rig = FActorRigSnapshot::FromActor(Actor);
652}
653
654// The rig holds actor-relative transforms; GetActorLocalTransform serves the
655// actor transform for dormant actors too, so world space works in both states.
657 const TArray<FTransform>& Relative, TArray<FTransform>& Transforms) const
658{
659 const FTransform ActorToWorld = GetActorLocalTransform();
660 Transforms.Reset(Relative.Num());
661 for (const FTransform& Transform : Relative)
662 {
663 Transforms.Add(Transform * ActorToWorld);
664 }
666}
667
669{
671 const ECarlaServerResponse Response = GetActorRigSnapshot(Rig);
672 if (Response != ECarlaServerResponse::Success)
673 {
674 return Response;
675 }
676 Names = Rig.ComponentNames;
678}
679
681 const FString& ComponentName, FTransform& Transform) const
682{
683 const ECarlaServerResponse Response = GetActorComponentRelativeTransform(ComponentName, Transform);
684 if (Response != ECarlaServerResponse::Success)
685 {
686 return Response;
687 }
688 Transform = Transform * GetActorLocalTransform();
690}
691
693 const FString& ComponentName, FTransform& Transform) const
694{
696 const ECarlaServerResponse Response = GetActorRigSnapshot(Rig);
697 if (Response != ECarlaServerResponse::Success)
698 {
699 return Response;
700 }
701 const int32 Index = Rig.ComponentNames.IndexOfByKey(ComponentName);
702 if (Index == INDEX_NONE)
703 {
705 }
706 Transform = Rig.ComponentTransforms[Index];
708}
709
711{
713 const ECarlaServerResponse Response = GetActorRigSnapshot(Rig);
714 if (Response != ECarlaServerResponse::Success)
715 {
716 return Response;
717 }
718 if (Rig.BoneNames.Num() == 0)
719 {
721 }
722 Names = Rig.BoneNames;
724}
725
727 TArray<FTransform>& Transforms) const
728{
730 const ECarlaServerResponse Response = GetActorRigSnapshot(Rig);
731 if (Response != ECarlaServerResponse::Success)
732 {
733 return Response;
734 }
735 if (Rig.BoneNames.Num() == 0)
736 {
738 }
739 Transforms = Rig.BoneTransforms;
741}
742
744 TArray<FTransform>& Transforms) const
745{
746 TArray<FTransform> Relative;
747 const ECarlaServerResponse Response = GetActorBoneRelativeTransforms(Relative);
748 if (Response != ECarlaServerResponse::Success)
749 {
750 return Response;
751 }
752 return ToWorld(Relative, Transforms);
753}
754
756{
758 const ECarlaServerResponse Response = GetActorRigSnapshot(Rig);
759 if (Response != ECarlaServerResponse::Success)
760 {
761 return Response;
762 }
763 Names = Rig.SocketNames;
765}
766
768 TArray<FTransform>& Transforms) const
769{
771 const ECarlaServerResponse Response = GetActorRigSnapshot(Rig);
772 if (Response != ECarlaServerResponse::Success)
773 {
774 return Response;
775 }
776 Transforms = Rig.SocketTransforms;
778}
779
781 TArray<FTransform>& Transforms) const
782{
783 TArray<FTransform> Relative;
785 if (Response != ECarlaServerResponse::Success)
786 {
787 return Response;
788 }
789 return ToWorld(Relative, Transforms);
790}
791
792// FVehicleActor functions ---------------------
793
795{
796 if (IsDormant())
797 {
798 }
799 else
800 {
801 auto CarlaVehicle = Cast<ACarlaWheeledVehicle>(GetActor());
802 if (CarlaVehicle == nullptr)
803 {
805 }
806 CarlaVehicle->ActivateVelocityControl(Velocity);
807 }
809}
810
812{
813 if (IsDormant())
814 {
815 }
816 else
817 {
818 auto CarlaVehicle = Cast<ACarlaWheeledVehicle>(GetActor());
819 if (CarlaVehicle == nullptr)
820 {
822 }
823 CarlaVehicle->DeactivateVelocityControl();
824 }
826}
827
829{
830 if (IsDormant())
831 {
832 }
833 else
834 {
835 auto CarlaVehicle = Cast<ACarlaWheeledVehicle>(GetActor());
836 if (CarlaVehicle == nullptr)
837 {
839 }
840 CarlaVehicle->ActivateAccelerationControl(Acceleration);
841 }
843}
844
846{
847 if (IsDormant())
848 {
849 }
850 else
851 {
852 auto CarlaVehicle = Cast<ACarlaWheeledVehicle>(GetActor());
853 if (CarlaVehicle == nullptr)
854 {
856 }
857 CarlaVehicle->DeactivateAccelerationControl();
858 }
860}
861
863{
864 if (IsDormant())
865 {
866 FVehicleData* Data = GetActorData<FVehicleData>();
868 }
869 else
870 {
871 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
872 if (Vehicle == nullptr)
873 {
875 }
876 PhysicsControl = Vehicle->GetVehiclePhysicsControl();
877 }
879}
880
882{
883 if (IsDormant())
884 {
886 }
887 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
888 if (Vehicle == nullptr)
889 {
891 }
892 TelemetryData = Vehicle->GetVehicleTelemetryData();
894}
895
897{
898 if (IsDormant())
899 {
900 FVehicleData* Data = GetActorData<FVehicleData>();
901 FailureState = Data->FailureState;
902 }
903 else
904 {
905 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
906 if (Vehicle == nullptr)
907 {
909 }
910 FailureState = Vehicle->GetFailureState();
911 }
913}
914
916{
917 if (IsDormant())
918 {
919 FVehicleData* Data = GetActorData<FVehicleData>();
920 LightState = Data->LightState;
921 }
922 else
923 {
924 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
925 if (Vehicle == nullptr)
926 {
928 }
929
930 LightState = Vehicle->GetVehicleLightState();
931 }
933}
934
936{
937 if (!IsDormant())
938 {
939 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
940 if (Vehicle == nullptr)
941 {
943 }
944 Vehicle->OpenDoor(DoorIdx);
945 }
947}
948
950{
951 if (!IsDormant())
952 {
953 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
954 if (Vehicle == nullptr)
955 {
957 }
958 Vehicle->CloseDoor(DoorIdx);
959 }
961}
962
965{
966 if (IsDormant())
967 {
968 FVehicleData* Data = GetActorData<FVehicleData>();
970 }
971 else
972 {
973 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
974 if (Vehicle == nullptr)
975 {
977 }
978
979 Vehicle->ApplyVehiclePhysicsControl(PhysicsControl);
980 }
982}
983
985 const FVehicleLightState& LightState)
986{
987 if (IsDormant())
988 {
989 FVehicleData* Data = GetActorData<FVehicleData>();
990 Data->LightState = LightState;
991 }
992 else
993 {
994 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
995 if (Vehicle == nullptr)
996 {
998 }
999
1000 Vehicle->SetVehicleLightState(LightState);
1001 }
1003}
1004
1005// Why the wheel's pose cannot be set, or Success if it can.
1007 const ACarlaWheeledVehicle& Vehicle, const EVehicleWheelLocation& WheelLocation)
1008{
1009 if (!Vehicle.HasWheel(static_cast<int32>(WheelLocation)))
1010 {
1012 }
1013 if (!Vehicle.IsWheelAnimationOverridden())
1014 {
1016 }
1018}
1019
1021 const EVehicleWheelLocation& WheelLocation, float AngleInDeg)
1022{
1023 if (IsDormant())
1024 {
1025 }
1026 else
1027 {
1028 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1029 if(Vehicle == nullptr){
1031 }
1032 const ECarlaServerResponse Response = CanSetWheelPose(*Vehicle, WheelLocation);
1033 if (Response != ECarlaServerResponse::Success)
1034 {
1035 return Response;
1036 }
1037 Vehicle->SetWheelSteerDirection(WheelLocation, AngleInDeg);
1038 }
1040}
1041
1043 const EVehicleWheelLocation& WheelLocation, float& Angle)
1044{
1045 if (IsDormant())
1046 {
1047 Angle = 0;
1048 }
1049 else
1050 {
1051 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1052 if(Vehicle == nullptr){
1054 }
1055 if (!Vehicle->HasWheel(static_cast<int32>(WheelLocation)))
1056 {
1058 }
1059 Angle = Vehicle->GetWheelSteerAngle(WheelLocation);
1060 }
1062}
1063
1065 const EVehicleWheelLocation& WheelLocation, float AngleInDeg)
1066{
1067 if (!IsDormant())
1068 {
1069 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1070 if (Vehicle == nullptr)
1071 {
1073 }
1074 const ECarlaServerResponse Response = CanSetWheelPose(*Vehicle, WheelLocation);
1075 if (Response != ECarlaServerResponse::Success)
1076 {
1077 return Response;
1078 }
1079 Vehicle->SetWheelPitchAngle(WheelLocation, AngleInDeg);
1080 }
1082}
1083
1085 const EVehicleWheelLocation& WheelLocation, float& Angle)
1086{
1087 Angle = 0.0f;
1088 if (!IsDormant())
1089 {
1090 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1091 if (Vehicle == nullptr)
1092 {
1094 }
1095 if (!Vehicle->HasWheel(static_cast<int32>(WheelLocation)))
1096 {
1098 }
1099 Angle = Vehicle->GetWheelPitchAngle(WheelLocation);
1100 }
1102}
1103
1105 const EVehicleWheelLocation& WheelLocation, float Offset)
1106{
1107 if (!IsDormant())
1108 {
1109 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1110 if (Vehicle == nullptr)
1111 {
1113 }
1114 const ECarlaServerResponse Response = CanSetWheelPose(*Vehicle, WheelLocation);
1115 if (Response != ECarlaServerResponse::Success)
1116 {
1117 return Response;
1118 }
1119 Vehicle->SetWheelSuspensionOffset(WheelLocation, Offset * UE_M_TO_CM);
1120 }
1122}
1123
1125 const EVehicleWheelLocation& WheelLocation, float& Offset)
1126{
1127 Offset = 0.0f;
1128 if (!IsDormant())
1129 {
1130 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1131 if (Vehicle == nullptr)
1132 {
1134 }
1135 if (!Vehicle->HasWheel(static_cast<int32>(WheelLocation)))
1136 {
1138 }
1139 Offset = Vehicle->GetWheelSuspensionOffset(WheelLocation) * UE_CM_TO_M;
1140 }
1142}
1143
1145{
1146 if (!IsDormant())
1147 {
1148 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1149 if (Vehicle == nullptr)
1150 {
1152 }
1153 if (bEnabled && !Vehicle->HasCarlaVehicleAnimation())
1154 {
1156 }
1157 Vehicle->SetWheelAnimationOverride(bEnabled);
1158 }
1160}
1161
1163{
1164 if (IsDormant())
1165 {
1166 ActorData->bSimulatePhysics = bEnabled;
1167 }
1168 else
1169 {
1170 auto* CarlaVehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1171 // The physics in the vehicles works in a different way so to disable them.
1172 if (CarlaVehicle == nullptr){
1174 }
1175 CarlaVehicle->SetSimulatePhysics(bEnabled);
1176 }
1178}
1179
1181 const FVehicleControl& Control, const EVehicleInputPriority& Priority)
1182{
1183 if (IsDormant())
1184 {
1185 FVehicleData* Data = GetActorData<FVehicleData>();
1186 Data->Control = Control;
1187 Data->bAckermannControlActive = false;
1188 }
1189 else
1190 {
1191 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1192 if (Vehicle == nullptr)
1193 {
1195 }
1196 Vehicle->ApplyVehicleControl(Control, Priority);
1197 }
1199}
1200
1202 const FVehicleAckermannControl& AckermannControl, const EVehicleInputPriority& Priority)
1203{
1204 if (IsDormant())
1205 {
1206 FVehicleData* Data = GetActorData<FVehicleData>();
1207 Data->AckermannControl = AckermannControl;
1208 Data->bAckermannControlActive = true;
1209 }
1210 else
1211 {
1212 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1213 if (Vehicle == nullptr)
1214 {
1216 }
1217 Vehicle->ApplyVehicleAckermannControl(AckermannControl, Priority);
1218 }
1220}
1221
1223{
1224 if (IsDormant())
1225 {
1226 FVehicleData* Data = GetActorData<FVehicleData>();
1227 VehicleControl = Data->Control;
1228 }
1229 else
1230 {
1231 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1232 if (Vehicle == nullptr)
1233 {
1235 }
1236 VehicleControl = Vehicle->GetVehicleControl();
1237 }
1239}
1240
1242{
1243 if (IsDormant())
1244 {
1245 FVehicleData* Data = GetActorData<FVehicleData>();
1246 VehicleAckermannControl = Data->AckermannControl;
1247 }
1248 else
1249 {
1250 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1251 if (Vehicle == nullptr)
1252 {
1254 }
1255 VehicleAckermannControl = Vehicle->GetVehicleAckermannControl();
1256 }
1258}
1259
1261 FAckermannControllerSettings& AckermannSettings)
1262{
1263 if (IsDormant())
1264 {
1265 FVehicleData* Data = GetActorData<FVehicleData>();
1266 AckermannSettings = Data->AckermannControllerSettings;
1267 }
1268 else
1269 {
1270 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1271 if (Vehicle == nullptr)
1272 {
1274 }
1275 AckermannSettings = Vehicle->GetAckermannControllerSettings();
1276 }
1278}
1279
1281 const FAckermannControllerSettings& AckermannSettings)
1282{
1283 if (IsDormant())
1284 {
1285 FVehicleData* Data = GetActorData<FVehicleData>();
1286 Data->AckermannControllerSettings = AckermannSettings;
1287 }
1288 else
1289 {
1290 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1291 if (Vehicle == nullptr)
1292 {
1294 }
1295
1296 Vehicle->ApplyAckermannControllerSettings(AckermannSettings);
1297 }
1299}
1300
1302{
1303 if (IsDormant())
1304 {
1305 }
1306 else
1307 {
1308 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1309 if (Vehicle == nullptr)
1310 {
1312 }
1313 auto Controller = Cast<AWheeledVehicleAIController>(Vehicle->GetController());
1314 if (Controller == nullptr)
1315 {
1317 }
1318 Controller->SetAutopilot(bEnabled, bKeepState);
1319 }
1321}
1322
1324{
1325 if (IsDormant())
1326 {
1327 }
1328 else
1329 {
1330 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1331 if (Vehicle == nullptr)
1332 {
1334 }
1335 Vehicle->ShowDebugTelemetry(bEnabled);
1336 }
1338}
1339
1341{
1342 if (IsDormant())
1343 {
1344 }
1345 else
1346 {
1347 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1348 if (Vehicle == nullptr)
1349 {
1351 }
1353 }
1355}
1356
1358{
1359 if (IsDormant())
1360 {
1361 }
1362 else
1363 {
1364 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1365 if (Vehicle == nullptr)
1366 {
1368 }
1369 auto* CarSimComponent = Vehicle->GetCarlaMovementComponent<UCarSimManagerComponent>();
1370 if(CarSimComponent)
1371 {
1372 CarSimComponent->UseCarSimRoad(bEnabled);
1373 }
1374 else
1375 {
1377 }
1378 }
1380}
1381
1383 uint64_t MaxSubsteps, float MaxSubstepDeltaTime,
1384 const FString& VehicleJSON, const FString& PowertrainJSON,
1385 const FString& TireJSON, const FString& BaseJSONPath)
1386{
1387 if (IsDormant())
1388 {
1389 }
1390 else
1391 {
1392 auto Vehicle = Cast<ACarlaWheeledVehicle>(GetActor());
1393 if (Vehicle == nullptr)
1394 {
1396 }
1398 Vehicle,
1399 MaxSubsteps,
1400 MaxSubstepDeltaTime,
1401 VehicleJSON,
1402 PowertrainJSON,
1403 TireJSON,
1404 BaseJSONPath);
1405 }
1407}
1408
1409// FSensorActor functions ---------------------
1410
1411// FtrafficSignActor functions ---------------------
1412
1413// FTrafficLightActor functions ---------------------
1414
1416 const ETrafficLightState& TLState)
1417{
1418 if (IsDormant())
1419 {
1420 FTrafficLightData* Data = GetActorData<FTrafficLightData>();
1421 Data->LightState = TLState;
1422 }
1423 else
1424 {
1425 auto TrafficLight = Cast<ATrafficLightBase>(GetActor());
1426 if (TrafficLight == nullptr)
1427 {
1429 }
1430 TrafficLight->SetTrafficLightState(TLState);
1431 }
1433}
1434
1436{
1437 if (IsDormant())
1438 {
1439 const FTrafficLightData* Data = GetActorData<FTrafficLightData>();
1440 return Data->LightState;
1441 }
1442 else
1443 {
1444 auto TrafficLight = Cast<ATrafficLightBase>(GetActor());
1445 if (TrafficLight == nullptr)
1446 {
1447 return ETrafficLightState::Off;
1448 }
1449 return TrafficLight->GetTrafficLightState();
1450 }
1451}
1452
1454{
1455 if (IsDormant())
1456 {
1457 FTrafficLightData* Data = GetActorData<FTrafficLightData>();
1458 return Data->Controller;
1459 }
1460 else
1461 {
1462 auto TrafficLight = Cast<ATrafficLightBase>(GetActor());
1463 if (TrafficLight == nullptr)
1464 {
1465 return nullptr;
1466 }
1467 return TrafficLight->GetTrafficLightComponent()->GetController();
1468 }
1469}
1470
1472{
1473 if (IsDormant())
1474 {
1475 // Todo: implement
1476 }
1477 else
1478 {
1479 auto TrafficLight = Cast<ATrafficLightBase>(GetActor());
1480 if (TrafficLight == nullptr)
1481 {
1483 }
1484 TrafficLight->SetGreenTime(time);
1485 }
1487}
1488
1490{
1491 if (IsDormant())
1492 {
1493 // Todo: implement
1494 }
1495 else
1496 {
1497 auto TrafficLight = Cast<ATrafficLightBase>(GetActor());
1498 if (TrafficLight == nullptr)
1499 {
1501 }
1502 TrafficLight->SetYellowTime(time);
1503 }
1505}
1506
1508{
1509 if (IsDormant())
1510 {
1511 // Todo: implement
1512 }
1513 else
1514 {
1515 auto TrafficLight = Cast<ATrafficLightBase>(GetActor());
1516 if (TrafficLight == nullptr)
1517 {
1519 }
1520 TrafficLight->SetRedTime(time);
1521 }
1523}
1524
1526{
1527 if (IsDormant())
1528 {
1529 // Todo: implement
1530 }
1531 else
1532 {
1533 auto TrafficLight = Cast<ATrafficLightBase>(GetActor());
1534 if (TrafficLight == nullptr)
1535 {
1537 }
1538 TrafficLight->SetTimeIsFrozen(bFreeze);
1539 }
1541}
1542
1544{
1545 if (IsDormant())
1546 {
1547 // Todo: implement
1548 }
1549 else
1550 {
1551 auto TrafficLight = Cast<ATrafficLightBase>(GetActor());
1552 if (TrafficLight == nullptr)
1553 {
1555 }
1556 TrafficLight->GetTrafficLightComponent()->GetGroup()->ResetGroup();
1557 }
1559}
1560
1561// FWalkerActor functions ---------------------
1562
1564 const FTransform& Transform,
1565 carla::rpc::WalkerControl WalkerControl)
1566{
1567 FVector NewLocation = Transform.GetLocation();
1568 FVector CurrentLocation = GetActorGlobalLocation();
1569
1570 // adjust position up by half of capsule height
1571 // (because in Unreal walker is centered at the capsule middle,
1572 // while Recast uses the bottom point)
1573 UCapsuleComponent* Capsule = Cast<UCapsuleComponent>(GetActor()->GetRootComponent());
1574 if (Capsule)
1575 {
1576 NewLocation.Z += Capsule->GetScaledCapsuleHalfHeight();
1577 }
1578
1579 FTransform NewTransform = Transform;
1580 NewTransform.SetLocation(NewLocation);
1581
1582 if (IsDormant())
1583 {
1584 FWalkerData* WalkerData = GetActorData<FWalkerData>();
1585 WalkerData->WalkerControl = WalkerControl;
1586 }
1587 else
1588 {
1589 auto * Walker = Cast<AWalkerBase>(GetActor());
1590 if (Walker && !Walker->bAlive)
1591 {
1593 }
1594
1595 // apply walker speed
1596 auto Pawn = Cast<APawn>(GetActor());
1597 if (Pawn == nullptr)
1598 {
1600 }
1601 auto Controller = Cast<AWalkerController>(Pawn->GetController());
1602 if (Controller == nullptr)
1603 {
1605 }
1606 Controller->ApplyWalkerControl(WalkerControl);
1607 }
1608 SetActorGlobalTransform(NewTransform);
1610}
1611
1613{
1615 {
1616 return MirroredVelocity;
1617 }
1618 if (IsDormant())
1619 {
1620 return GetActorData()->Velocity;
1621 }
1622
1623 // Walkers move via UCharacterMovementComponent (AWalkerController::Tick
1624 // drives it through AddMovementInput, a kinematic sweep), not physics
1625 // simulation. AActor::GetVelocity() (APawn::GetVelocity()) prefers the
1626 // root component's physics-body velocity whenever the root capsule is
1627 // simulating physics -- true for walker Blueprints set up for ragdoll
1628 // death even while walking normally -- which reports that near-zero
1629 // physics-body velocity instead of the character's actual movement
1630 // speed. Read the movement component's own tracked velocity directly.
1631 auto* Character = Cast<ACharacter>(GetActor());
1632 if (Character != nullptr)
1633 {
1634 if (auto* MovementComponent = Character->GetCharacterMovement())
1635 {
1636 return MovementComponent->Velocity;
1637 }
1638 }
1639 return GetActor()->GetVelocity();
1640}
1641
1643 FWalkerControl& Control)
1644{
1645 if (IsDormant())
1646 {
1647 FWalkerData* WalkerData = GetActorData<FWalkerData>();
1648 Control = WalkerData->WalkerControl;
1649 }
1650 else
1651 {
1652 auto * Walker = Cast<AWalkerBase>(GetActor());
1653 if (Walker && !Walker->bAlive)
1654 {
1656 }
1657
1658 // apply walker speed
1659 auto Pawn = Cast<APawn>(GetActor());
1660 if (Pawn == nullptr)
1661 {
1663 }
1664 auto Controller = Cast<AWalkerController>(Pawn->GetController());
1665 if (Controller == nullptr)
1666 {
1668 }
1669 Control = Controller->GetWalkerControl();
1670 }
1672}
1673
1675{
1676 if (IsDormant())
1677 {
1678 ActorData->bSimulatePhysics = bEnabled;
1679 }
1680 else
1681 {
1682 auto* Character = Cast<ACharacter>(GetActor());
1683 // The physics in the walkers also works in a different way so to disable them,
1684 // we need to do it in the UCharacterMovementComponent.
1685 if (Character == nullptr)
1686 {
1688 }
1689 auto CharacterMovement = Cast<UCharacterMovementComponent>(Character->GetCharacterMovement());
1690 if(bEnabled) {
1691 CharacterMovement->SetDefaultMovementMode();
1692 }
1693 else {
1694 CharacterMovement->DisableMovement();
1695 }
1696 }
1698}
1699
1701{
1702 if (IsDormant())
1703 {
1704 }
1705 else
1706 {
1707 auto Character = Cast<ACharacter>(GetActor());
1708 // The physics in the walkers works in a different way so to disable them,
1709 // we need to do it in the UCharacterMovementComponent.
1710 if (Character == nullptr)
1711 {
1713 }
1714 auto CharacterMovement = Cast<UCharacterMovementComponent>(Character->GetCharacterMovement());
1715
1716 if(bEnabled) {
1717 CharacterMovement->SetDefaultMovementMode();
1718 }
1719 else {
1720 if (CharacterMovement->IsFlying() || CharacterMovement->IsFalling())
1721 CharacterMovement->DisableMovement();
1722 }
1723 }
1725}
1726
1728 const FWalkerControl& Control)
1729{
1730 if (IsDormant())
1731 {
1732 FWalkerData* Data = GetActorData<FWalkerData>();
1733 Data->WalkerControl = Control;
1734 }
1735 else
1736 {
1737 auto Pawn = Cast<APawn>(GetActor());
1738 if (Pawn == nullptr)
1739 {
1741 }
1742 auto Controller = Cast<AWalkerController>(Pawn->GetController());
1743 if (Controller == nullptr)
1744 {
1746 }
1747 Controller->ApplyWalkerControl(Control);
1748 }
1750}
1751
1753{
1754 if (IsDormant())
1755 {
1756 }
1757 else
1758 {
1759 auto Pawn = Cast<APawn>(GetActor());
1760 if (Pawn == nullptr)
1761 {
1763 }
1764 auto Controller = Cast<AWalkerController>(Pawn->GetController());
1765 if (Controller == nullptr)
1766 {
1768 }
1769 Controller->GetBonesTransform(Bones);
1770 }
1772}
1773
1775{
1776 if (IsDormant())
1777 {
1778 }
1779 else
1780 {
1781 auto Pawn = Cast<APawn>(GetActor());
1782 if (Pawn == nullptr)
1783 {
1785 }
1786 auto Controller = Cast<AWalkerController>(Pawn->GetController());
1787 if (Controller == nullptr)
1788 {
1790 }
1791 Controller->SetBonesTransform(Bones);
1792 }
1794}
1795
1797{
1798 if (IsDormant())
1799 {
1800 }
1801 else
1802 {
1803 auto Pawn = Cast<APawn>(GetActor());
1804 if (Pawn == nullptr)
1805 {
1807 }
1808 auto Controller = Cast<AWalkerController>(Pawn->GetController());
1809 if (Controller == nullptr)
1810 {
1812 }
1813 Controller->BlendPose(Blend);
1814 }
1816}
1817
1819{
1820 if (IsDormant())
1821 {
1822 }
1823 else
1824 {
1825 auto Pawn = Cast<APawn>(GetActor());
1826 if (Pawn == nullptr)
1827 {
1829 }
1830 auto Controller = Cast<AWalkerController>(Pawn->GetController());
1831 if (Controller == nullptr)
1832 {
1834 }
1835 Controller->GetPoseFromAnimation();
1836 }
1838}
1839
1841{
1842 if (IsDormant())
1843 {
1844 }
1845 else
1846 {
1847 auto Pawn = Cast<APawn>(GetActor());
1848 if (Pawn == nullptr)
1849 {
1851 }
1852 auto Walker = Cast<AWalkerBase>(Pawn);
1853 if (Walker == nullptr)
1854 {
1856 }
1857 Walker->StartDeathLifeSpan();
1858 UE_LOG(LogCarla, Warning, TEXT("Walker starting life span by dead"));
1859 }
1861}
1862
1864{
1865 UCarlaEpisode *Episode = UCarlaStatics::GetCurrentEpisode(Actor.GetWorld());
1866 if ((Episode != nullptr) && !Episode->bIsPrimaryServer)
1867 {
1868 const FCarlaActor *View = Episode->FindCarlaActor(const_cast<AActor *>(&Actor));
1869 if ((View != nullptr) && View->HasMirroredKinematics())
1870 {
1872 }
1873 }
1874 const auto *Root = Cast<UPrimitiveComponent>(Actor.GetRootComponent());
1875 return (Root != nullptr) ? Root->GetPhysicsAngularVelocityInRadians() : FVector::ZeroVector;
1876}
static ECarlaServerResponse CanSetWheelPose(const ACarlaWheeledVehicle &Vehicle, const EVehicleWheelLocation &WheelLocation)
FVector CarlaGetActorAngularVelocityInRadians(const AActor &Actor)
Angular velocity of Actor in the world frame, in rad/s: on a Multi-GPU secondary the primary's (a mir...
ECarlaServerResponse
EVehicleWheelLocation
EVehicleDoor
Type of door to open/close.
EVehicleInputPriority
Base class for CARLA wheeled vehicles.
FTransform GlobalToLocalTransform(const FTransform &InTransform) const
FVector GlobalToLocalLocation(const FVector &InLocation) const
FTransform LocalToGlobalTransform(const FTransform &InTransform) const
FVector LocalToGlobalLocation(const FVector &InLocation) const
FActorRigSnapshot Rig
Definition ActorData.h:51
FVector Velocity
Definition ActorData.h:57
A view over an actor and its properties.
Definition CarlaActor.h:25
ECarlaServerResponse GetActorComponentNames(TArray< FString > &Names) const
carla::rpc::ActorState State
Definition CarlaActor.h:589
UWorld * World
Definition CarlaActor.h:601
ECarlaServerResponse AddActorImpulseAtLocation(const FVector &Impulse, const FVector &Location)
ECarlaServerResponse GetActorSocketNames(TArray< FString > &Names) const
ECarlaServerResponse GetActorBoneWorldTransforms(TArray< FTransform > &Transforms) const
static TSharedPtr< FCarlaActor > ConstructCarlaActor(IdType ActorId, AActor *Actor, TSharedPtr< const FActorInfo > Info, ActorType Type, carla::rpc::ActorState InState, UWorld *World)
ECarlaServerResponse AddActorForceAtLocation(const FVector &Force, const FVector &Location)
virtual ECarlaServerResponse SetActorEnableGravity(bool bEnabled)
ECarlaServerResponse ToWorld(const TArray< FTransform > &Relative, TArray< FTransform > &Transforms) const
FVector GetActorLocalLocation() const
ECarlaServerResponse GetActorBoneRelativeTransforms(TArray< FTransform > &Transforms) const
void SetActorLocalTransform(const FTransform &Transform, ETeleportType Teleport=ETeleportType::TeleportPhysics)
FVector MirroredAngularVelocity
Definition CarlaActor.h:583
ECarlaServerResponse AddActorTorque(const FVector &Torque)
ECarlaServerResponse SetActorTargetAngularVelocity(const FVector &AngularVelocity)
bool IsDormant() const
Definition CarlaActor.h:71
ECarlaServerResponse AddActorImpulse(const FVector &Impulse)
AActor * GetActor()
Definition CarlaActor.h:91
FVector MirroredVelocity
Definition CarlaActor.h:581
bool HasMirroredKinematics() const
Definition CarlaActor.h:174
uint32 IdType
Definition CarlaActor.h:28
virtual ECarlaServerResponse SetActorCollisions(bool bEnabled)
TWeakObjectPtr< AActor > TheActor
Weak: World Partition can stream out (destroy) the actor without going through the episode,...
Definition CarlaActor.h:567
ECarlaServerResponse GetActorRigSnapshot(FActorRigSnapshot &Rig) const
FVector GetActorAngularVelocity() const
ECarlaServerResponse GetActorComponentWorldTransform(const FString &ComponentName, FTransform &Transform) const
ECarlaServerResponse GetActorSocketWorldTransforms(TArray< FTransform > &Transforms) const
ECarlaServerResponse GetActorBoneNames(TArray< FString > &Names) const
ECarlaServerResponse GetActorSocketRelativeTransforms(TArray< FTransform > &Transforms) const
FTransform GetActorGlobalTransform() const
virtual FVector GetActorVelocity() const
void SetActorGlobalTransform(const FTransform &Transform, ETeleportType Teleport=ETeleportType::TeleportPhysics)
void SetActorGlobalLocation(const FVector &Location, ETeleportType Teleport=ETeleportType::TeleportPhysics)
FActorData * GetActorData()
Definition CarlaActor.h:205
TSharedPtr< const FActorInfo > Info
Definition CarlaActor.h:569
FVector GetActorGlobalLocation() const
ActorType Type
Definition CarlaActor.h:597
bool bHasMirroredKinematics
Definition CarlaActor.h:579
ECarlaServerResponse GetActorComponentRelativeTransform(const FString &ComponentName, FTransform &Transform) const
FVector GetMirroredAngularVelocityInRadians() const
Definition CarlaActor.h:184
void SetActorLocalLocation(const FVector &Location, ETeleportType Teleport=ETeleportType::TeleportPhysics)
TSharedPtr< FActorData > ActorData
Definition CarlaActor.h:599
IdType GetActorId() const
Definition CarlaActor.h:81
FTransform GetActorLocalTransform() const
ECarlaServerResponse SetActorTargetVelocity(const FVector &Velocity)
ECarlaServerResponse AddActorForce(const FVector &Force)
FCarlaActor()=default
virtual ECarlaServerResponse SetActorSimulatePhysics(bool bEnabled)
void WakeActorUp(UCarlaEpisode *CarlaEpisode)
ECarlaServerResponse AddActorAngularImpulse(const FVector &AngularInpulse)
void PutActorToSleep(UCarlaEpisode *CarlaEpisode)
FOtherActor(IdType ActorId, AActor *Actor, TSharedPtr< const FActorInfo > Info, carla::rpc::ActorState InState, UWorld *World)
FSensorActor(IdType ActorId, AActor *Actor, TSharedPtr< const FActorInfo > Info, carla::rpc::ActorState InState, UWorld *World)
virtual ECarlaServerResponse SetLightGreenTime(float time) final
virtual ECarlaServerResponse FreezeTrafficLight(bool bFreeze) final
virtual ETrafficLightState GetTrafficLightState() const final
FTrafficLightActor(IdType ActorId, AActor *Actor, TSharedPtr< const FActorInfo > Info, carla::rpc::ActorState InState, UWorld *World)
virtual ECarlaServerResponse SetTrafficLightState(const ETrafficLightState &State) final
virtual ECarlaServerResponse ResetTrafficLightGroup() final
virtual UTrafficLightController * GetTrafficLightController() final
virtual ECarlaServerResponse SetLightRedTime(float time) final
virtual ECarlaServerResponse SetLightYellowTime(float time) final
ETrafficLightState LightState
Definition ActorData.h:134
UTrafficLightController * Controller
Definition ActorData.h:132
FTrafficSignActor(IdType ActorId, AActor *Actor, TSharedPtr< const FActorInfo > Info, carla::rpc::ActorState InState, UWorld *World)
virtual ECarlaServerResponse SetActorAutopilot(bool bEnabled, bool bKeepState=false) final
virtual ECarlaServerResponse EnableChronoPhysics(uint64_t MaxSubsteps, float MaxSubstepDeltaTime, const FString &VehicleJSON, const FString &PowertrainJSON, const FString &TireJSON, const FString &BaseJSONPath) final
virtual ECarlaServerResponse SetActorSimulatePhysics(bool bSimulatePhysics) final
FVehicleActor(IdType ActorId, AActor *Actor, TSharedPtr< const FActorInfo > Info, carla::rpc::ActorState InState, UWorld *World)
virtual ECarlaServerResponse DisableActorConstantVelocity() final
virtual ECarlaServerResponse GetVehicleLightState(FVehicleLightState &LightState) final
virtual ECarlaServerResponse SetWheelPitchAngle(const EVehicleWheelLocation &WheelLocation, float AngleInDeg) final
virtual ECarlaServerResponse GetWheelSuspensionOffset(const EVehicleWheelLocation &WheelLocation, float &Offset) final
Offset in meters.
virtual ECarlaServerResponse GetFailureState(carla::rpc::VehicleFailureState &) final
virtual ECarlaServerResponse GetWheelPitchAngle(const EVehicleWheelLocation &WheelLocation, float &Angle) final
virtual ECarlaServerResponse SetWheelAnimationOverride(bool bEnabled) final
virtual ECarlaServerResponse GetWheelSteerAngle(const EVehicleWheelLocation &WheelLocation, float &Angle)
virtual ECarlaServerResponse ApplyControlToVehicle(const FVehicleControl &, const EVehicleInputPriority &) final
virtual ECarlaServerResponse DisableActorConstantAcceleration() final
virtual ECarlaServerResponse EnableActorConstantVelocity(const FVector &Velocity) final
virtual ECarlaServerResponse GetVehicleTelemetryData(FVehicleTelemetryData &TelemetryData) final
virtual ECarlaServerResponse SetVehicleLightState(const FVehicleLightState &LightState) final
virtual ECarlaServerResponse EnableCarSim(const FString &SimfilePath) final
virtual ECarlaServerResponse GetPhysicsControl(FVehiclePhysicsControl &PhysicsControl) final
virtual ECarlaServerResponse SetWheelSteerDirection(const EVehicleWheelLocation &WheelLocation, float AngleInDeg) final
virtual ECarlaServerResponse SetWheelSuspensionOffset(const EVehicleWheelLocation &WheelLocation, float Offset) final
Offset in meters.
virtual ECarlaServerResponse UseCarSimRoad(bool bEnabled) final
virtual ECarlaServerResponse GetVehicleControl(FVehicleControl &) final
virtual ECarlaServerResponse ApplyAckermannControllerSettings(const FAckermannControllerSettings &) final
virtual ECarlaServerResponse EnableActorConstantAcceleration(const FVector &Acceleration) final
virtual ECarlaServerResponse ApplyAckermannControlToVehicle(const FVehicleAckermannControl &, const EVehicleInputPriority &) final
virtual ECarlaServerResponse ApplyPhysicsControl(const FVehiclePhysicsControl &PhysicsControl) final
virtual ECarlaServerResponse OpenVehicleDoor(const EVehicleDoor DoorIdx) final
virtual ECarlaServerResponse CloseVehicleDoor(const EVehicleDoor DoorIdx) final
virtual ECarlaServerResponse GetVehicleAckermannControl(FVehicleAckermannControl &) final
virtual ECarlaServerResponse ShowVehicleDebugTelemetry(bool bEnabled) final
virtual ECarlaServerResponse GetAckermannControllerSettings(FAckermannControllerSettings &) final
bool bAckermannControlActive
Definition ActorData.h:84
FVehicleLightState LightState
Definition ActorData.h:88
FVehicleControl Control
Definition ActorData.h:80
carla::rpc::VehicleFailureState FailureState
Definition ActorData.h:92
FVehicleAckermannControl AckermannControl
Definition ActorData.h:82
FAckermannControllerSettings AckermannControllerSettings
Definition ActorData.h:86
FVehiclePhysicsControl PhysicsControl
Definition ActorData.h:78
virtual ECarlaServerResponse BlendPose(float Blend)
virtual ECarlaServerResponse SetActorSimulatePhysics(bool bSimulatePhysics) final
virtual ECarlaServerResponse SetActorEnableGravity(bool bEnabled) final
virtual FVector GetActorVelocity() const final
Walkers move via UCharacterMovementComponent (kinematic sweeps driven by AddMovementInput),...
virtual ECarlaServerResponse GetPoseFromAnimation()
FWalkerActor(IdType ActorId, AActor *Actor, TSharedPtr< const FActorInfo > Info, carla::rpc::ActorState InState, UWorld *World)
virtual ECarlaServerResponse SetBonesTransform(const FWalkerBoneControlIn &) final
virtual ECarlaServerResponse GetWalkerControl(FWalkerControl &) final
virtual ECarlaServerResponse SetWalkerState(const FTransform &Transform, carla::rpc::WalkerControl WalkerControl) final
virtual ECarlaServerResponse SetActorDead()
virtual ECarlaServerResponse ApplyControlToWalker(const FWalkerControl &) final
virtual ECarlaServerResponse GetBonesTransform(FWalkerBoneControlOut &) final
carla::rpc::WalkerControl WalkerControl
Definition ActorData.h:103
static void CreateCarsimComponent(ACarlaWheeledVehicle *Vehicle, FString Simfile)
A simulation episode.
FCarlaActor * FindCarlaActor(FCarlaActor::IdType ActorId)
Find a Carla actor by id.
static ALargeMapManager * GetLargeMapManager(const UObject *WorldContextObject)
static UCarlaEpisode * GetCurrentEpisode(const UObject *WorldContextObject)
static void CreateChronoMovementComponent(ACarlaWheeledVehicle *Vehicle, uint64_t MaxSubsteps, float MaxSubstepDeltaTime, FString VehicleJSON="", FString PowertrainJSON="", FString TireJSON="", FString BaseJSONPath="")
Maps a controller from OpenDrive.
TArray< FString > SocketNames
Definition ActorData.h:36
TArray< FTransform > ComponentTransforms
Definition ActorData.h:33
TArray< FString > ComponentNames
Definition ActorData.h:32
TArray< FTransform > BoneTransforms
Definition ActorData.h:35
TArray< FString > BoneNames
Definition ActorData.h:34
static FActorRigSnapshot FromActor(const AActor *Actor)
Definition ActorData.cpp:26
TArray< FTransform > SocketTransforms
Definition ActorData.h:37