CARLA
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
CarlaReplayer Class Reference

#include <CarlaReplayer.h>

+ Collaboration diagram for CarlaReplayer:

Classes

struct  Header
 
struct  PlayAfterLoadMap
 

Public Member Functions

 CarlaReplayer ()
 
void CheckPlayAfterMapLoaded (void)
 
void Disable (void)
 
void Enable (void)
 
bool IsEnabled (void)
 
std::string ReplayFile (std::string Filename, double TimeStart=0.0f, double Duration=0.0f, uint32_t FollowId=0, bool ReplaySensors=false)
 
void SetEpisode (UCarlaEpisode *ThisEpisode)
 
void SetIgnoreHero (bool InIgnoreHero)
 
void SetTimeFactor (double NewTimeFactor)
 
void Stop (bool KeepActors=false)
 
void Tick (float Time)
 
 ~CarlaReplayer ()
 

Static Public Attributes

static PlayAfterLoadMap Autoplay { false, "", "", 0.0, 0.0, 0, 1.0, false }
 

Private Member Functions

double GetTotalTime (void)
 
void InterpolatePosition (const CarlaRecorderPosition &Start, const CarlaRecorderPosition &End, double Per, double DeltaTime)
 
void ProcessAnimVehicle (void)
 
void ProcessAnimWalker (void)
 
void ProcessEventsAdd (void)
 
void ProcessEventsDel (void)
 
void ProcessEventsParent (void)
 
void ProcessLightScene (void)
 
void ProcessLightVehicle (void)
 
void ProcessPositions (bool IsFirstTime=false)
 
void ProcessStates (void)
 
void ProcessToTime (double Time, bool IsFirstTime=false)
 
bool ReadHeader ()
 
void Rewind (void)
 
void SkipPacket ()
 
void UpdatePositions (double Per, double DeltaTime)
 

Private Attributes

bool bReplaySensors = false
 
double CurrentTime
 
std::vector< CarlaRecorderPositionCurrPos
 
bool Enabled
 
UCarlaEpisodeEpisode = nullptr
 
std::ifstream File
 
uint32_t FollowId
 
CarlaRecorderFrame Frame
 
Header Header
 
CarlaReplayerHelper Helper
 
bool IgnoreHero { false }
 
std::unordered_map< uint32_t, bool > IsHeroMap
 
std::unordered_map< uint32_t, uint32_t > MappedId
 
std::vector< CarlaRecorderPositionPrevPos
 
CarlaRecorderInfo RecInfo
 
double TimeFactor { 1.0 }
 
double TimeToStop
 
double TotalTime
 

Detailed Description

Definition at line 27 of file CarlaReplayer.h.

Constructor & Destructor Documentation

◆ CarlaReplayer()

CarlaReplayer::CarlaReplayer ( )
inline

Definition at line 52 of file CarlaReplayer.h.

◆ ~CarlaReplayer()

CarlaReplayer::~CarlaReplayer ( )
inline

Definition at line 53 of file CarlaReplayer.h.

References Disable(), Enable(), FollowId, ReplayFile(), and Stop().

+ Here is the call graph for this function:

Member Function Documentation

◆ CheckPlayAfterMapLoaded()

void CarlaReplayer::CheckPlayAfterMapLoaded ( void  )

Definition at line 195 of file CarlaReplayer.cpp.

References Autoplay, bReplaySensors, CarlaReplayer::PlayAfterLoadMap::Duration, CarlaReplayer::PlayAfterLoadMap::Enabled, Enabled, File, CarlaReplayer::PlayAfterLoadMap::Filename, CarlaReplayer::PlayAfterLoadMap::FollowId, FollowId, GetTotalTime(), Helper, ProcessToTime(), CarlaReplayerHelper::RemoveStaticProps(), CarlaReplayer::PlayAfterLoadMap::ReplaySensors, Rewind(), Stop(), CarlaReplayer::PlayAfterLoadMap::TimeFactor, TimeFactor, CarlaReplayer::PlayAfterLoadMap::TimeStart, TimeToStop, and TotalTime.

Referenced by ACarlaGameModeBase::BeginPlay(), FCarlaEngine::NotifyBeginEpisode(), and SetIgnoreHero().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Disable()

void CarlaReplayer::Disable ( void  )

Referenced by ~CarlaReplayer().

+ Here is the caller graph for this function:

◆ Enable()

void CarlaReplayer::Enable ( void  )

Referenced by ~CarlaReplayer().

+ Here is the caller graph for this function:

◆ GetTotalTime()

double CarlaReplayer::GetTotalTime ( void  )
private

Definition at line 75 of file CarlaReplayer.cpp.

References CarlaRecorderFrame::Elapsed, File, Frame, FrameStart, CarlaReplayer::Header::Id, CarlaRecorderFrame::Read(), ReadHeader(), and SkipPacket().

Referenced by CheckPlayAfterMapLoaded(), and ReplayFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InterpolatePosition()

void CarlaReplayer::InterpolatePosition ( const CarlaRecorderPosition Start,
const CarlaRecorderPosition End,
double  Per,
double  DeltaTime 
)
private

Definition at line 667 of file CarlaReplayer.cpp.

References Helper, and CarlaReplayerHelper::ProcessReplayerPosition().

Referenced by UpdatePositions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsEnabled()

bool CarlaReplayer::IsEnabled ( void  )
inline

Definition at line 65 of file CarlaReplayer.h.

References Enabled.

Referenced by UCarlaEpisode::EndPlay(), ACarlaRecorder::Start(), and ACarlaRecorder::Ticking().

+ Here is the caller graph for this function:

◆ ProcessAnimVehicle()

void CarlaReplayer::ProcessAnimVehicle ( void  )
private

Definition at line 504 of file CarlaReplayer.cpp.

References CarlaRecorderAnimVehicle::DatabaseId, File, Helper, IgnoreHero, IsHeroMap, MappedId, CarlaReplayerHelper::ProcessReplayerAnimVehicle(), CarlaRecorderAnimVehicle::Read(), and Vehicle.

Referenced by ProcessToTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessAnimWalker()

void CarlaReplayer::ProcessAnimWalker ( void  )
private

Definition at line 524 of file CarlaReplayer.cpp.

References CarlaRecorderAnimWalker::DatabaseId, File, Helper, IgnoreHero, IsHeroMap, MappedId, CarlaReplayerHelper::ProcessReplayerAnimWalker(), and CarlaRecorderAnimWalker::Read().

Referenced by ProcessToTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessEventsAdd()

void CarlaReplayer::ProcessEventsAdd ( void  )
private

Definition at line 393 of file CarlaReplayer.cpp.

References CarlaRecorderActorDescription::Attributes, bReplaySensors, CarlaRecorderEventAdd::DatabaseId, CarlaRecorderEventAdd::Description, EventAdd, File, Helper, IgnoreHero, IsHeroMap, CarlaRecorderEventAdd::Location, MappedId, CarlaReplayerHelper::ProcessReplayerEventAdd(), CarlaRecorderEventAdd::Read(), and CarlaRecorderEventAdd::Rotation.

Referenced by ProcessToTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessEventsDel()

void CarlaReplayer::ProcessEventsDel ( void  )
private

Definition at line 451 of file CarlaReplayer.cpp.

References CarlaRecorderEventDel::DatabaseId, EventDel, File, Helper, MappedId, CarlaReplayerHelper::ProcessReplayerEventDel(), and CarlaRecorderEventDel::Read().

Referenced by ProcessToTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessEventsParent()

void CarlaReplayer::ProcessEventsParent ( void  )
private

Definition at line 466 of file CarlaReplayer.cpp.

References CarlaRecorderEventParent::DatabaseId, CarlaRecorderEventParent::DatabaseIdParent, EventParent, File, Helper, MappedId, CarlaReplayerHelper::ProcessReplayerEventParent(), and CarlaRecorderEventParent::Read().

Referenced by ProcessToTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessLightScene()

void CarlaReplayer::ProcessLightScene ( void  )
private

Definition at line 563 of file CarlaReplayer.cpp.

References File, Helper, CarlaReplayerHelper::ProcessReplayerLightScene(), and CarlaRecorderLightScene::Read().

Referenced by ProcessToTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessLightVehicle()

void CarlaReplayer::ProcessLightVehicle ( void  )
private

Definition at line 544 of file CarlaReplayer.cpp.

References CarlaRecorderLightVehicle::DatabaseId, File, Helper, IgnoreHero, IsHeroMap, MappedId, CarlaReplayerHelper::ProcessReplayerLightVehicle(), and CarlaRecorderLightVehicle::Read().

Referenced by ProcessToTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessPositions()

void CarlaReplayer::ProcessPositions ( bool  IsFirstTime = false)
private

Definition at line 577 of file CarlaReplayer.cpp.

References CurrPos, CarlaRecorderPosition::DatabaseId, File, MappedId, PrevPos, and CarlaRecorderPosition::Read().

Referenced by ProcessToTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessStates()

void CarlaReplayer::ProcessStates ( void  )
private

Definition at line 481 of file CarlaReplayer.cpp.

References CarlaRecorderStateTrafficLight::DatabaseId, File, Helper, MappedId, CarlaReplayerHelper::ProcessReplayerStateTrafficLight(), and CarlaRecorderStateTrafficLight::Read().

Referenced by ProcessToTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessToTime()

void CarlaReplayer::ProcessToTime ( double  Time,
bool  IsFirstTime = false 
)
private

Definition at line 256 of file CarlaReplayer.cpp.

References AnimVehicle, AnimWalker, Collision, CurrentTime, CarlaRecorderFrame::DurationThis, CarlaRecorderFrame::Elapsed, Enabled, EventAdd, EventDel, EventParent, File, Frame, FrameEnd, FrameStart, CarlaReplayer::Header::Id, Position, ProcessAnimVehicle(), ProcessAnimWalker(), ProcessEventsAdd(), ProcessEventsDel(), ProcessEventsParent(), ProcessLightScene(), ProcessLightVehicle(), ProcessPositions(), ProcessStates(), CarlaRecorderFrame::Read(), ReadHeader(), SceneLight, SkipPacket(), State, Stop(), TimeToStop, UpdatePositions(), and VehicleLight.

Referenced by CheckPlayAfterMapLoaded(), ReplayFile(), Stop(), and Tick().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadHeader()

bool CarlaReplayer::ReadHeader ( void  )
private

Definition at line 36 of file CarlaReplayer.cpp.

References File, CarlaReplayer::Header::Id, and CarlaReplayer::Header::Size.

Referenced by GetTotalTime(), and ProcessToTime().

+ Here is the caller graph for this function:

◆ ReplayFile()

std::string CarlaReplayer::ReplayFile ( std::string  Filename,
double  TimeStart = 0.0f,
double  Duration = 0.0f,
uint32_t  FollowId = 0,
bool  ReplaySensors = false 
)

◆ Rewind()

void CarlaReplayer::Rewind ( void  )
private

Definition at line 54 of file CarlaReplayer.cpp.

References CurrentTime, CarlaRecorderFrame::DurationThis, CarlaRecorderFrame::Elapsed, File, Frame, IsHeroMap, MappedId, CarlaRecorderInfo::Read(), RecInfo, TimeToStop, and TotalTime.

Referenced by CheckPlayAfterMapLoaded(), and ReplayFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetEpisode()

void CarlaReplayer::SetEpisode ( UCarlaEpisode ThisEpisode)
inline

Definition at line 71 of file CarlaReplayer.h.

References Episode, Helper, and CarlaReplayerHelper::SetEpisode().

+ Here is the call graph for this function:

◆ SetIgnoreHero()

void CarlaReplayer::SetIgnoreHero ( bool  InIgnoreHero)
inline

Definition at line 84 of file CarlaReplayer.h.

References CheckPlayAfterMapLoaded(), IgnoreHero, and Tick().

Referenced by ACarlaRecorder::SetReplayerIgnoreHero().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTimeFactor()

void CarlaReplayer::SetTimeFactor ( double  NewTimeFactor)
inline

Definition at line 78 of file CarlaReplayer.h.

References TimeFactor.

Referenced by ACarlaRecorder::SetReplayerTimeFactor().

+ Here is the caller graph for this function:

◆ SkipPacket()

void CarlaReplayer::SkipPacket ( void  )
private

Definition at line 49 of file CarlaReplayer.cpp.

References File, and CarlaReplayer::Header::Size.

Referenced by GetTotalTime(), and ProcessToTime().

+ Here is the caller graph for this function:

◆ Stop()

void CarlaReplayer::Stop ( bool  KeepActors = false)

Definition at line 17 of file CarlaReplayer.cpp.

References Enabled, File, Helper, IgnoreHero, IsHeroMap, CarlaReplayerHelper::ProcessReplayerFinish(), ProcessToTime(), and TotalTime.

Referenced by CheckPlayAfterMapLoaded(), UCarlaEpisode::EndPlay(), ProcessToTime(), ReplayFile(), ACarlaRecorder::Start(), ACarlaRecorder::StopReplayer(), and ~CarlaReplayer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Tick()

void CarlaReplayer::Tick ( float  Time)

Definition at line 678 of file CarlaReplayer.cpp.

References Enabled, ProcessToTime(), and TimeFactor.

Referenced by SetIgnoreHero(), and ACarlaRecorder::Ticking().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdatePositions()

void CarlaReplayer::UpdatePositions ( double  Per,
double  DeltaTime 
)
private

Definition at line 610 of file CarlaReplayer.cpp.

References CurrPos, FollowId, Helper, IgnoreHero, InterpolatePosition(), IsHeroMap, MappedId, PrevPos, CarlaReplayerHelper::SetCameraPosition(), and TimeFactor.

Referenced by ProcessToTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ Autoplay

CarlaReplayer::PlayAfterLoadMap CarlaReplayer::Autoplay { false, "", "", 0.0, 0.0, 0, 1.0, false }
static

Definition at line 50 of file CarlaReplayer.h.

Referenced by CheckPlayAfterMapLoaded(), and ReplayFile().

◆ bReplaySensors

bool CarlaReplayer::bReplaySensors = false
private

Definition at line 98 of file CarlaReplayer.h.

Referenced by CheckPlayAfterMapLoaded(), ProcessEventsAdd(), and ReplayFile().

◆ CurrentTime

double CarlaReplayer::CurrentTime
private

Definition at line 111 of file CarlaReplayer.h.

Referenced by ProcessToTime(), and Rewind().

◆ CurrPos

std::vector<CarlaRecorderPosition> CarlaReplayer::CurrPos
private

Definition at line 106 of file CarlaReplayer.h.

Referenced by ProcessPositions(), and UpdatePositions().

◆ Enabled

bool CarlaReplayer::Enabled
private

◆ Episode

UCarlaEpisode* CarlaReplayer::Episode = nullptr
private

Definition at line 99 of file CarlaReplayer.h.

Referenced by ReplayFile(), and SetEpisode().

◆ File

std::ifstream CarlaReplayer::File
private

◆ FollowId

uint32_t CarlaReplayer::FollowId
private

◆ Frame

CarlaRecorderFrame CarlaReplayer::Frame
private

Definition at line 104 of file CarlaReplayer.h.

Referenced by GetTotalTime(), ProcessToTime(), and Rewind().

◆ Header

Definition at line 102 of file CarlaReplayer.h.

◆ Helper

CarlaReplayerHelper CarlaReplayer::Helper
private

◆ IgnoreHero

bool CarlaReplayer::IgnoreHero { false }
private

◆ IsHeroMap

std::unordered_map<uint32_t, bool> CarlaReplayer::IsHeroMap
private

◆ MappedId

std::unordered_map<uint32_t, uint32_t> CarlaReplayer::MappedId
private

◆ PrevPos

std::vector<CarlaRecorderPosition> CarlaReplayer::PrevPos
private

Definition at line 107 of file CarlaReplayer.h.

Referenced by ProcessPositions(), and UpdatePositions().

◆ RecInfo

CarlaRecorderInfo CarlaReplayer::RecInfo
private

Definition at line 103 of file CarlaReplayer.h.

Referenced by ReplayFile(), and Rewind().

◆ TimeFactor

double CarlaReplayer::TimeFactor { 1.0 }
private

◆ TimeToStop

double CarlaReplayer::TimeToStop
private

Definition at line 112 of file CarlaReplayer.h.

Referenced by CheckPlayAfterMapLoaded(), ProcessToTime(), ReplayFile(), and Rewind().

◆ TotalTime

double CarlaReplayer::TotalTime
private

Definition at line 113 of file CarlaReplayer.h.

Referenced by CheckPlayAfterMapLoaded(), ReplayFile(), Rewind(), and Stop().


The documentation for this class was generated from the following files: