CARLA
Loading...
Searching...
No Matches
CarlaRecorder.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 "CarlaRecorder.h"
8#include "Carla.h"
20#include "CarlaReplayerHelper.h"
21
25
26#include <util/ue-header-guard-begin.h>
27#include "Components/BoxComponent.h"
28#include "Components/SkeletalMeshComponent.h"
29#include <util/ue-header-guard-end.h>
30
31#include <ctime>
32#include <sstream>
33
35{
36 PrimaryActorTick.TickGroup = TG_PrePhysics;
37 Disable();
38}
39
40ACarlaRecorder::ACarlaRecorder(const FObjectInitializer &ObjectInitializer)
41 : Super(ObjectInitializer)
42{
43 PrimaryActorTick.TickGroup = TG_PrePhysics;
44 Disable();
45}
46
47std::string ACarlaRecorder::ShowFileInfo(std::string Name, bool bShowAll)
48{
49 return Query.QueryInfo(Name, bShowAll);
50}
51
52std::string ACarlaRecorder::ShowFileCollisions(std::string Name, char Type1, char Type2)
53{
54 return Query.QueryCollisions(Name, Type1, Type2);
55}
56
57std::string ACarlaRecorder::ShowFileActorsBlocked(std::string Name, double MinTime, double MinDistance)
58{
59 return Query.QueryBlocked(Name, MinTime, MinDistance);
60}
61
63 std::string Name, double TimeStart, double Duration,
64 uint32_t FollowId, const FTransform& Offset, bool ReplaySensors, bool ReplayWeather,
65 std::string MapOverride)
66{
67 Stop();
68 return Replayer.ReplayFile(Name, TimeStart, Duration, FollowId, Offset, ReplaySensors, ReplayWeather, MapOverride);
69}
70
72{
73 Replayer.SetTimeFactor(TimeFactor);
74}
75
77{
78 Replayer.SetIgnoreHero(IgnoreHero);
79}
80
82{
83 Replayer.SetIgnoreSpectator(IgnoreSpectator);
84}
85
86void ACarlaRecorder::StopReplayer(bool KeepActors)
87{
88 Replayer.Stop(KeepActors);
89 // A replay that reached its end stopped itself keeping its actors, so
90 // Stop() alone would leave them: remove what is left on request.
91 if (KeepActors)
92 {
94 }
95 else
96 {
98 }
99}
100
101void ACarlaRecorder::Ticking(float DeltaSeconds)
102{
103 TRACE_CPUPROFILER_EVENT_SCOPE(ACarlaRecorder::Ticking);
104 Super::Tick(DeltaSeconds);
105
106 if (!Episode)
107 return;
108
109 // check if recording
110 if (Enabled)
111 {
114
115 const FActorRegistry &Registry = Episode->GetActorRegistry();
116
117 // through all actors in registry
118 for (auto It = Registry.begin(); It != Registry.end(); ++It)
119 {
120 FCarlaActor* View = It->Value.Get();
121
122 switch (View->GetActorType())
123 {
124 // save the transform for props
126 AddActorPosition(View);
127 break;
128
129 // save the transform of all vehicles
131 AddActorPosition(View);
133 AddVehicleLight(View);
135 if (bAdditionalData)
136 {
137 AddActorKinematics(View);
138 }
139 break;
140
141 // save the transform of all walkers
143 AddActorPosition(View);
144 AddWalkerAnimation(View);
145 if (bAdditionalData)
146 {
147 AddActorKinematics(View);
148 AddActorBones(View);
149 }
150 break;
151
152 // save the state of each traffic light
155 break;
156 }
157 }
158
159 // save the initial weather
160 if (bFirstTick)
161 {
163 bFirstTick = false;
164 }
165
166 // write all data for this frame
167 Write(DeltaSeconds);
168 }
169 if (Episode->GetReplayer()->IsEnabled())
170 {
171 // replayer
172 Episode->GetReplayer()->Tick(DeltaSeconds);
173 }
174}
175
177{
178 PrimaryActorTick.bCanEverTick = true;
179 Enabled = true;
180}
181
183{
184 PrimaryActorTick.bCanEverTick = false;
185 Enabled = false;
186}
187
189{
190 check(CarlaActor != nullptr);
191
192 FTransform Transform = CarlaActor->GetActorGlobalTransform();
193 // get position of the vehicle
195 {
196 CarlaActor->GetActorId(),
197 Transform.GetLocation(),
198 Transform.GetRotation().Euler()
199 });
200}
201
203{
204 check(CarlaActor != nullptr);
205
206 if (CarlaActor->IsPendingKill())
207 {
208 return;
209 }
210
211 FVehicleControl Control;
212 CarlaActor->GetVehicleControl(Control);
213
214 // save
216 Record.DatabaseId = CarlaActor->GetActorId();
217 Record.Steering = Control.Steer;
218 Record.Throttle = Control.Throttle;
219 Record.Brake = Control.Brake;
220 Record.bHandbrake = Control.bHandBrake;
221 Record.Gear = Control.Gear;
222 AddAnimVehicle(Record);
223}
224
226{
227 check(CarlaActor != nullptr)
228 if (CarlaActor->IsPendingKill())
229 return;
231 return;
232
233 ACarlaWheeledVehicle* CarlaVehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
234 if (CarlaVehicle == nullptr)
235 return;
236
237 const UChaosWheeledVehicleMovementComponent* Movement = CarlaVehicle->GetChaosWheeledVehicleMovementComponent();
238 if (Movement == nullptr)
239 return;
240
242 Record.DatabaseId = CarlaActor->GetActorId();
243 Record.WheelValues.reserve(Movement->WheelSetups.Num());
244
245 // The getters return the pose shown, whether Chaos, the animation instance
246 // or the wheel animation override set it.
247 for (uint8 i = 0; CarlaVehicle->HasWheel(i); ++i)
248 {
249 WheelInfo Wheel;
250 Wheel.Location = static_cast<EVehicleWheelLocation>(i);
251 Wheel.SteeringAngle = CarlaVehicle->GetWheelSteerAngle(Wheel.Location);
252 Wheel.TireRotation = CarlaVehicle->GetWheelPitchAngle(Wheel.Location);
253 Record.WheelValues.push_back(Wheel);
254 }
255
256 AddAnimVehicleWheels(Record);
257
258 if (CarlaVehicle->IsTwoWheeledVehicle())
259 {
261 {
262 CarlaActor->GetActorId(),
263 Movement->GetForwardSpeed(),
264 Movement->GetEngineRotationSpeed() / Movement->GetEngineMaxRotationSpeed()
265 });
266 }
267}
268
270{
271 check(CarlaActor != nullptr);
272
273 if (!CarlaActor->IsPendingKill())
274 {
275 FWalkerControl Control;
276 CarlaActor->GetWalkerControl(Control);
278 {
279 CarlaActor->GetActorId(),
280 Control.Speed
281 });
282 }
283}
284
286{
287 check(CarlaActor != nullptr);
288
289 ETrafficLightState LightState = CarlaActor->GetTrafficLightState();
290 UTrafficLightController* Controller = CarlaActor->GetTrafficLightController();
291 if (Controller)
292 {
293 ATrafficLightGroup* Group = Controller->GetGroup();
294 if (Group)
295 {
297 {
298 CarlaActor->GetActorId(),
299 Group->IsFrozen(),
300 Controller->GetElapsedTime(),
301 static_cast<char>(LightState)
302 });
303 }
304 }
305}
306
308{
309 check(CarlaActor != nullptr);
310
311 FVehicleLightState LightState;
312 CarlaActor->GetVehicleLightState(LightState);
313 CarlaRecorderLightVehicle LightVehicle;
314 LightVehicle.DatabaseId = CarlaActor->GetActorId();
315 LightVehicle.State = carla::rpc::VehicleLightState(LightState).light_state;
316 AddLightVehicle(LightVehicle);
317}
318
320{
321 const FCarlaActor* LocalCarlaActor = Episode->GetActorRegistry().FindCarlaActor(&Vehicle);
322 if (LocalCarlaActor != nullptr)
323 {
324 CarlaRecorderDoorVehicle DoorVehicle;
325 DoorVehicle.DatabaseId = LocalCarlaActor->GetActorId();
326 DoorVehicle.Doors = static_cast<CarlaRecorderDoorVehicle::VehicleDoorType>(SDoors);
327 DoorVehicle.bIsOpen = bIsOpen;
328 AddDoorVehicle(DoorVehicle);
329 }
330}
331
333{
334 check(CarlaActor != nullptr);
335
336 FVector Velocity, AngularVelocity;
337 constexpr float TO_METERS = 1e-2;
338 Velocity = TO_METERS* CarlaActor->GetActorVelocity();
339 AngularVelocity = CarlaActor->GetActorAngularVelocity();
340 CarlaRecorderKinematics Kinematic =
341 {
342 CarlaActor->GetActorId(),
343 Velocity,
344 AngularVelocity
345 };
346 AddKinematics(Kinematic);
347}
348
350{
351 check(CarlaActor != nullptr);
352
353 const auto &Box = CarlaActor->GetActorInfo()->BoundingBox;
355 {
356 CarlaActor->GetActorId(),
357 {Box.Origin, Box.Extent}
358 };
359
361}
362
364{
365 if (bAdditionalData)
366 {
367 TArray<UBoxComponent*> Triggers = TrafficSign.GetTriggerVolumes();
368 if(!Triggers.Num())
369 {
370 return;
371 }
372 auto CarlaActor = Episode->GetActorRegistry().FindCarlaActor(&TrafficSign);
373 if (!CarlaActor)
374 {
375 return;
376 }
377 UBoxComponent* Trigger = Triggers.Top();
378 auto VolumeOrigin = Trigger->GetComponentLocation();
379 auto VolumeExtent = Trigger->GetScaledBoxExtent();
381 {
382 CarlaActor->GetActorId(),
383 {VolumeOrigin, VolumeExtent}
384 };
386 }
387}
388
390{
391 if (bAdditionalData)
392 {
393 if (auto CarlaActor = Episode->GetActorRegistry().FindCarlaActor(&Vehicle))
394 {
396 Control.DatabaseId = CarlaActor->GetActorId();
397 Control.VehiclePhysicsControl = Vehicle.GetVehiclePhysicsControl();
398 PhysicsControls.Add(Control);
399 }
400 }
401}
402
404{
405 if (bAdditionalData)
406 {
407 if (auto CarlaActor = Episode->GetActorRegistry().FindCarlaActor(&TrafficLight))
408 {
409 auto DatabaseId = CarlaActor->GetActorId();
411 DatabaseId,
412 TrafficLight.GetGreenTime(),
413 TrafficLight.GetYellowTime(),
414 TrafficLight.GetRedTime()
415 };
417 }
418 }
419}
420
422{
423 check(CarlaActor != nullptr);
424
425 // get the bones
427 CarlaActor->GetBonesTransform(Bones);
428
430 Walker.DatabaseId = CarlaActor->GetActorId();
431 for (auto &Bone : Bones.BoneTransforms)
432 {
433 FString Name = Bone.Get<0>();
434 auto Transforms = Bone.Get<1>();
435 FVector Loc = Transforms.Relative.GetTranslation();
436 FVector Rot = Transforms.Relative.GetRotation().Euler();
437 CarlaRecorderWalkerBone Entry(Name, Loc, Rot);
438 Walker.Bones.push_back(Entry);
439 }
440 WalkersBones.Add(std::move(Walker));
441}
442
444 std::string Name,
445 FString MapName,
446 bool AdditionalData,
447 bool StopReplayer)
448{
449 // stop replayer if any in course
451 Replayer.Stop();
452
453 // stop recording
454 Stop();
455
456 // reset collisions Id
457 NextCollisionId = 0;
458
459 // get the final path + filename
460 std::string Filename = GetRecorderFilename(Name);
461
462 // binary file
463 File.open(Filename, std::ios::binary);
464 if (!File.is_open())
465 {
466 return "";
467 }
468
469 // save info
470 Info.Version = 1;
471 Info.Magic = TEXT("CARLA_RECORDER");
472 Info.Date = std::time(0);
473 Info.Mapfile = MapName;
474
475 // write general info
476 Info.Write(File);
477
478 Frames.Reset();
480
481 // reset first-tick flag so the initial weather is captured on every recording session
482 bFirstTick = true;
483
484 Enable();
485
486 bAdditionalData = AdditionalData;
487
488 // add all existing actors
490
491 return std::string(Filename);
492}
493
495{
496 Disable();
497
498 if (File)
499 {
500 File.close();
501 }
502
503 Clear();
504}
505
529
530void ACarlaRecorder::Write(double DeltaSeconds)
531{
532 // update this frame data
533 Frames.SetFrame(DeltaSeconds);
534
535 // start
538
539 // events
545
546 // positions and states
549
550 // animations
558
559 // additional info
560 if (bAdditionalData)
561 {
569 }
570
571 // end
573
574 Clear();
575}
576
578{
579 if (Enabled)
580 {
582 }
583}
584
586{
587 if (Enabled)
588 {
590 }
591}
592
594{
595 if (Enabled)
596 {
597 EventsAdd.Add(std::move(Event));
598 }
599}
600
602{
603 if (Enabled)
604 {
605 EventsDel.Add(std::move(Event));
606 }
607}
608
610{
611 if (Enabled)
612 {
613 EventsParent.Add(std::move(Event));
614 }
615}
616
618{
619 if (Enabled)
620 {
622
623 // some inits
625 Collision.IsActor1Hero = false;
626 Collision.IsActor2Hero = false;
627
628 // check actor 1
629 FCarlaActor *FoundActor1 = Episode->GetActorRegistry().FindCarlaActor(Actor1);
630 if (FoundActor1 != nullptr) {
631 if (FoundActor1->GetActorInfo() != nullptr)
632 {
633 auto RoleName = FoundActor1->GetActorInfo()->Description.Variations.Find("role_name");
634 if (RoleName != nullptr)
635 Collision.IsActor1Hero = (RoleName->Value == "hero");
636 }
637 Collision.DatabaseId1 = FoundActor1->GetActorId();
638 }
639 else {
640 Collision.DatabaseId1 = uint32_t(-1); // actor1 is not a registered Carla actor
641 }
642
643 // check actor 2
644 FCarlaActor *FoundActor2 = Episode->GetActorRegistry().FindCarlaActor(Actor2);
645 if (FoundActor2 != nullptr) {
646 if (FoundActor2->GetActorInfo() != nullptr)
647 {
648 auto RoleName = FoundActor2->GetActorInfo()->Description.Variations.Find("role_name");
649 if (RoleName != nullptr)
650 Collision.IsActor2Hero = (RoleName->Value == "hero");
651 }
652 Collision.DatabaseId2 = FoundActor2->GetActorId();
653 }
654 else {
655 Collision.DatabaseId2 = uint32_t(-1); // actor2 is not a registered Carla actor
656 }
657
658 Collisions.Add(std::move(Collision));
659 }
660}
661
663{
664 if (Enabled)
665 {
667 }
668}
669
677
679{
680 if (Enabled)
681 {
682 Wheels.Add(VehicleWheels);
683 }
684}
685
687{
688 if (Enabled)
689 {
690 Walkers.Add(Walker);
691 }
692}
693
695{
696 if (Enabled)
697 {
698 Bikers.Add(Biker);
699 }
700}
701
703{
704 if (Enabled)
705 {
706 LightVehicles.Add(LightVehicle);
707 }
708}
709
711{
712 if (Enabled)
713 {
714 DoorVehicles.Add(DoorVehicle);
715 }
716}
717
718void ACarlaRecorder::AddEventLightSceneChanged(const UCarlaLight* Light)
719{
720 if (Enabled)
721 {
722 CarlaRecorderLightScene LightScene =
723 {
724 Light->GetId(),
725 Light->GetLightIntensity(),
726 Light->GetLightColor(),
727 Light->GetLightOn(),
728 static_cast<uint8>(Light->GetLightType())
729 };
730
731 LightScenes.Add(LightScene);
732 }
733}
734
736{
737 if (Enabled)
738 {
739 Kinematics.Add(ActorKinematics);
740 }
741}
742
744{
745 if (Enabled)
746 {
747 BoundingBoxes.Add(ActorBoundingBox);
748 }
749}
750
752{
753 // registring all existing actors in first frame
755 for (auto& It : Registry)
756 {
757 const FCarlaActor* CarlaActor = It.Value.Get();
758 if (CarlaActor != nullptr)
759 {
760 // create event
762 CarlaActor->GetActorId(),
763 static_cast<uint8_t>(CarlaActor->GetActorType()),
764 CarlaActor->GetActorGlobalTransform(),
765 CarlaActor->GetActorInfo()->Description);
766 }
767 }
768
769 UWorld *World = GetWorld();
770 if(World)
771 {
772 UCarlaLightSubsystem* CarlaLightSubsystem = World->GetSubsystem<UCarlaLightSubsystem>();
773 const auto& Lights = CarlaLightSubsystem->GetLights();
774 for (const auto& LightPair : Lights)
775 {
776 UCarlaLight* Light = LightPair.Value;
778 }
779 }
780
781}
782
784{
785 AWeather *WeatherActor = Episode->GetWeather();
786 if (WeatherActor != nullptr)
787 {
788 CarlaRecorderWeather RecorderWeather;
789 const auto &Params = WeatherActor->GetCurrentWeather();
790 RecorderWeather.Cloudiness = Params.Cloudiness;
791 RecorderWeather.Precipitation = Params.Precipitation;
792 RecorderWeather.PrecipitationDeposits = Params.PrecipitationDeposits;
793 RecorderWeather.WindIntensity = Params.WindIntensity;
794 RecorderWeather.SunAzimuthAngle = Params.SunAzimuthAngle;
795 RecorderWeather.SunAltitudeAngle = Params.SunAltitudeAngle;
796 RecorderWeather.FogDensity = Params.FogDensity;
797 RecorderWeather.FogDistance = Params.FogDistance;
798 RecorderWeather.FogFalloff = Params.FogFalloff;
799 RecorderWeather.Wetness = Params.Wetness;
800 RecorderWeather.ScatteringIntensity = Params.ScatteringIntensity;
801 RecorderWeather.MieScatteringScale = Params.MieScatteringScale;
802 RecorderWeather.RayleighScatteringScale = Params.RayleighScatteringScale;
803 RecorderWeather.DustStorm = Params.DustStorm;
804 AddWeather(RecorderWeather);
805 }
806}
807
809 uint32_t DatabaseId,
810 uint8_t Type,
811 const FTransform &Transform,
812 FActorDescription ActorDescription)
813{
815 Description.UId = ActorDescription.UId;
816 Description.Id = ActorDescription.Id;
817
818 // attributes
819 Description.Attributes.reserve(ActorDescription.Variations.Num());
820 for (const auto &item : ActorDescription.Variations)
821 {
823 Attr.Type = static_cast<uint8_t>(item.Value.Type);
824 Attr.Id = item.Value.Id;
825 Attr.Value = item.Value.Value;
826 // check for empty attributes
827 if (!Attr.Id.IsEmpty())
828 {
829 Description.Attributes.emplace_back(std::move(Attr));
830 }
831 }
832
833 // recorder event
834 CarlaRecorderEventAdd RecEvent
835 {
836 DatabaseId,
837 Type,
838 Transform.GetTranslation(),
839 Transform.GetRotation().Euler(),
840 std::move(Description)
841 };
842 AddEvent(std::move(RecEvent));
843
844 FCarlaActor* CarlaActor = Episode->FindCarlaActor(DatabaseId);
845 // Other events related to spawning actors
846 // check if it is a vehicle to get initial physics control
847 ACarlaWheeledVehicle* Vehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
848 if (Vehicle)
849 {
851 }
852
853 ATrafficLightBase* TrafficLight = Cast<ATrafficLightBase>(CarlaActor->GetActor());
854 if (TrafficLight)
855 {
857 }
858
859 ATrafficSignBase* TrafficSign = Cast<ATrafficSignBase>(CarlaActor->GetActor());
860 if (TrafficSign)
861 {
862 // Trigger volume in global coordinates
863 AddTriggerVolume(*TrafficSign);
864 }
865 else
866 {
867 // Bounding box in local coordinates
868 AddActorBoundingBox(CarlaActor);
869 }
870}
std::string GetRecorderFilename(std::string Filename)
EVehicleWheelLocation
EVehicleDoor
Type of door to open/close.
CarlaRecorderEventsAdd EventsAdd
void AddAnimVehicleWheels(const CarlaRecorderAnimWheels &VehicleWheels)
void AddState(const CarlaRecorderStateTrafficLight &State)
void Ticking(float DeltaSeconds)
void AddVehicleWheelsAnimation(FCarlaActor *CarlaActor)
CarlaRecorderTrafficLightTimes TrafficLightTimes
CarlaRecorderPhysicsControls PhysicsControls
void AddExistingWeather(void)
CarlaRecorderLightScenes LightScenes
void AddEvent(const CarlaRecorderEventAdd &Event)
std::string ShowFileCollisions(std::string Name, char Type1, char Type2)
CarlaRecorderAnimBikers Bikers
void AddVehicleDoor(const ACarlaWheeledVehicle &Vehicle, const EVehicleDoor SDoors, bool bIsOpen)
void AddWeather(const CarlaRecorderWeather &Weather)
void StopReplayer(bool KeepActors=false)
std::string ShowFileInfo(std::string Name, bool bShowAll=false)
void AddActorBoundingBox(FCarlaActor *CarlaActor)
void AddTriggerVolume(const ATrafficSignBase &TrafficSign)
void AddActorBones(FCarlaActor *CarlaActor)
void AddVehicleLight(FCarlaActor *CarlaActor)
CarlaRecorderActorBoundingBoxes BoundingBoxes
CarlaRecorderLightVehicles LightVehicles
CarlaRecorderVisualTime VisualTime
void AddEventLightSceneChanged(const UCarlaLight *Light)
void AddKinematics(const CarlaRecorderKinematics &ActorKinematics)
CarlaRecorderWeathers Weathers
CarlaRecorderPlatformTime PlatformTime
CarlaRecorderActorTriggerVolumes TriggerVolumes
void AddExistingActors(void)
CarlaReplayer Replayer
std::string ShowFileActorsBlocked(std::string Name, double MinTime=30, double MinDistance=10)
void AddActorKinematics(FCarlaActor *CarlaActor)
std::string ReplayFile(std::string Name, double TimeStart, double Duration, uint32_t FollowId, const FTransform &Offset, bool ReplaySensors, bool ReplayWeather, std::string MapOverride)
void AddCollision(AActor *Actor1, AActor *Actor2)
CarlaRecorderInfo Info
void SetReplayerIgnoreSpectator(bool IgnoreSpectator)
std::string Start(std::string Name, FString MapName, bool AdditionalData=false, bool StopReplayer=true)
CarlaRecorderWalkersBones WalkersBones
void AddVehicleAnimation(FCarlaActor *CarlaActor)
void SetReplayerIgnoreHero(bool IgnoreHero)
void AddAnimBiker(const CarlaRecorderAnimBiker &Biker)
void AddPhysicsControl(const ACarlaWheeledVehicle &Vehicle)
void AddAnimVehicle(const CarlaRecorderAnimVehicle &Vehicle)
void AddTrafficLightState(FCarlaActor *CarlaActor)
void AddWalkerAnimation(FCarlaActor *CarlaActor)
void AddLightVehicle(const CarlaRecorderLightVehicle &LightVehicle)
void SetReplayerTimeFactor(double TimeFactor)
void AddTrafficLightTime(const ATrafficLightBase &TrafficLight)
CarlaRecorderQuery Query
uint32_t NextCollisionId
void CreateRecorderEventAdd(uint32_t DatabaseId, uint8_t Type, const FTransform &Transform, FActorDescription ActorDescription)
std::ofstream File
CarlaRecorderEventsParent EventsParent
void AddPosition(const CarlaRecorderPosition &Position)
CarlaRecorderCollisions Collisions
void AddBoundingBox(const CarlaRecorderActorBoundingBox &ActorBoundingBox)
CarlaRecorderActorsKinematics Kinematics
CarlaRecorderPositions Positions
CarlaRecorderAnimWalkers Walkers
CarlaRecorderAnimVehicleWheels Wheels
UCarlaEpisode * Episode
void AddAnimWalker(const CarlaRecorderAnimWalker &Walker)
CarlaRecorderStates States
void AddDoorVehicle(const CarlaRecorderDoorVehicle &DoorVehicle)
void AddActorPosition(FCarlaActor *CarlaActor)
CarlaRecorderEventsDel EventsDel
void Write(double DeltaSeconds)
CarlaRecorderFrames Frames
CarlaRecorderAnimVehicles Vehicles
CarlaRecorderDoorVehicles DoorVehicles
Base class for CARLA wheeled vehicles.
float GetWheelSteerAngle(EVehicleWheelLocation WheelLocation)
float GetWheelPitchAngle(EVehicleWheelLocation WheelLocation)
UChaosWheeledVehicleMovementComponent * GetChaosWheeledVehicleMovementComponent() const
Get chaos wheeled vehicle movement component casted.
bool HasWheel(int32 WheelIndex) const
Class which implements the state changing of traffic lights.
TArray< UBoxComponent * > GetTriggerVolumes() const
const FWeatherParameters & GetCurrentWeather() const
Returns the current WeatherParameters.
Definition Weather.h:59
void Add(const CarlaRecorderActorBoundingBox &InObj)
void Add(const CarlaRecorderActorBoundingBox &InObj)
void Add(const CarlaRecorderKinematics &InObj)
void Write(std::ostream &OutFile)
void Write(std::ostream &OutFile) const
void Add(const CarlaRecorderAnimBiker &InObj)
void Add(const CarlaRecorderAnimWheels &InObj)
void Write(std::ostream &OutFile)
void Add(const CarlaRecorderAnimVehicle &InObj)
void Add(const CarlaRecorderAnimWalker &InObj)
void Write(std::ostream &OutFile)
void Add(const CarlaRecorderCollision &Collision)
void Write(std::ostream &OutFile)
void Add(const CarlaRecorderEventAdd &Event)
void Write(std::ostream &OutFile)
void Add(const CarlaRecorderEventDel &Event)
void Write(std::ostream &OutFile)
void Write(std::ostream &OutFile)
void Add(const CarlaRecorderEventParent &Event)
void SetFrame(double DeltaSeconds)
void WriteEnd(std::ostream &OutFile)
void WriteStart(std::ostream &OutFile)
void Add(const CarlaRecorderPhysicsControl &InObj)
void Add(const CarlaRecorderPosition &InObj)
void Write(std::ostream &OutFile)
std::string QueryBlocked(std::string Filename, double MinTime=30, double MinDistance=10)
std::string QueryCollisions(std::string Filename, char Category1='a', char Category2='a')
std::string QueryInfo(std::string Filename, bool bShowAll=false)
void Write(std::ostream &OutFile)
void Add(const CarlaRecorderStateTrafficLight &State)
void Add(const CarlaRecorderTrafficLightTime &InObj)
void Write(std::ofstream &OutFile)
void Add(const CarlaRecorderWalkerBones &InObj)
void Write(std::ostream &OutFile)
void Add(const CarlaRecorderWeather &InObj)
void SetIgnoreHero(bool InIgnoreHero)
void ForgetSpawnedActors(void)
Forgets the spawned actors, so a later DestroySpawnedActors() leaves them alone.
void Tick(float Time)
void SetIgnoreSpectator(bool InIgnoreSpectator)
void SetTimeFactor(double NewTimeFactor)
std::string ReplayFile(std::string Filename, double TimeStart=0.0f, double Duration=0.0f, uint32_t FollowId=0, const FTransform &Offset=FTransform(), bool ReplaySensors=false, bool ReplayWeather=false, std::string MapOverride="")
void DestroySpawnedActors(void)
Destroys the actors this replayer spawned that are still alive, even when the replay already ended by...
bool IsEnabled(void)
void Stop(bool KeepActors=false)
A registry of all the Carla actors.
auto begin() const noexcept
FCarlaActor * FindCarlaActor(IdType Id)
auto end() const noexcept
A view over an actor and its properties.
Definition CarlaActor.h:25
virtual ECarlaServerResponse GetBonesTransform(FWalkerBoneControlOut &)
Definition CarlaActor.h:514
ActorType GetActorType() const
Definition CarlaActor.h:86
AActor * GetActor()
Definition CarlaActor.h:91
FVector GetActorAngularVelocity() const
virtual ECarlaServerResponse GetVehicleLightState(FVehicleLightState &)
Definition CarlaActor.h:344
FTransform GetActorGlobalTransform() const
virtual FVector GetActorVelocity() const
virtual ECarlaServerResponse GetVehicleControl(FVehicleControl &)
Definition CarlaActor.h:416
bool IsPendingKill() const
Definition CarlaActor.h:76
virtual ETrafficLightState GetTrafficLightState() const
Definition CarlaActor.h:469
virtual UTrafficLightController * GetTrafficLightController()
Definition CarlaActor.h:474
virtual ECarlaServerResponse GetWalkerControl(FWalkerControl &)
Definition CarlaActor.h:509
const FActorInfo * GetActorInfo() const
Definition CarlaActor.h:101
IdType GetActorId() const
Definition CarlaActor.h:81
A rigid transform in CARLA's / Unreal's left-handed frame: x forward, y right, z up,...
double GetVisualGameTime() const
Visual game seconds.
CarlaReplayer * GetReplayer() const
FCarlaActor * FindCarlaActor(FCarlaActor::IdType ActorId)
Find a Carla actor by id.
AWeather * GetWeather() const
const FActorRegistry & GetActorRegistry() const
std::vector< carla::rpc::LightState > GetLights(FString Client)
Maps a controller from OpenDrive.
ATrafficLightGroup * GetGroup()
Defines the physical appearance of a vehicle whitch is obtained by the sensors.
flag_type light_state
Lights state flag, all turned off by default.
std::vector< CarlaRecorderActorAttribute > Attributes
void Write(std::ostream &OutFile)
void Add(const CarlaRecorderDoorVehicle &InObj)
void Write(std::ostream &File)
void Write(std::ostream &OutFile)
void Add(const CarlaRecorderLightScene &InObj)
void Write(std::ostream &OutFile)
void Add(const CarlaRecorderLightVehicle &InObj)
FVehiclePhysicsControl VehiclePhysicsControl
void Write(std::ostream &OutFile)
void Write(std::ofstream &OutFile)
std::vector< CarlaRecorderWalkerBone > Bones
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.
FBoundingBox BoundingBox
Definition ActorInfo.h:25
FActorDescription Description
Definition ActorInfo.h:21
EVehicleWheelLocation Location