CARLA
Public Member Functions | Private Member Functions | Private Attributes | List of all members
carla::client::detail::Episode Class Reference

Holds the current episode, and the current episode state. More...

#include <Episode.h>

+ Inheritance diagram for carla::client::detail::Episode:
+ Collaboration diagram for carla::client::detail::Episode:

Public Member Functions

void AddPendingException (std::string e)
 
std::shared_ptr< WalkerNavigationCreateNavigationIfMissing ()
 
 Episode (Client &client)
 
boost::optional< rpc::ActorGetActorById (ActorId id)
 
std::vector< rpc::ActorGetActors ()
 
std::vector< rpc::ActorGetActorsById (const std::vector< ActorId > &actor_ids)
 
auto GetId () const
 
std::shared_ptr< WalkerNavigationGetNavigation () const
 
std::shared_ptr< const EpisodeStateGetState () const
 
bool HasMapChangedSinceLastCall ()
 
void Listen ()
 
void RegisterActor (rpc::Actor actor)
 
size_t RegisterLightUpdateChangeEvent (std::function< void(WorldSnapshot)> callback)
 
size_t RegisterOnMapChangeEvent (std::function< void(WorldSnapshot)> callback)
 
size_t RegisterOnTickEvent (std::function< void(WorldSnapshot)> callback)
 
void RemoveLightUpdateChangeEvent (size_t id)
 
void RemoveOnMapChangeEvent (size_t id)
 
void RemoveOnTickEvent (size_t id)
 
void SetPedestriansCrossFactor (float percentage)
 
void SetPedestriansSeed (unsigned int seed)
 
boost::optional< WorldSnapshotWaitForState (time_duration timeout)
 
 ~Episode ()
 

Private Member Functions

 Episode (Client &client, const rpc::EpisodeInfo &info)
 
void OnEpisodeChanged ()
 
void OnEpisodeStarted ()
 
- Private Member Functions inherited from carla::NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
NonCopyableoperator= (NonCopyable &&)=delete
 

Private Attributes

CachedActorList _actors
 
Client_client
 
AtomicSharedPtr< WalkerNavigation_navigation
 
CallbackList< WorldSnapshot_on_light_update_callbacks
 
CallbackList< WorldSnapshot_on_map_change_callbacks
 
CallbackList< WorldSnapshot_on_tick_callbacks
 
bool _pending_exceptions = false
 
std::string _pending_exceptions_msg
 
bool _should_update_map = true
 
RecurrentSharedFuture< WorldSnapshot_snapshot
 
AtomicSharedPtr< const EpisodeState_state
 
const streaming::Token _token
 

Detailed Description

Holds the current episode, and the current episode state.

The episode state changes in the background each time a world tick is received. The episode may change with any background update if the simulator has loaded a new episode.

Definition at line 33 of file Episode.h.

Constructor & Destructor Documentation

◆ Episode() [1/2]

carla::client::detail::Episode::Episode ( Client client)
explicit

Definition at line 37 of file Episode.cpp.

Referenced by AddPendingException().

+ Here is the caller graph for this function:

◆ ~Episode()

carla::client::detail::Episode::~Episode ( )

Definition at line 45 of file Episode.cpp.

References _client, _token, carla::log_error(), and carla::client::detail::Client::UnSubscribeFromStream().

+ Here is the call graph for this function:

◆ Episode() [2/2]

carla::client::detail::Episode::Episode ( Client client,
const rpc::EpisodeInfo info 
)
private

Definition at line 40 of file Episode.cpp.

Member Function Documentation

◆ AddPendingException()

void carla::client::detail::Episode::AddPendingException ( std::string  e)
inline

Definition at line 110 of file Episode.h.

References _pending_exceptions, _pending_exceptions_msg, Episode(), HasMapChangedSinceLastCall(), OnEpisodeChanged(), and OnEpisodeStarted().

+ Here is the call graph for this function:

◆ CreateNavigationIfMissing()

std::shared_ptr< WalkerNavigation > carla::client::detail::Episode::CreateNavigationIfMissing ( )

Definition at line 130 of file Episode.cpp.

References _client, and _navigation.

Referenced by GetState().

+ Here is the caller graph for this function:

◆ GetActorById()

boost::optional< rpc::Actor > carla::client::detail::Episode::GetActorById ( ActorId  id)

Definition at line 118 of file Episode.cpp.

References _actors, _client, carla::client::detail::CachedActorList::GetActorById(), carla::client::detail::Client::GetActorsById(), and carla::client::detail::CachedActorList::Insert().

Referenced by RegisterActor().

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

◆ GetActors()

std::vector< rpc::Actor > carla::client::detail::Episode::GetActors ( )

Definition at line 146 of file Episode.cpp.

References _actors, _client, carla::client::detail::GetActorsById_Impl(), and GetState().

Referenced by RegisterActor().

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

◆ GetActorsById()

std::vector< rpc::Actor > carla::client::detail::Episode::GetActorsById ( const std::vector< ActorId > &  actor_ids)

Definition at line 142 of file Episode.cpp.

References _actors, _client, and carla::client::detail::GetActorsById_Impl().

Referenced by RegisterActor().

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

◆ GetId()

auto carla::client::detail::Episode::GetId ( ) const
inline

Definition at line 44 of file Episode.h.

References GetState().

+ Here is the call graph for this function:

◆ GetNavigation()

std::shared_ptr<WalkerNavigation> carla::client::detail::Episode::GetNavigation ( ) const
inline

Definition at line 54 of file Episode.h.

References _navigation, and DEBUG_ASSERT.

◆ GetState()

std::shared_ptr<const EpisodeState> carla::client::detail::Episode::GetState ( ) const
inline

Definition at line 48 of file Episode.h.

References _state, and CreateNavigationIfMissing().

Referenced by GetActors(), GetId(), and carla::client::detail::SynchronizeFrame().

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

◆ HasMapChangedSinceLastCall()

bool carla::client::detail::Episode::HasMapChangedSinceLastCall ( )

Definition at line 161 of file Episode.cpp.

References _should_update_map.

Referenced by AddPendingException().

+ Here is the caller graph for this function:

◆ Listen()

void carla::client::detail::Episode::Listen ( )

Check for pending exceptions (Mainly TM server closed)

Mark pending exception false

Create exception for the error message

Sensor case: inconsistent data

Episode change

Definition at line 53 of file Episode.cpp.

References _client, _token, carla::client::detail::CastData(), carla::sensor::Deserializer::Deserialize(), and carla::client::detail::Client::SubscribeToStream().

+ Here is the call graph for this function:

◆ OnEpisodeChanged()

void carla::client::detail::Episode::OnEpisodeChanged ( )
private

Definition at line 157 of file Episode.cpp.

References carla::traffic_manager::TrafficManager::Reset().

Referenced by AddPendingException().

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

◆ OnEpisodeStarted()

void carla::client::detail::Episode::OnEpisodeStarted ( )
private

Definition at line 150 of file Episode.cpp.

References _actors, _navigation, _on_tick_callbacks, carla::client::detail::CachedActorList::Clear(), and carla::traffic_manager::TrafficManager::Release().

Referenced by AddPendingException().

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

◆ RegisterActor()

void carla::client::detail::Episode::RegisterActor ( rpc::Actor  actor)
inline

Definition at line 60 of file Episode.h.

References _actors, GetActorById(), GetActors(), GetActorsById(), and carla::client::detail::CachedActorList::Insert().

+ Here is the call graph for this function:

◆ RegisterLightUpdateChangeEvent()

size_t carla::client::detail::Episode::RegisterLightUpdateChangeEvent ( std::function< void(WorldSnapshot)>  callback)
inline

Definition at line 90 of file Episode.h.

References _on_light_update_callbacks.

◆ RegisterOnMapChangeEvent()

size_t carla::client::detail::Episode::RegisterOnMapChangeEvent ( std::function< void(WorldSnapshot)>  callback)
inline

Definition at line 82 of file Episode.h.

References _on_map_change_callbacks.

◆ RegisterOnTickEvent()

size_t carla::client::detail::Episode::RegisterOnTickEvent ( std::function< void(WorldSnapshot)>  callback)
inline

Definition at line 74 of file Episode.h.

References _on_tick_callbacks.

◆ RemoveLightUpdateChangeEvent()

void carla::client::detail::Episode::RemoveLightUpdateChangeEvent ( size_t  id)
inline

Definition at line 94 of file Episode.h.

References _on_light_update_callbacks.

◆ RemoveOnMapChangeEvent()

void carla::client::detail::Episode::RemoveOnMapChangeEvent ( size_t  id)
inline

Definition at line 86 of file Episode.h.

References _on_map_change_callbacks.

◆ RemoveOnTickEvent()

void carla::client::detail::Episode::RemoveOnTickEvent ( size_t  id)
inline

Definition at line 78 of file Episode.h.

References _on_tick_callbacks.

◆ SetPedestriansCrossFactor()

void carla::client::detail::Episode::SetPedestriansCrossFactor ( float  percentage)
inline

Definition at line 98 of file Episode.h.

References _navigation, and DEBUG_ASSERT.

◆ SetPedestriansSeed()

void carla::client::detail::Episode::SetPedestriansSeed ( unsigned int  seed)
inline

Definition at line 104 of file Episode.h.

References _navigation, and DEBUG_ASSERT.

◆ WaitForState()

boost::optional<WorldSnapshot> carla::client::detail::Episode::WaitForState ( time_duration  timeout)
inline

Definition at line 70 of file Episode.h.

References _snapshot.

Member Data Documentation

◆ _actors

CachedActorList carla::client::detail::Episode::_actors
private

Definition at line 133 of file Episode.h.

Referenced by GetActorById(), GetActors(), GetActorsById(), OnEpisodeStarted(), and RegisterActor().

◆ _client

Client& carla::client::detail::Episode::_client
private

◆ _navigation

AtomicSharedPtr<WalkerNavigation> carla::client::detail::Episode::_navigation
private

◆ _on_light_update_callbacks

CallbackList<WorldSnapshot> carla::client::detail::Episode::_on_light_update_callbacks
private

Definition at line 139 of file Episode.h.

Referenced by RegisterLightUpdateChangeEvent(), and RemoveLightUpdateChangeEvent().

◆ _on_map_change_callbacks

CallbackList<WorldSnapshot> carla::client::detail::Episode::_on_map_change_callbacks
private

Definition at line 137 of file Episode.h.

Referenced by RegisterOnMapChangeEvent(), and RemoveOnMapChangeEvent().

◆ _on_tick_callbacks

CallbackList<WorldSnapshot> carla::client::detail::Episode::_on_tick_callbacks
private

Definition at line 135 of file Episode.h.

Referenced by OnEpisodeStarted(), RegisterOnTickEvent(), and RemoveOnTickEvent().

◆ _pending_exceptions

bool carla::client::detail::Episode::_pending_exceptions = false
private

Definition at line 145 of file Episode.h.

Referenced by AddPendingException().

◆ _pending_exceptions_msg

std::string carla::client::detail::Episode::_pending_exceptions_msg
private

Definition at line 131 of file Episode.h.

Referenced by AddPendingException().

◆ _should_update_map

bool carla::client::detail::Episode::_should_update_map = true
private

Definition at line 147 of file Episode.h.

Referenced by HasMapChangedSinceLastCall().

◆ _snapshot

RecurrentSharedFuture<WorldSnapshot> carla::client::detail::Episode::_snapshot
private

Definition at line 141 of file Episode.h.

Referenced by WaitForState().

◆ _state

AtomicSharedPtr<const EpisodeState> carla::client::detail::Episode::_state
private

Definition at line 127 of file Episode.h.

Referenced by GetState().

◆ _token

const streaming::Token carla::client::detail::Episode::_token
private

Definition at line 143 of file Episode.h.

Referenced by Listen(), and ~Episode().


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