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)
452 ReadValue<uint16_t>(
File, Total);
453 for (i = 0; i < Total; ++i)
467 switch (Result.first)
471 UE_LOG(LogCarla, Log, TEXT(
"actor could not be created"));
488 UE_LOG(LogCarla, Log, TEXT(
"ignoring actor from replayer (Hero or Spectator)"));
494 if (Result.first > 0 && Result.first < 3)
498 for (
const auto &Item :
EventAdd.Description.Attributes)
500 if (Item.Id ==
"role_name" && Item.Value ==
"hero")
517 ReadValue<uint16_t>(
File, Total);
518 for (i = 0; i < Total; ++i)
530 std::stringstream Info;
533 ReadValue<uint16_t>(
File, Total);
534 for (i = 0; i < Total; ++i)
545 std::stringstream Info;
548 ReadValue<uint16_t>(
File, Total);
549 for (i = 0; i < Total; ++i)
558 TEXT(
"callback state traffic light %d called but didn't work"),
568 std::stringstream Info;
571 ReadValue<uint16_t>(
File, Total);
572 for (i = 0; i < Total; ++i)
589 ReadValue<uint16_t>(
File, Total);
590 for (i = 0; i < Total; ++i)
607 std::stringstream Info;
610 ReadValue<uint16_t>(
File, Total);
611 for (i = 0; i < Total; ++i)
627 std::stringstream Info;
629 ReadValue<uint16_t>(
File, Total);
630 for (i = 0; i < Total; ++i)
647 ReadValue<uint16_t>(
File, Total);
648 for (uint16_t i = 0; i < Total; ++i)
666 ReadValue<uint16_t>(
File, Total);
667 for (uint16_t i = 0; i < Total; ++i)
685 ReadValue<uint16_t>(
File, Total);
686 for (uint16_t i = 0; i < Total; ++i)
701 ReadValue<uint16_t>(
File, Total);
704 for (i = 0; i < Total; ++i)
715 UE_LOG(LogCarla, Log, TEXT(
"Actor not found when trying to move from replayer (id. %d)"), Pos.
DatabaseId);
716 CurrPos.push_back(std::move(Pos));
730 std::stringstream Info;
733 ReadValue<uint16_t>(
File, Total);
734 for (i = 0; i < Total; ++i)
749 uint32_t NewFollowId = 0;
750 std::unordered_map<int, int> TempMap;
753 for (i = 0; i <
PrevPos.size(); ++i)
755 TempMap[
PrevPos[i].DatabaseId] = i;
764 NewFollowId = NewId->second;
776 auto Result = TempMap.find(Pos.DatabaseId);
777 if (Result != TempMap.end())
795 if (NewFollowId != 0)
797 if (NewFollowId == Pos.DatabaseId)
std::string GetRecorderFilename(std::string Filename)
void ProcessReplayerWalkerBones(const CarlaRecorderWalkerBones &Walker)
bool ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map< uint32_t, bool > &IsHero)
void ProcessReplayerAnimVehicleWheels(CarlaRecorderAnimWheels Vehicle)
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 ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime, bool bIgnoreSpectator)
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 SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation)
void ProcessEventsDel(void)
void ProcessDoorVehicle(void)
std::vector< CarlaRecorderPosition > PrevPos
void ProcessVisualTime(void)
void ProcessLightVehicle(void)
double GetTotalTime(void)
std::vector< CarlaRecorderPosition > CurrPos
void ProcessAnimVehicleWheels(void)
void InterpolatePosition(const CarlaRecorderPosition &Start, const CarlaRecorderPosition &End, double Per, double DeltaTime)
void ProcessAnimVehicle(void)
std::string ReplayFile(std::string Filename, double TimeStart=0.0f, double Duration=0.0f, uint32_t FollowId=0, bool ReplaySensors=false)
void ProcessWalkerBones(void)
void ProcessPositions(bool IsFirstTime=false)
void ProcessEventsParent(void)
void UpdatePositions(double Per, double DeltaTime)
void ProcessEventsAdd(void)
static PlayAfterLoadMap Autoplay
void ProcessAnimWalker(void)
void ProcessAnimBiker(void)
CarlaRecorderInfo RecInfo
CarlaReplayerHelper Helper
void ProcessLightScene(void)
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)
const FString & GetMapName() const
Return the name of the map loaded in this episode.
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 &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)
void Read(std::ifstream &InFile)