62 File.seekg(0, std::ios::beg);
78 std::streampos Current =
File.tellg();
102 File.seekg(Current, std::ios::beg);
107 uint32_t ThisFollowId,
bool ReplaySensors)
109 std::stringstream Info;
121 Info <<
"Replaying File: " << Filename2 << std::endl;
124 File.open(Filename2, std::ios::binary);
127 Info <<
"File " << Filename2 <<
" not found on server\n";
140 Info <<
"Could not load mapfile " << TCHAR_TO_UTF8(*
RecInfo.
Mapfile) << std::endl;
144 Info <<
"Loading map " << TCHAR_TO_UTF8(*
RecInfo.
Mapfile) << std::endl;
145 Info <<
"Replayer will start after map is loaded..." << std::endl;
160 Info <<
"Total time recorded: " <<
TotalTime << std::endl;
163 if (TimeStart < 0.0f)
166 if (TimeStart < 0.0f)
176 Info <<
"Replaying from " << TimeStart <<
" s - " <<
TimeToStop <<
" s (" <<
TotalTime <<
" s) at " <<
177 std::setprecision(1) << std::fixed <<
TimeFactor <<
"x" << std::endl;
180 Info <<
"Ignoring Hero vehicle" << std::endl;
183 Info <<
"Ignoring Spectator camera" << std::endl;
233 if (TimeStart < 0.0f)
236 if (TimeStart < 0.0f)
267 bool bFrameFound =
false;
268 bool bExitAtNextFrame =
false;
269 bool bExitLoop =
false;
280 while (!
File.eof() && !bExitLoop)
444 ReadValue<uint16_t>(
File, Total);
445 for (i = 0; i < Total; ++i)
459 switch (Result.first)
463 UE_LOG(LogCarla, Log, TEXT(
"actor could not be created"));
480 UE_LOG(LogCarla, Log, TEXT(
"ignoring actor from replayer (Hero or Spectator)"));
486 if (Result.first > 0 && Result.first < 3)
492 if (Item.Id ==
"role_name" && Item.Value ==
"hero")
509 ReadValue<uint16_t>(
File, Total);
510 for (i = 0; i < Total; ++i)
522 std::stringstream Info;
525 ReadValue<uint16_t>(
File, Total);
526 for (i = 0; i < Total; ++i)
528 EventParent.
Read(File);
537 std::stringstream Info;
540 ReadValue<uint16_t>(
File, Total);
541 for (i = 0; i < Total; ++i)
543 StateTrafficLight.
Read(File);
550 TEXT(
"callback state traffic light %d called but didn't work"),
560 std::stringstream Info;
563 ReadValue<uint16_t>(
File, Total);
564 for (i = 0; i < Total; ++i)
581 ReadValue<uint16_t>(
File, Total);
582 for (i = 0; i < Total; ++i)
599 std::stringstream Info;
602 ReadValue<uint16_t>(
File, Total);
603 for (i = 0; i < Total; ++i)
619 std::stringstream Info;
621 ReadValue<uint16_t>(
File, Total);
622 for (i = 0; i < Total; ++i)
639 ReadValue<uint16_t>(
File, Total);
640 for (uint16_t i = 0; i < Total; ++i)
642 LightVehicle.
Read(File);
658 ReadValue<uint16_t>(
File, Total);
659 for (uint16_t i = 0; i < Total; ++i)
661 LightScene.
Read(File);
674 ReadValue<uint16_t>(
File, Total);
677 for (i = 0; i < Total; ++i)
688 UE_LOG(LogCarla, Log, TEXT(
"Actor not found when trying to move from replayer (id. %d)"), Pos.
DatabaseId);
689 CurrPos.push_back(std::move(Pos));
703 std::stringstream Info;
706 ReadValue<uint16_t>(
File, Total);
707 for (i = 0; i < Total; ++i)
722 uint32_t NewFollowId = 0;
723 std::unordered_map<int, int> TempMap;
726 for (i = 0; i <
PrevPos.size(); ++i)
728 TempMap[
PrevPos[i].DatabaseId] = i;
737 NewFollowId = NewId->second;
749 auto Result = TempMap.find(Pos.DatabaseId);
750 if (Result != TempMap.end())
768 if (NewFollowId != 0)
770 if (NewFollowId == Pos.DatabaseId)
void CheckPlayAfterMapLoaded(void)
void ProcessLightScene(void)
void ProcessReplayerAnimBiker(CarlaRecorderAnimBiker Biker)
double GetTotalTime(void)
void ProcessWalkerBones(void)
void ProcessLightVehicle(void)
void ProcessReplayerLightVehicle(CarlaRecorderLightVehicle LightVehicle)
void ProcessReplayerAnimVehicle(CarlaRecorderAnimVehicle Vehicle)
void ProcessAnimVehicleWheels(void)
void Read(std::istream &InFile)
void ProcessAnimWalker(void)
CarlaReplayerHelper Helper
void Read(std::istream &InFile)
bool ProcessReplayerStateTrafficLight(CarlaRecorderStateTrafficLight State)
void ProcessAnimBiker(void)
void ProcessReplayerAnimVehicleWheels(CarlaRecorderAnimWheels Vehicle)
void Read(std::istream &InFile)
std::pair< int, uint32_t > ProcessReplayerEventAdd(FVector Location, FVector Rotation, CarlaRecorderActorDescription Description, uint32_t DesiredId, bool bIgnoreHero, bool bIgnoreSpectator, bool ReplaySensors)
void ProcessReplayerWalkerBones(const CarlaRecorderWalkerBones &Walker)
void InterpolatePosition(const CarlaRecorderPosition &Start, const CarlaRecorderPosition &End, double Per, double DeltaTime)
void ProcessAnimVehicle(void)
void ProcessPositions(bool IsFirstTime=false)
void ProcessEventsAdd(void)
void Read(std::istream &InFile)
void ProcessToTime(double Time, bool IsFirstTime=false)
std::unordered_map< uint32_t, bool > IsHeroMap
std::unordered_map< uint32_t, uint32_t > MappedId
const FString & GetMapName() const
Return the name of the map loaded in this episode.
void Read(std::ifstream &InFile)
std::vector< CarlaRecorderPosition > CurrPos
void ProcessReplayerLightScene(CarlaRecorderLightScene LightScene)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
void Read(std::istream &InFile)
bool ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map< uint32_t, bool > &IsHero)
bool LoadNewEpisode(const FString &MapString, bool ResetSettings=true)
Load a new map and start a new episode.
void Read(std::istream &File)
void Read(std::istream &InFile)
std::vector< CarlaRecorderActorAttribute > Attributes
CarlaRecorderInfo RecInfo
bool ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime)
void ProcessVisualTime(void)
bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId)
void Read(std::istream &InFile)
std::string ReplayFile(std::string Filename, double TimeStart=0.0f, double Duration=0.0f, uint32_t FollowId=0, bool ReplaySensors=false)
uint32_t DatabaseIdParent
void UpdatePositions(double Per, double DeltaTime)
std::vector< CarlaRecorderPosition > PrevPos
void Read(std::ifstream &InFile)
std::string GetRecorderFilename(std::string Filename)
void Stop(bool KeepActors=false)
bool ProcessReplayerEventDel(uint32_t DatabaseId)
static PlayAfterLoadMap Autoplay
void SetVisualGameTime(double Time)
void Read(std::istream &InFile)
void ProcessEventsDel(void)
void ProcessEventsParent(void)
bool SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation)
void Read(std::istream &InFile)
CarlaRecorderActorDescription Description
void Read(std::istream &InFile)
void ProcessReplayerAnimWalker(CarlaRecorderAnimWalker Walker)