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, std::weak_ptr< Simulator > simulator)
 
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< 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, std::weak_ptr< Simulator > simulator)
 
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
 
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
 
std::weak_ptr< Simulator_simulator
 
RecurrentSharedFuture< WorldSnapshot_snapshot
 
AtomicSharedPtr< const EpisodeState_state
 
const streaming::Token _token
 
AtomicSharedPtr< WalkerNavigation_walker_navigation
 

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 34 of file Episode.h.

Constructor & Destructor Documentation

◆ Episode() [1/2]

carla::client::detail::Episode::Episode ( Client client,
std::weak_ptr< Simulator simulator 
)
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 46 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,
std::weak_ptr< Simulator simulator 
)
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 95 of file Episode.h.

References _pending_exceptions, _pending_exceptions_msg, CreateNavigationIfMissing(), 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 152 of file Episode.cpp.

References _simulator, and _walker_navigation.

Referenced by AddPendingException().

+ Here is the caller graph for this function:

◆ GetActorById()

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

Definition at line 113 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 129 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 125 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 45 of file Episode.h.

References GetState().

+ Here is the call graph for this function:

◆ GetState()

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

Definition at line 49 of file Episode.h.

References _state.

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

+ Here is the caller graph for this function:

◆ HasMapChangedSinceLastCall()

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

Definition at line 144 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 54 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 140 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 133 of file Episode.cpp.

References _actors, _on_tick_callbacks, _walker_navigation, 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 53 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 83 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 75 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 67 of file Episode.h.

References _on_tick_callbacks.

◆ RemoveLightUpdateChangeEvent()

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

Definition at line 87 of file Episode.h.

References _on_light_update_callbacks, SetPedestriansCrossFactor(), and SetPedestriansSeed().

+ Here is the call graph for this function:

◆ RemoveOnMapChangeEvent()

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

Definition at line 79 of file Episode.h.

References _on_map_change_callbacks.

◆ RemoveOnTickEvent()

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

Definition at line 71 of file Episode.h.

References _on_tick_callbacks.

◆ SetPedestriansCrossFactor()

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

Referenced by RemoveLightUpdateChangeEvent().

+ Here is the caller graph for this function:

◆ SetPedestriansSeed()

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

Referenced by RemoveLightUpdateChangeEvent().

+ Here is the caller graph for this function:

◆ WaitForState()

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

Definition at line 63 of file Episode.h.

References _snapshot.

Member Data Documentation

◆ _actors

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

Definition at line 118 of file Episode.h.

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

◆ _client

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

Definition at line 112 of file Episode.h.

Referenced by GetActorById(), GetActors(), GetActorsById(), Listen(), and ~Episode().

◆ _on_light_update_callbacks

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

Definition at line 124 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 122 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 120 of file Episode.h.

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

◆ _pending_exceptions

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

Definition at line 132 of file Episode.h.

Referenced by AddPendingException().

◆ _pending_exceptions_msg

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

Definition at line 116 of file Episode.h.

Referenced by AddPendingException().

◆ _should_update_map

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

Definition at line 134 of file Episode.h.

Referenced by HasMapChangedSinceLastCall().

◆ _simulator

std::weak_ptr<Simulator> carla::client::detail::Episode::_simulator
private

Definition at line 136 of file Episode.h.

Referenced by CreateNavigationIfMissing().

◆ _snapshot

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

Definition at line 126 of file Episode.h.

Referenced by WaitForState().

◆ _state

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

Definition at line 114 of file Episode.h.

Referenced by GetState().

◆ _token

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

Definition at line 130 of file Episode.h.

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

◆ _walker_navigation

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

Definition at line 128 of file Episode.h.

Referenced by CreateNavigationIfMissing(), and OnEpisodeStarted().


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