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

#include <World.h>

+ Collaboration diagram for carla::client::World:

Public Member Functions

uint64_t ApplySettings (const rpc::EpisodeSettings &settings, time_duration timeout)
 
std::vector< rpc::LabelledPointCastRay (geom::Location start_location, geom::Location end_location) const
 
void EnableEnvironmentObjects (std::vector< uint64_t > env_objects_ids, bool enable) const
 
void FreezeAllTrafficLights (bool frozen)
 
SharedPtr< ActorGetActor (ActorId id) const
 Find actor by id, return nullptr if not found. More...
 
SharedPtr< ActorListGetActors () const
 Return a list with all the actors currently present in the world. More...
 
SharedPtr< ActorListGetActors (const std::vector< ActorId > &actor_ids) const
 Return a list with the actors requested by ActorId. More...
 
SharedPtr< BlueprintLibraryGetBlueprintLibrary () const
 Return the list of blueprints available in this world. More...
 
std::vector< rpc::EnvironmentObjectGetEnvironmentObjects (uint8_t queried_tag) const
 
detail::EpisodeProxy GetEpisode () const
 
uint64_t GetId () const
 Get the id of the episode associated with this world. More...
 
std::vector< geom::BoundingBoxGetLevelBBs (uint8_t queried_tag) const
 Returns all the BBs of all the elements of the level. More...
 
SharedPtr< LightManagerGetLightManager () const
 
SharedPtr< MapGetMap () const
 Return the map that describes this world. More...
 
boost::optional< geom::LocationGetRandomLocationFromNavigation () const
 Get a random location from the pedestrians navigation mesh. More...
 
rpc::EpisodeSettings GetSettings () const
 
WorldSnapshot GetSnapshot () const
 Return a snapshot of the world at this moment. More...
 
SharedPtr< ActorGetSpectator () const
 Return the spectator actor. More...
 
SharedPtr< ActorGetTrafficLight (const Landmark &landmark) const
 
SharedPtr< ActorGetTrafficSign (const Landmark &landmark) const
 
rpc::VehicleLightStateList GetVehiclesLightStates () const
 Returns a list of pairs where the firts element is the vehicle ID and the second one is the light state. More...
 
rpc::WeatherParameters GetWeather () const
 Retrieve the weather parameters currently active in the world. More...
 
boost::optional< rpc::LabelledPointGroundProjection (geom::Location location, float search_distance=10000.0) const
 
void LoadLevelLayer (rpc::MapLayer map_layers) const
 
DebugHelper MakeDebugHelper () const
 
size_t OnTick (std::function< void(WorldSnapshot)> callback)
 Register a callback to be called every time a world tick is received. More...
 
Worldoperator= (const World &)=default
 
Worldoperator= (World &&)=default
 
boost::optional< rpc::LabelledPointProjectPoint (geom::Location location, geom::Vector3D direction, float search_distance=10000.f) const
 
void RemoveOnTick (size_t callback_id)
 Remove a callback registered with OnTick. More...
 
void ResetAllTrafficLights ()
 
void SetPedestriansCrossFactor (float percentage)
 set the probability that an agent could cross the roads in its path following percentage of 0.0f means no pedestrian can cross roads percentage of 0.5f means 50% of all pedestrians can cross roads percentage of 1.0f means all pedestrians can cross roads if needed More...
 
void SetWeather (const rpc::WeatherParameters &weather)
 Change the weather in the simulation. More...
 
SharedPtr< ActorSpawnActor (const ActorBlueprint &blueprint, const geom::Transform &transform, Actor *parent=nullptr, rpc::AttachmentType attachment_type=rpc::AttachmentType::Rigid)
 Spawn an actor into the world based on the blueprint provided at transform. More...
 
uint64_t Tick (time_duration timeout)
 Signal the simulator to continue to next tick (only has effect on synchronous mode). More...
 
SharedPtr< ActorTrySpawnActor (const ActorBlueprint &blueprint, const geom::Transform &transform, Actor *parent=nullptr, rpc::AttachmentType attachment_type=rpc::AttachmentType::Rigid) noexcept
 Same as SpawnActor but return nullptr on failure instead of throwing an exception. More...
 
void UnloadLevelLayer (rpc::MapLayer map_layers) const
 
WorldSnapshot WaitForTick (time_duration timeout) const
 Block calling thread until a world tick is received. More...
 
 World (detail::EpisodeProxy episode)
 
 World (const World &)=default
 
 World (World &&)=default
 
 ~World ()
 

Private Attributes

detail::EpisodeProxy _episode
 

Detailed Description

Definition at line 41 of file World.h.

Constructor & Destructor Documentation

◆ World() [1/3]

carla::client::World::World ( detail::EpisodeProxy  episode)
inlineexplicit

Definition at line 44 of file World.h.

Referenced by ~World().

+ Here is the caller graph for this function:

◆ ~World()

carla::client::World::~World ( )
inline

Definition at line 46 of file World.h.

References operator=(), and World().

+ Here is the call graph for this function:

◆ World() [2/3]

carla::client::World::World ( const World )
default

◆ World() [3/3]

carla::client::World::World ( World &&  )
default

Member Function Documentation

◆ ApplySettings()

uint64_t carla::client::World::ApplySettings ( const rpc::EpisodeSettings settings,
time_duration  timeout 
)
Returns
The id of the frame when the settings were applied.

Definition at line 53 of file World.cpp.

References _episode, carla::rpc::EpisodeSettings::fixed_delta_seconds, GetSnapshot(), carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), carla::log_warning(), and Tick().

Referenced by GetId().

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

◆ CastRay()

std::vector< rpc::LabelledPoint > carla::client::World::CastRay ( geom::Location  start_location,
geom::Location  end_location 
) const

Definition at line 224 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetEpisode().

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

◆ EnableEnvironmentObjects()

void carla::client::World::EnableEnvironmentObjects ( std::vector< uint64_t >  env_objects_ids,
bool  enable 
) const

Definition at line 203 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetEpisode().

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

◆ FreezeAllTrafficLights()

void carla::client::World::FreezeAllTrafficLights ( bool  frozen)

Definition at line 191 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetEpisode().

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

◆ GetActor()

SharedPtr< Actor > carla::client::World::GetActor ( ActorId  id) const

Find actor by id, return nullptr if not found.

Definition at line 91 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ GetActors() [1/2]

SharedPtr< ActorList > carla::client::World::GetActors ( ) const

Return a list with all the actors currently present in the world.

Definition at line 99 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by carla::client::TrafficLight::GetGroupTrafficLights(), GetId(), GetTrafficLight(), GetTrafficSign(), carla::client::RssSensor::TickRssSensor(), and carla::traffic_manager::ALSM::Update().

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

◆ GetActors() [2/2]

SharedPtr< ActorList > carla::client::World::GetActors ( const std::vector< ActorId > &  actor_ids) const

Return a list with the actors requested by ActorId.

Definition at line 105 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

+ Here is the call graph for this function:

◆ GetBlueprintLibrary()

SharedPtr< BlueprintLibrary > carla::client::World::GetBlueprintLibrary ( ) const

Return the list of blueprints available in this world.

This blueprints can be used to spawning actor into the world.

Definition at line 33 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ GetEnvironmentObjects()

std::vector< rpc::EnvironmentObject > carla::client::World::GetEnvironmentObjects ( uint8_t  queried_tag) const

Definition at line 199 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetEpisode().

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

◆ GetEpisode()

detail::EpisodeProxy carla::client::World::GetEpisode ( ) const
inline

Definition at line 156 of file World.h.

References _episode, CastRay(), EnableEnvironmentObjects(), FreezeAllTrafficLights(), GetEnvironmentObjects(), GetLevelBBs(), GroundProjection(), and ProjectPoint().

+ Here is the call graph for this function:

◆ GetId()

uint64_t carla::client::World::GetId ( ) const
inline

◆ GetLevelBBs()

std::vector< geom::BoundingBox > carla::client::World::GetLevelBBs ( uint8_t  queried_tag) const

Returns all the BBs of all the elements of the level.

Definition at line 195 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetEpisode().

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

◆ GetLightManager()

SharedPtr< LightManager > carla::client::World::GetLightManager ( ) const

Definition at line 187 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ GetMap()

SharedPtr< Map > carla::client::World::GetMap ( ) const

Return the map that describes this world.

Definition at line 21 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId(), carla::client::RssSensor::Listen(), and carla::traffic_manager::TrafficManagerLocal::SetupLocalMap().

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

◆ GetRandomLocationFromNavigation()

boost::optional< geom::Location > carla::client::World::GetRandomLocationFromNavigation ( ) const

Get a random location from the pedestrians navigation mesh.

Definition at line 41 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ GetSettings()

rpc::EpisodeSettings carla::client::World::GetSettings ( ) const

Definition at line 49 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ GetSnapshot()

WorldSnapshot carla::client::World::GetSnapshot ( ) const

Return a snapshot of the world at this moment.

Definition at line 87 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by ApplySettings(), GetId(), carla::traffic_manager::ALSM::Reset(), carla::traffic_manager::TrafficLightStage::Update(), carla::traffic_manager::MotionPlanStage::Update(), and carla::traffic_manager::ALSM::Update().

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

◆ GetSpectator()

SharedPtr< Actor > carla::client::World::GetSpectator ( ) const

Return the spectator actor.

The spectator controls the view in the simulator window.

Definition at line 45 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ GetTrafficLight()

SharedPtr< Actor > carla::client::World::GetTrafficLight ( const Landmark landmark) const

Definition at line 167 of file World.cpp.

References GetActors(), carla::client::Landmark::GetId(), carla::client::TrafficSign::GetSignId(), and carla::StringUtil::Match().

Referenced by GetId().

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

◆ GetTrafficSign()

SharedPtr< Actor > carla::client::World::GetTrafficSign ( const Landmark landmark) const

Definition at line 151 of file World.cpp.

References GetActors(), carla::client::Landmark::GetId(), carla::client::TrafficSign::GetSignId(), and carla::StringUtil::Match().

Referenced by GetId().

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

◆ GetVehiclesLightStates()

rpc::VehicleLightStateList carla::client::World::GetVehiclesLightStates ( ) const

Returns a list of pairs where the firts element is the vehicle ID and the second one is the light state.

Definition at line 37 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ GetWeather()

rpc::WeatherParameters carla::client::World::GetWeather ( ) const

Retrieve the weather parameters currently active in the world.

Definition at line 79 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ GroundProjection()

boost::optional< rpc::LabelledPoint > carla::client::World::GroundProjection ( geom::Location  location,
float  search_distance = 10000.0 
) const

Definition at line 218 of file World.cpp.

References ProjectPoint().

Referenced by GetEpisode().

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

◆ LoadLevelLayer()

void carla::client::World::LoadLevelLayer ( rpc::MapLayer  map_layers) const

Definition at line 25 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ MakeDebugHelper()

DebugHelper carla::client::World::MakeDebugHelper ( ) const
inline

Definition at line 152 of file World.h.

References _episode.

◆ OnTick()

size_t carla::client::World::OnTick ( std::function< void(WorldSnapshot)>  callback)

Register a callback to be called every time a world tick is received.

Returns
ID of the callback, use it to remove the callback.

Definition at line 135 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ operator=() [1/2]

World& carla::client::World::operator= ( const World )
default

Referenced by ~World().

+ Here is the caller graph for this function:

◆ operator=() [2/2]

World& carla::client::World::operator= ( World &&  )
default

◆ ProjectPoint()

boost::optional< rpc::LabelledPoint > carla::client::World::ProjectPoint ( geom::Location  location,
geom::Vector3D  direction,
float  search_distance = 10000.f 
) const

Definition at line 209 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetEpisode(), and GroundProjection().

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

◆ RemoveOnTick()

void carla::client::World::RemoveOnTick ( size_t  callback_id)

Remove a callback registered with OnTick.

Definition at line 139 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ ResetAllTrafficLights()

void carla::client::World::ResetAllTrafficLights ( )

Definition at line 183 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId(), and carla::traffic_manager::TrafficManagerLocal::SetRandomDeviceSeed().

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

◆ SetPedestriansCrossFactor()

void carla::client::World::SetPedestriansCrossFactor ( float  percentage)

set the probability that an agent could cross the roads in its path following percentage of 0.0f means no pedestrian can cross roads percentage of 0.5f means 50% of all pedestrians can cross roads percentage of 1.0f means all pedestrians can cross roads if needed

Definition at line 147 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ SetWeather()

void carla::client::World::SetWeather ( const rpc::WeatherParameters weather)

Change the weather in the simulation.

Definition at line 83 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ SpawnActor()

SharedPtr< Actor > carla::client::World::SpawnActor ( const ActorBlueprint blueprint,
const geom::Transform transform,
Actor parent = nullptr,
rpc::AttachmentType  attachment_type = rpc::AttachmentType::Rigid 
)

Spawn an actor into the world based on the blueprint provided at transform.

If a parent is provided, the actor is attached to parent.

Definition at line 111 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId(), and TrySpawnActor().

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

◆ Tick()

uint64_t carla::client::World::Tick ( time_duration  timeout)

Signal the simulator to continue to next tick (only has effect on synchronous mode).

Returns
The id of the frame that this call started.

Definition at line 143 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by ApplySettings(), and GetId().

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

◆ TrySpawnActor()

SharedPtr< Actor > carla::client::World::TrySpawnActor ( const ActorBlueprint blueprint,
const geom::Transform transform,
Actor parent = nullptr,
rpc::AttachmentType  attachment_type = rpc::AttachmentType::Rigid 
)
noexcept

Same as SpawnActor but return nullptr on failure instead of throwing an exception.

Definition at line 119 of file World.cpp.

References SpawnActor().

Referenced by GetId().

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

◆ UnloadLevelLayer()

void carla::client::World::UnloadLevelLayer ( rpc::MapLayer  map_layers) const

Definition at line 29 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

◆ WaitForTick()

WorldSnapshot carla::client::World::WaitForTick ( time_duration  timeout) const

Block calling thread until a world tick is received.

Definition at line 131 of file World.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by GetId().

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

Member Data Documentation

◆ _episode

detail::EpisodeProxy carla::client::World::_episode
private

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