CARLA
Loading...
Searching...
No Matches
CarlaReplayer.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 "CarlaReplayer.h"
8#include "CarlaRecorder.h"
10
11#include <ctime>
12#include <sstream>
13
14// structure to save replaying info when need to load a new map (static member by now)
15CarlaReplayer::PlayAfterLoadMap CarlaReplayer::Autoplay { false, "", "", 0.0, 0.0, 0, FTransform(), 1.0, false };
16
17void CarlaReplayer::Stop(bool bKeepActors)
18{
19 if (Enabled)
20 {
21 Enabled = false;
22
23 // destroy actors if event was recorded?
24 if (!bKeepActors)
25 {
27 }
28
29 // callback
31 }
32
33 if (File.is_open())
34 File.close();
35}
36
38{
39 if (Episode == nullptr)
40 {
41 SpawnedIds.clear();
42 return;
43 }
44 for (uint32_t Id : SpawnedIds)
45 {
47 }
48 SpawnedIds.clear();
49}
50
52{
53 if (File.eof())
54 {
55 return false;
56 }
57
60
61 return true;
62}
63
65{
66 File.seekg(Header.Size, std::ios::cur);
67}
68
70{
71 CurrentTime = 0.0f;
72 TotalTime = 0.0f;
73 TimeToStop = 0.0f;
74
75 File.clear();
76 File.seekg(0, std::ios::beg);
77
78 // mark as header as invalid to force reload a new one next time
79 Frame.Elapsed = -1.0f;
80 Frame.DurationThis = 0.0f;
81
82 MappedId.clear();
83 IsHeroMap.clear();
84
85 // read geneal Info
87}
88
89// read last frame in File and return the Total time recorded
91{
92 std::streampos Current = File.tellg();
93
94 // parse only frames
95 while (File)
96 {
97 // get header
98 if (!ReadHeader())
99 {
100 break;
101 }
102
103 // check for a frame packet
104 switch (Header.Id)
105 {
106 case static_cast<char>(CarlaRecorderPacketId::FrameStart):
107 Frame.Read(File);
108 break;
109 default:
110 SkipPacket();
111 break;
112 }
113 }
114
115 File.clear();
116 File.seekg(Current, std::ios::beg);
117 return Frame.Elapsed;
118}
119
121 std::string Filename,
122 double TimeStart,
123 double Duration,
124 uint32_t ThisFollowId,
125 const FTransform& Offset,
126 bool ReplaySensors,
127 bool ReplayWeather,
128 std::string MapOverride)
129{
130 std::stringstream Info;
131 std::string s;
132
133 // check to stop if we are replaying another
134 if (Enabled)
135 {
136 Stop();
137 }
138
139 // get the final path + filename
140 std::string Filename2 = GetRecorderFilename(Filename);
141
142 Info << "Replaying File: " << Filename2 << std::endl;
143
144 // try to open
145 File.open(Filename2, std::ios::binary);
146 if (!File.is_open())
147 {
148 Info << "File " << Filename2 << " not found on server\n";
149 Stop();
150 return Info.str();
151 }
152
153 // from start
154 Rewind();
155
156 if (!MapOverride.empty())
157 RecInfo.Mapfile = UTF8_TO_TCHAR(MapOverride.c_str());
158
159 // check to load map if different
161 {
163 {
164 Info << "Could not load mapfile " << TCHAR_TO_UTF8(*RecInfo.Mapfile) << std::endl;
165 Stop();
166 return Info.str();
167 }
168 Info << "Loading map " << TCHAR_TO_UTF8(*RecInfo.Mapfile) << std::endl;
169 Info << "Replayer will start after map is loaded..." << std::endl;
170
171 // prepare autoplay after map is loaded
172 Autoplay.Enabled = true;
173 Autoplay.Filename = Filename2;
175 Autoplay.TimeStart = TimeStart;
176 Autoplay.Duration = Duration;
177 Autoplay.FollowId = ThisFollowId;
178 Autoplay.FollowOffset = Offset;
180 Autoplay.ReplaySensors = ReplaySensors;
181 Autoplay.ReplayWeather = ReplayWeather;
182 }
183
184 // get Total time of recorder
186 Info << "Total time recorded: " << TotalTime << std::endl;
187
188 // set time to start replayer
189 if (TimeStart < 0.0f)
190 {
191 TimeStart = TotalTime + TimeStart;
192 if (TimeStart < 0.0f)
193 TimeStart = 0.0f;
194 }
195
196 // set time to stop replayer
197 if (Duration > 0.0f)
198 TimeToStop = TimeStart + Duration;
199 else
201
202 Info << "Replaying from " << TimeStart << " s - " << TimeToStop << " s (" << TotalTime << " s) at " <<
203 std::setprecision(1) << std::fixed << TimeFactor << "x" << std::endl;
204
205 if (IgnoreHero)
206 Info << "Ignoring Hero vehicle" << std::endl;
207
208 if (IgnoreSpectator)
209 Info << "Ignoring Spectator camera" << std::endl;
210
211 // set the follow Id and offset
212 FollowId = ThisFollowId;
213 FollowOffset = Offset;
214
215 bReplaySensors = ReplaySensors;
216 bReplayWeather = ReplayWeather;
217 // if we don't need to load a new map, then start
218 if (!Autoplay.Enabled)
219 {
221 // process all events until the time
222 ProcessToTime(TimeStart, true);
223 // mark as enabled
224 Enabled = true;
225 }
226
227 return Info.str();
228}
229
231{
232
233 // check if the autoplay is enabled (means waiting until map is loaded)
234 if (!Autoplay.Enabled)
235 return;
236
237 // disable
238 Autoplay.Enabled = false;
239
240 // check to stop if we are replaying another
241 if (Enabled)
242 {
243 Stop();
244 }
245
246 // try to open
247 File.open(Autoplay.Filename, std::ios::binary);
248 if (!File.is_open())
249 {
250 return;
251 }
252
253 // from start
254 Rewind();
255
256 // get Total time of recorder
258
259 // set time to start replayer
260 double TimeStart = Autoplay.TimeStart;
261 if (TimeStart < 0.0f)
262 {
263 TimeStart = TotalTime + Autoplay.TimeStart;
264 if (TimeStart < 0.0f)
265 TimeStart = 0.0f;
266 }
267
268 // set time to stop replayer
269 if (Autoplay.Duration > 0.0f)
270 TimeToStop = TimeStart + Autoplay.Duration;
271 else
273
274 // set the follow Id and offset
277
280
281 // apply time factor
283
285
286 // process all events until the time
287 ProcessToTime(TimeStart, true);
288
289 // mark as enabled
290 Enabled = true;
291}
292
293void CarlaReplayer::ProcessToTime(double Time, bool IsFirstTime)
294{
295 double Per = 0.0f;
296 double NewTime = CurrentTime + Time;
297 bool bFrameFound = false;
298 bool bExitAtNextFrame = false;
299 bool bExitLoop = false;
300
301 // check if we are in the right frame
302 if (NewTime >= Frame.Elapsed && NewTime < Frame.Elapsed + Frame.DurationThis)
303 {
304 Per = (NewTime - Frame.Elapsed) / Frame.DurationThis;
305 bFrameFound = true;
306 bExitLoop = true;
307 }
308
309 // process all frames until time we want or end
310 while (!File.eof() && !bExitLoop)
311 {
312 // get header
313 ReadHeader();
314
315 // check for a frame packet
316 switch (Header.Id)
317 {
318 // frame
319 case static_cast<char>(CarlaRecorderPacketId::FrameStart):
320 // only read if we are not in the right frame
321 Frame.Read(File);
322 // check if target time is in this frame
323 if (NewTime < Frame.Elapsed + Frame.DurationThis)
324 {
325 Per = (NewTime - Frame.Elapsed) / Frame.DurationThis;
326 bFrameFound = true;
327 }
328 break;
329
330 // visual time for FX
331 case static_cast<char>(CarlaRecorderPacketId::VisualTime):
333 break;
334
335 // events add
336 case static_cast<char>(CarlaRecorderPacketId::EventAdd):
338 break;
339
340 // events del
341 case static_cast<char>(CarlaRecorderPacketId::EventDel):
343 break;
344
345 // events parent
346 case static_cast<char>(CarlaRecorderPacketId::EventParent):
348 break;
349
350 // collisions
351 case static_cast<char>(CarlaRecorderPacketId::Collision):
352 SkipPacket();
353 break;
354
355 // positions
356 case static_cast<char>(CarlaRecorderPacketId::Position):
357 if (bFrameFound)
358 ProcessPositions(IsFirstTime);
359 else
360 SkipPacket();
361 break;
362
363 // states
364 case static_cast<char>(CarlaRecorderPacketId::State):
365 if (bFrameFound)
367 else
368 SkipPacket();
369 break;
370
371 // vehicle animation
372 case static_cast<char>(CarlaRecorderPacketId::AnimVehicle):
373 if (bFrameFound)
375 else
376 SkipPacket();
377 break;
378
379 // vehicle wheels animation
380 case static_cast<char>(CarlaRecorderPacketId::AnimVehicleWheels):
381 if (bFrameFound)
382 ProcessAnimVehicleWheels(IsFirstTime);
383 else
384 SkipPacket();
385 break;
386
387 // walker animation
388 case static_cast<char>(CarlaRecorderPacketId::AnimWalker):
389 if (bFrameFound)
391 else
392 SkipPacket();
393 break;
394
395 // biker animation
396 case static_cast<char>(CarlaRecorderPacketId::AnimBiker):
397 if (bFrameFound)
399 else
400 SkipPacket();
401 break;
402
403 // vehicle light animation
404 case static_cast<char>(CarlaRecorderPacketId::VehicleLight):
405 if (bFrameFound)
407 else
408 SkipPacket();
409 break;
410
411 // vehicle door animation
412 case static_cast<char>(CarlaRecorderPacketId::VehicleDoor):
413 if (bFrameFound)
415 else
416 SkipPacket();
417 break;
418
419 // scene lights animation
420 case static_cast<char>(CarlaRecorderPacketId::SceneLight):
421 if (bFrameFound)
423 else
424 SkipPacket();
425 break;
426
427 // walker bones
428 case static_cast<char>(CarlaRecorderPacketId::WalkerBones):
429 if (bFrameFound)
431 else
432 SkipPacket();
433 break;
434
435 // weather
436 case static_cast<char>(CarlaRecorderPacketId::Weather):
438 break;
439
440 // frame end
441 case static_cast<char>(CarlaRecorderPacketId::FrameEnd):
442 if (bFrameFound)
443 bExitLoop = true;
444 break;
445
446 // unknown packet, just skip
447 default:
448 // skip packet
449 SkipPacket();
450 break;
451
452 }
453 }
454
455 // update all positions
456 if (Enabled && bFrameFound)
457 {
458 UpdatePositions(Per, Time);
459 UpdateWheels(Per);
460 }
461
462 // save current time
463 CurrentTime = NewTime;
464
465 // stop replay?
466 if (CurrentTime >= TimeToStop)
467 {
468 // keep actors in scene and let them continue with autopilot
469 Stop(true);
470 }
471}
472
474{
476 VisualTime.Read(File);
477
478 // set the visual time
480}
481
483{
484 uint16_t i, Total;
486
487 // process creation events
489 for (i = 0; i < Total; ++i)
490 {
491 EventAdd.Read(File);
492
493 // auto Result = CallbackEventAdd(
494 auto Result = Helper.ProcessReplayerEventAdd(
495 EventAdd.Location,
496 EventAdd.Rotation,
497 EventAdd.Description,
498 EventAdd.DatabaseId,
502
503 switch (Result.first)
504 {
505 // actor not created
506 case 0:
507 UE_LOG(LogCarla, Log, TEXT("actor could not be created"));
508 break;
509
510 // actor created but with different id
511 case 1:
512 // mapping id (recorded Id is a new Id in replayer)
513 MappedId[EventAdd.DatabaseId] = Result.second;
514 SpawnedIds.insert(Result.second);
515 break;
516
517 // actor reused from existing
518 case 2:
519 // mapping id (say desired Id is mapped to what)
520 MappedId[EventAdd.DatabaseId] = Result.second;
521 break;
522
523 // actor ignored (either Hero or Spectator)
524 case 3:
525 UE_LOG(LogCarla, Log, TEXT("ignoring actor from replayer (Hero or Spectator)"));
526 break;
527
528 }
529
530 // check to mark if actor is a hero vehicle or not
531 if (Result.first > 0 && Result.first < 3)
532 {
533 // init
534 IsHeroMap[Result.second] = false;
535 for (const auto &Item : EventAdd.Description.Attributes)
536 {
537 if (Item.Id == "role_name" && Item.Value == "hero")
538 {
539 // mark as hero
540 IsHeroMap[Result.second] = true;
541 break;
542 }
543 }
544 }
545 }
546}
547
549{
550 uint16_t i, Total;
552
553 // process destroy events
555 for (i = 0; i < Total; ++i)
556 {
557 EventDel.Read(File);
559 SpawnedIds.erase(MappedId[EventDel.DatabaseId]);
560 MappedId.erase(EventDel.DatabaseId);
561 }
562}
563
565{
566 uint16_t i, Total;
568 std::stringstream Info;
569
570 // process parenting events
572 for (i = 0; i < Total; ++i)
573 {
574 EventParent.Read(File);
576 }
577}
578
580{
581 uint16_t i, Total;
582 CarlaRecorderStateTrafficLight StateTrafficLight;
583 std::stringstream Info;
584
585 // read Total traffic light states
587 for (i = 0; i < Total; ++i)
588 {
589 StateTrafficLight.Read(File);
590
591 StateTrafficLight.DatabaseId = MappedId[StateTrafficLight.DatabaseId];
592 if (!Helper.ProcessReplayerStateTrafficLight(StateTrafficLight))
593 {
594 UE_LOG(LogCarla,
595 Log,
596 TEXT("callback state traffic light %d called but didn't work"),
597 StateTrafficLight.DatabaseId);
598 }
599 }
600}
601
603{
604 uint16_t i, Total;
606 std::stringstream Info;
607
608 // read Total Vehicles
610 for (i = 0; i < Total; ++i)
611 {
612 Vehicle.Read(File);
613 Vehicle.DatabaseId = MappedId[Vehicle.DatabaseId];
614 // check if ignore this actor
615 if (!(IgnoreHero && IsHeroMap[Vehicle.DatabaseId]))
616 {
618 }
619 }
620}
621
623{
624 uint16_t i, Total;
625
626 // save current as previous
627 PrevWheels = std::move(CurrWheels);
628
629 // read Total Vehicles
631 CurrWheels.clear();
632 CurrWheels.reserve(Total);
633 for (i = 0; i < Total; ++i)
634 {
636 Vehicle.Read(File);
637 Vehicle.DatabaseId = MappedId[Vehicle.DatabaseId];
638 CurrWheels.push_back(std::move(Vehicle));
639 }
640
641 if (IsFirstTime)
642 {
643 PrevWheels.clear();
644 }
645}
646
648{
649 uint16_t i, Total;
651 std::stringstream Info;
652
653 // read Total walkers
655 for (i = 0; i < Total; ++i)
656 {
657 Walker.Read(File);
658 Walker.DatabaseId = MappedId[Walker.DatabaseId];
659 // check if ignore this actor
660 if (!(IgnoreHero && IsHeroMap[Walker.DatabaseId]))
661 {
663 }
664 }
665}
666
668{
669 uint16_t i, Total;
671 std::stringstream Info;
672
674 for (i = 0; i < Total; ++i)
675 {
676 Biker.Read(File);
677 Biker.DatabaseId = MappedId[Biker.DatabaseId];
678 if (!(IgnoreHero && IsHeroMap[Biker.DatabaseId]))
679 {
681 }
682 }
683}
684
686{
687 uint16_t Total;
688 CarlaRecorderLightVehicle LightVehicle;
689
690 // read Total walkers
692 for (uint16_t i = 0; i < Total; ++i)
693 {
694 LightVehicle.Read(File);
695 LightVehicle.DatabaseId = MappedId[LightVehicle.DatabaseId];
696 // check if ignore this actor
697 if (!(IgnoreHero && IsHeroMap[LightVehicle.DatabaseId]))
698 {
700 }
701 }
702}
703
705{
706 uint16_t Total;
707 CarlaRecorderDoorVehicle DoorVehicle;
708
709 // read Total walkers
711 for (uint16_t i = 0; i < Total; ++i)
712 {
713 DoorVehicle.Read(File);
714 DoorVehicle.DatabaseId = MappedId[DoorVehicle.DatabaseId];
715 // check if ignore this actor
716 if (!(IgnoreHero && IsHeroMap[DoorVehicle.DatabaseId]))
717 {
719 }
720 }
721}
722
724{
725 uint16_t Total;
727
728 // read Total weathers
730 for (uint16_t i = 0; i < Total; ++i)
731 {
732 Weather.Read(File);
733 if (bReplayWeather)
734 {
736 }
737 }
738}
739
741{
742 uint16_t Total;
743 CarlaRecorderLightScene LightScene;
744
745 // read Total light events
747 for (uint16_t i = 0; i < Total; ++i)
748 {
749 LightScene.Read(File);
751 }
752}
753
755{
756 uint16_t i, Total;
757
758 // save current as previous
759 PrevPos = std::move(CurrPos);
760
761 // read all positions
763 CurrPos.clear();
764 CurrPos.reserve(Total);
765 for (i = 0; i < Total; ++i)
766 {
768 Pos.Read(File);
769 // assign mapped Id
770 auto NewId = MappedId.find(Pos.DatabaseId);
771 if (NewId != MappedId.end())
772 {
773 Pos.DatabaseId = NewId->second;
774 }
775 else
776 UE_LOG(LogCarla, Log, TEXT("Actor not found when trying to move from replayer (id. %d)"), Pos.DatabaseId);
777 CurrPos.push_back(std::move(Pos));
778 }
779
780 // check to copy positions the first time
781 if (IsFirstTime)
782 {
783 PrevPos.clear();
784 }
785}
786
788{
789 uint16_t i, Total;
791 std::stringstream Info;
792
793 // read Total walkers
795 for (i = 0; i < Total; ++i)
796 {
797 Walker.Read(File);
798 Walker.DatabaseId = MappedId[Walker.DatabaseId];
799 // check if ignore this actor
800 if (!(IgnoreHero && IsHeroMap[Walker.DatabaseId]))
801 {
803 }
804 }
805}
806
807void CarlaReplayer::UpdatePositions(double Per, double DeltaTime)
808{
809 unsigned int i;
810 uint32_t NewFollowId = 0;
811 std::unordered_map<int, int> TempMap;
812
813 // map the id of all previous positions to its index
814 for (i = 0; i < PrevPos.size(); ++i)
815 {
816 TempMap[PrevPos[i].DatabaseId] = i;
817 }
818
819 // get the Id of the actor to follow
820 if (FollowId != 0)
821 {
822 auto NewId = MappedId.find(FollowId);
823 if (NewId != MappedId.end())
824 {
825 NewFollowId = NewId->second;
826 }
827 }
828
829 // go through each actor and update
830 for (auto &Pos : CurrPos)
831 {
832 // check if ignore this actor (hero) or the spectator (id == 1)
833 if (!(IgnoreHero && IsHeroMap[Pos.DatabaseId]) &&
834 !(IgnoreSpectator && Pos.DatabaseId == 1))
835 {
836 // check if exist a previous position
837 auto Result = TempMap.find(Pos.DatabaseId);
838 if (Result != TempMap.end())
839 {
840 // check if time factor is high
841 if (TimeFactor >= 2.0)
842 // assign first position
843 InterpolatePosition(PrevPos[Result->second], Pos, 0.0, DeltaTime);
844 else
845 // interpolate
846 InterpolatePosition(PrevPos[Result->second], Pos, Per, DeltaTime);
847 }
848 else
849 {
850 // assign last position (we don't have previous one)
851 InterpolatePosition(Pos, Pos, 0.0, DeltaTime);
852 }
853 }
854 }
855
856 // move the camera to follow the desired actor
857 if (NewFollowId != 0)
858 {
859 Helper.SetCameraPosition(NewFollowId, FollowOffset.GetTranslation(), FollowOffset.GetRotation());
860 }
861}
862
864{
865 std::unordered_map<uint32_t, const CarlaRecorderAnimWheels *> PrevWheelsById;
866 for (const CarlaRecorderAnimWheels &Wheels : PrevWheels)
867 {
868 PrevWheelsById[Wheels.DatabaseId] = &Wheels;
869 }
870 std::unordered_map<uint32_t, const CarlaRecorderPosition *> PrevPosById, CurrPosById;
871 for (const CarlaRecorderPosition &Pos : PrevPos)
872 {
873 PrevPosById[Pos.DatabaseId] = &Pos;
874 }
875 for (const CarlaRecorderPosition &Pos : CurrPos)
876 {
877 CurrPosById[Pos.DatabaseId] = &Pos;
878 }
879
880 for (const CarlaRecorderAnimWheels &Wheels : CurrWheels)
881 {
882 // check if ignore this actor
883 if (IgnoreHero && IsHeroMap[Wheels.DatabaseId])
884 {
885 continue;
886 }
887 auto Prev = PrevWheelsById.find(Wheels.DatabaseId);
888 if (Prev == PrevWheelsById.end())
889 {
890 // assign last wheels (we don't have previous ones)
891 Helper.ProcessReplayerAnimVehicleWheels(Wheels, Wheels, 0.0, 0.0f);
892 continue;
893 }
894 // how far the body moves between the two frames, which says how far the
895 // wheels turn
896 float Travel = 0.0f;
897 auto Pos1 = PrevPosById.find(Wheels.DatabaseId);
898 auto Pos2 = CurrPosById.find(Wheels.DatabaseId);
899 if (Pos1 != PrevPosById.end() && Pos2 != CurrPosById.end())
900 {
901 const FVector Forward = FRotator::MakeFromEuler(Pos1->second->Rotation).Vector();
902 Travel = FVector::DotProduct(Pos2->second->Location - Pos1->second->Location, Forward);
903 }
904 // like the positions, no interpolation if time factor is high
905 Helper.ProcessReplayerAnimVehicleWheels(*Prev->second, Wheels, TimeFactor >= 2.0 ? 0.0 : Per, Travel);
906 }
907}
908
909// interpolate a position (transform, velocity...)
911 const CarlaRecorderPosition &Pos1,
912 const CarlaRecorderPosition &Pos2,
913 double Per,
914 double DeltaTime)
915{
916 // call the callback
917 Helper.ProcessReplayerPosition(Pos1, Pos2, Per, DeltaTime);
918}
919
920// tick for the replayer
921void CarlaReplayer::Tick(float Delta)
922{
923 TRACE_CPUPROFILER_EVENT_SCOPE(CarlaReplayer::Tick);
924 // check if there are events to process
925 if (Enabled)
926 {
927 ProcessToTime(Delta * TimeFactor, false);
928 }
929}
std::string GetRecorderFilename(std::string Filename)
void ReadValue(std::istream &InFile, T &OutObj)
void ProcessReplayerWalkerBones(const CarlaRecorderWalkerBones &Walker)
bool ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map< uint32_t, bool > &IsHero)
void ProcessReplayerAnimVehicleWheels(const CarlaRecorderAnimWheels &Wheels1, const CarlaRecorderAnimWheels &Wheels2, double Per, float Travel)
void ProcessReplayerLightScene(CarlaRecorderLightScene LightScene)
void ProcessReplayerDoorVehicle(CarlaRecorderDoorVehicle DoorVehicle)
void ProcessReplayerAnimWalker(CarlaRecorderAnimWalker Walker)
bool ProcessReplayerStateTrafficLight(CarlaRecorderStateTrafficLight State)
bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId)
void ProcessReplayerAnimVehicle(CarlaRecorderAnimVehicle Vehicle)
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)
void ProcessEventsDel(void)
void ProcessDoorVehicle(void)
std::vector< CarlaRecorderPosition > PrevPos
FTransform FollowOffset
void Rewind(void)
void ProcessVisualTime(void)
void ProcessLightVehicle(void)
double GetTotalTime(void)
std::vector< CarlaRecorderPosition > CurrPos
std::vector< CarlaRecorderAnimWheels > PrevWheels
void InterpolatePosition(const CarlaRecorderPosition &Start, const CarlaRecorderPosition &End, double Per, double DeltaTime)
void ProcessAnimVehicle(void)
void ProcessWalkerBones(void)
void Tick(float Time)
void ProcessPositions(bool IsFirstTime=false)
void ProcessEventsParent(void)
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 ProcessWeather(void)
void UpdatePositions(double Per, double DeltaTime)
uint32_t FollowId
void ProcessEventsAdd(void)
void DestroySpawnedActors(void)
Destroys the actors this replayer spawned that are still alive, even when the replay already ended by...
static PlayAfterLoadMap Autoplay
std::ifstream File
UCarlaEpisode * Episode
void UpdateWheels(double Per)
CarlaRecorderFrame Frame
void ProcessAnimWalker(void)
void ProcessStates(void)
void ProcessAnimBiker(void)
std::vector< CarlaRecorderAnimWheels > CurrWheels
CarlaRecorderInfo RecInfo
CarlaReplayerHelper Helper
void ProcessLightScene(void)
std::unordered_set< uint32_t > SpawnedIds
void CheckPlayAfterMapLoaded(void)
std::unordered_map< uint32_t, bool > IsHeroMap
void ProcessToTime(double Time, bool IsFirstTime=false)
std::unordered_map< uint32_t, uint32_t > MappedId
void Stop(bool KeepActors=false)
void ProcessAnimVehicleWheels(bool IsFirstTime=false)
const FString & GetMapName() const
void SetVisualGameTime(double Time)
bool LoadNewEpisode(const FString &MapString, bool ResetSettings=true)
Load a new map and start a new episode.
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &File)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::ifstream &InFile)