61 File.seekg(0, std::ios::beg);
77 std::streampos Current =
File.tellg();
101 File.seekg(Current, std::ios::beg);
106 uint32_t ThisFollowId,
bool ReplaySensors)
108 std::stringstream Info;
120 Info <<
"Replaying File: " << Filename2 << std::endl;
123 File.open(Filename2, std::ios::binary);
126 Info <<
"File " << Filename2 <<
" not found on server\n";
139 Info <<
"Could not load mapfile " << TCHAR_TO_UTF8(*
RecInfo.
Mapfile) << std::endl;
143 Info <<
"Loading map " << TCHAR_TO_UTF8(*
RecInfo.
Mapfile) << std::endl;
144 Info <<
"Replayer will start after map is loaded..." << std::endl;
159 Info <<
"Total time recorded: " <<
TotalTime << std::endl;
162 if (TimeStart < 0.0f)
165 if (TimeStart < 0.0f)
175 Info <<
"Replaying from " << TimeStart <<
" s - " <<
TimeToStop <<
" s (" <<
TotalTime <<
" s) at " <<
176 std::setprecision(1) << std::fixed <<
TimeFactor <<
"x" << std::endl;
226 if (TimeStart < 0.0f)
229 if (TimeStart < 0.0f)
260 bool bFrameFound =
false;
261 bool bExitAtNextFrame =
false;
262 bool bExitLoop =
false;
273 while (!
File.eof() && !bExitLoop)
421 ReadValue<uint16_t>(
File, Total);
422 for (i = 0; i < Total; ++i)
435 switch (Result.first)
439 UE_LOG(LogCarla, Log, TEXT(
"actor could not be created"));
456 if (Result.first > 0)
462 if (Item.Id ==
"role_name" && Item.Value ==
"hero")
479 ReadValue<uint16_t>(
File, Total);
480 for (i = 0; i < Total; ++i)
492 std::stringstream Info;
495 ReadValue<uint16_t>(
File, Total);
496 for (i = 0; i < Total; ++i)
498 EventParent.
Read(File);
507 std::stringstream Info;
510 ReadValue<uint16_t>(
File, Total);
511 for (i = 0; i < Total; ++i)
513 StateTrafficLight.
Read(File);
520 TEXT(
"callback state traffic light %d called but didn't work"),
530 std::stringstream Info;
533 ReadValue<uint16_t>(
File, Total);
534 for (i = 0; i < Total; ++i)
550 std::stringstream Info;
553 ReadValue<uint16_t>(
File, Total);
554 for (i = 0; i < Total; ++i)
572 ReadValue<uint16_t>(
File, Total);
573 for (uint16_t i = 0; i < Total; ++i)
575 LightVehicle.
Read(File);
591 ReadValue<uint16_t>(
File, Total);
592 for (uint16_t i = 0; i < Total; ++i)
594 LightScene.
Read(File);
607 ReadValue<uint16_t>(
File, Total);
610 for (i = 0; i < Total; ++i)
621 UE_LOG(LogCarla, Log, TEXT(
"Actor not found when trying to move from replayer (id. %d)"), Pos.
DatabaseId);
622 CurrPos.push_back(std::move(Pos));
636 std::stringstream Info;
639 ReadValue<uint16_t>(
File, Total);
640 for (i = 0; i < Total; ++i)
655 uint32_t NewFollowId = 0;
656 std::unordered_map<int, int> TempMap;
659 for (i = 0; i <
PrevPos.size(); ++i)
661 TempMap[
PrevPos[i].DatabaseId] = i;
670 NewFollowId = NewId->second;
681 auto Result = TempMap.find(Pos.DatabaseId);
682 if (Result != TempMap.end())
700 if (NewFollowId != 0)
702 if (NewFollowId == Pos.DatabaseId)
void CheckPlayAfterMapLoaded(void)
void ProcessLightScene(void)
double GetTotalTime(void)
void ProcessWalkerBones(void)
void ProcessLightVehicle(void)
void ProcessReplayerLightVehicle(CarlaRecorderLightVehicle LightVehicle)
void ProcessReplayerAnimVehicle(CarlaRecorderAnimVehicle Vehicle)
void Read(std::istream &InFile)
void ProcessAnimWalker(void)
CarlaReplayerHelper Helper
void Read(std::istream &InFile)
bool ProcessReplayerStateTrafficLight(CarlaRecorderStateTrafficLight State)
void Read(std::istream &InFile)
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)
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.
std::pair< int, uint32_t > ProcessReplayerEventAdd(FVector Location, FVector Rotation, CarlaRecorderActorDescription Description, uint32_t DesiredId, bool bIgnoreHero, bool ReplaySensors)
void Read(std::istream &File)
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)