Holds the current episode, and the current episode state. More...
#include <Episode.h>
Public Member Functions | |
void | AddPendingException (std::string e) |
std::shared_ptr< WalkerNavigation > | CreateNavigationIfMissing () |
Episode (Client &client, std::weak_ptr< Simulator > simulator) | |
boost::optional< rpc::Actor > | GetActorById (ActorId id) |
std::vector< rpc::Actor > | GetActors () |
std::vector< rpc::Actor > | GetActorsById (const std::vector< ActorId > &actor_ids) |
auto | GetId () const |
std::shared_ptr< const EpisodeState > | GetState () 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< WorldSnapshot > | WaitForState (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 | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable & | operator= (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 |
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.
|
explicit |
Definition at line 37 of file Episode.cpp.
Referenced by AddPendingException().
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().
|
private |
Definition at line 40 of file Episode.cpp.
|
inline |
Definition at line 95 of file Episode.h.
References _pending_exceptions, _pending_exceptions_msg, CreateNavigationIfMissing(), Episode(), HasMapChangedSinceLastCall(), OnEpisodeChanged(), and OnEpisodeStarted().
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().
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().
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().
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().
|
inline |
Definition at line 45 of file Episode.h.
References GetState().
|
inline |
Definition at line 49 of file Episode.h.
References _state.
Referenced by GetActors(), GetId(), and carla::client::detail::SynchronizeFrame().
bool carla::client::detail::Episode::HasMapChangedSinceLastCall | ( | ) |
Definition at line 144 of file Episode.cpp.
References _should_update_map.
Referenced by AddPendingException().
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().
|
private |
Definition at line 140 of file Episode.cpp.
References carla::traffic_manager::TrafficManager::Reset().
Referenced by AddPendingException().
|
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().
|
inline |
Definition at line 53 of file Episode.h.
References _actors, GetActorById(), GetActors(), GetActorsById(), and carla::client::detail::CachedActorList::Insert().
|
inline |
Definition at line 83 of file Episode.h.
References _on_light_update_callbacks.
|
inline |
Definition at line 75 of file Episode.h.
References _on_map_change_callbacks.
|
inline |
Definition at line 67 of file Episode.h.
References _on_tick_callbacks.
|
inline |
Definition at line 87 of file Episode.h.
References _on_light_update_callbacks, SetPedestriansCrossFactor(), and SetPedestriansSeed().
|
inline |
Definition at line 79 of file Episode.h.
References _on_map_change_callbacks.
|
inline |
Definition at line 71 of file Episode.h.
References _on_tick_callbacks.
void carla::client::detail::Episode::SetPedestriansCrossFactor | ( | float | percentage | ) |
void carla::client::detail::Episode::SetPedestriansSeed | ( | unsigned int | seed | ) |
|
inline |
|
private |
Definition at line 118 of file Episode.h.
Referenced by GetActorById(), GetActors(), GetActorsById(), OnEpisodeStarted(), and RegisterActor().
|
private |
Definition at line 112 of file Episode.h.
Referenced by GetActorById(), GetActors(), GetActorsById(), Listen(), and ~Episode().
|
private |
Definition at line 124 of file Episode.h.
Referenced by RegisterLightUpdateChangeEvent(), and RemoveLightUpdateChangeEvent().
|
private |
Definition at line 122 of file Episode.h.
Referenced by RegisterOnMapChangeEvent(), and RemoveOnMapChangeEvent().
|
private |
Definition at line 120 of file Episode.h.
Referenced by OnEpisodeStarted(), RegisterOnTickEvent(), and RemoveOnTickEvent().
|
private |
Definition at line 132 of file Episode.h.
Referenced by AddPendingException().
|
private |
Definition at line 116 of file Episode.h.
Referenced by AddPendingException().
|
private |
Definition at line 134 of file Episode.h.
Referenced by HasMapChangedSinceLastCall().
|
private |
Definition at line 136 of file Episode.h.
Referenced by CreateNavigationIfMissing().
|
private |
Definition at line 126 of file Episode.h.
Referenced by WaitForState().
|
private |
Definition at line 114 of file Episode.h.
Referenced by GetState().
|
private |
Definition at line 130 of file Episode.h.
Referenced by Listen(), and ~Episode().
|
private |
Definition at line 128 of file Episode.h.
Referenced by CreateNavigationIfMissing(), and OnEpisodeStarted().