#include <World.h>
Public Member Functions | |
void | ApplyColorTextureToObject (const std::string &actor_name, const rpc::MaterialParameter ¶meter, const rpc::TextureColor &Texture) |
void | ApplyColorTextureToObjects (const std::vector< std::string > &objects_names, const rpc::MaterialParameter ¶meter, const rpc::TextureColor &Texture) |
void | ApplyFloatColorTextureToObject (const std::string &actor_name, const rpc::MaterialParameter ¶meter, const rpc::TextureFloatColor &Texture) |
void | ApplyFloatColorTextureToObjects (const std::vector< std::string > &objects_names, const rpc::MaterialParameter ¶meter, const rpc::TextureFloatColor &Texture) |
uint64_t | ApplySettings (const rpc::EpisodeSettings &settings, time_duration timeout) |
void | ApplyTexturesToObject (const std::string &actor_name, const rpc::TextureColor &diffuse_texture, const rpc::TextureFloatColor &emissive_texture, const rpc::TextureFloatColor &normal_texture, const rpc::TextureFloatColor &ao_roughness_metallic_emissive_texture) |
void | ApplyTexturesToObjects (const std::vector< std::string > &objects_names, const rpc::TextureColor &diffuse_texture, const rpc::TextureFloatColor &emissive_texture, const rpc::TextureFloatColor &normal_texture, const rpc::TextureFloatColor &ao_roughness_metallic_emissive_texture) |
std::vector< rpc::LabelledPoint > | CastRay (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< Actor > | GetActor (ActorId id) const |
Find actor by id, return nullptr if not found. More... | |
SharedPtr< ActorList > | GetActors () const |
Return a list with all the actors currently present in the world. More... | |
SharedPtr< ActorList > | GetActors (const std::vector< ActorId > &actor_ids) const |
Return a list with the actors requested by ActorId. More... | |
SharedPtr< BlueprintLibrary > | GetBlueprintLibrary () const |
Return the list of blueprints available in this world. More... | |
std::vector< rpc::EnvironmentObject > | GetEnvironmentObjects (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::BoundingBox > | GetLevelBBs (uint8_t queried_tag) const |
Returns all the BBs of all the elements of the level. More... | |
SharedPtr< LightManager > | GetLightManager () const |
SharedPtr< Map > | GetMap () const |
Return the map that describes this world. More... | |
std::vector< std::string > | GetNamesOfAllObjects () const |
boost::optional< geom::Location > | GetRandomLocationFromNavigation () 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< Actor > | GetSpectator () const |
Return the spectator actor. More... | |
SharedPtr< Actor > | GetTrafficLight (const Landmark &landmark) const |
SharedPtr< Actor > | GetTrafficLightFromOpenDRIVE (const road::SignId &sign_id) const |
std::vector< SharedPtr< Actor > > | GetTrafficLightsFromWaypoint (const Waypoint &waypoint, double distance) const |
std::vector< SharedPtr< Actor > > | GetTrafficLightsInJunction (const road::JuncId junc_id) const |
SharedPtr< Actor > | GetTrafficSign (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::LabelledPoint > | GroundProjection (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... | |
World & | operator= (const World &)=default |
World & | operator= (World &&)=default |
boost::optional< rpc::LabelledPoint > | ProjectPoint (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 | SetPedestriansSeed (unsigned int seed) |
set the seed to use with random numbers in the pedestrians module More... | |
void | SetWeather (const rpc::WeatherParameters &weather) |
Change the weather in the simulation. More... | |
SharedPtr< Actor > | 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. More... | |
uint64_t | Tick (time_duration timeout) |
Signal the simulator to continue to next tick (only has effect on synchronous mode). More... | |
SharedPtr< Actor > | 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. 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 |
|
inlineexplicit |
|
inline |
Definition at line 50 of file World.h.
References operator=(), and World().
|
default |
|
default |
void carla::client::World::ApplyColorTextureToObject | ( | const std::string & | actor_name, |
const rpc::MaterialParameter & | parameter, | ||
const rpc::TextureColor & | Texture | ||
) |
Definition at line 298 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by ApplyTexturesToObject(), and GetEpisode().
void carla::client::World::ApplyColorTextureToObjects | ( | const std::vector< std::string > & | objects_names, |
const rpc::MaterialParameter & | parameter, | ||
const rpc::TextureColor & | Texture | ||
) |
Definition at line 305 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by ApplyTexturesToObjects(), and GetEpisode().
void carla::client::World::ApplyFloatColorTextureToObject | ( | const std::string & | actor_name, |
const rpc::MaterialParameter & | parameter, | ||
const rpc::TextureFloatColor & | Texture | ||
) |
Definition at line 312 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by ApplyTexturesToObject(), and GetEpisode().
void carla::client::World::ApplyFloatColorTextureToObjects | ( | const std::vector< std::string > & | objects_names, |
const rpc::MaterialParameter & | parameter, | ||
const rpc::TextureFloatColor & | Texture | ||
) |
Definition at line 319 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by ApplyTexturesToObjects(), and GetEpisode().
uint64_t carla::client::World::ApplySettings | ( | const rpc::EpisodeSettings & | settings, |
time_duration | timeout | ||
) |
Definition at line 56 of file World.cpp.
References _episode, carla::rpc::EpisodeSettings::fixed_delta_seconds, GetSnapshot(), carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), carla::log_warning(), carla::time_duration::milliseconds(), and Tick().
Referenced by GetId().
void carla::client::World::ApplyTexturesToObject | ( | const std::string & | actor_name, |
const rpc::TextureColor & | diffuse_texture, | ||
const rpc::TextureFloatColor & | emissive_texture, | ||
const rpc::TextureFloatColor & | normal_texture, | ||
const rpc::TextureFloatColor & | ao_roughness_metallic_emissive_texture | ||
) |
Definition at line 330 of file World.cpp.
References ApplyColorTextureToObject(), ApplyFloatColorTextureToObject(), carla::rpc::Texture< T >::GetHeight(), carla::rpc::Texture< T >::GetWidth(), carla::rpc::Tex_Ao_Roughness_Metallic_Emissive, carla::rpc::Tex_Diffuse, carla::rpc::Tex_Emissive, and carla::rpc::Tex_Normal.
Referenced by GetEpisode().
void carla::client::World::ApplyTexturesToObjects | ( | const std::vector< std::string > & | objects_names, |
const rpc::TextureColor & | diffuse_texture, | ||
const rpc::TextureFloatColor & | emissive_texture, | ||
const rpc::TextureFloatColor & | normal_texture, | ||
const rpc::TextureFloatColor & | ao_roughness_metallic_emissive_texture | ||
) |
Definition at line 358 of file World.cpp.
References ApplyColorTextureToObjects(), ApplyFloatColorTextureToObjects(), carla::rpc::Texture< T >::GetHeight(), carla::rpc::Texture< T >::GetWidth(), carla::rpc::Tex_Ao_Roughness_Metallic_Emissive, carla::rpc::Tex_Diffuse, carla::rpc::Tex_Emissive, and carla::rpc::Tex_Normal.
Referenced by GetEpisode().
std::vector< rpc::LabelledPoint > carla::client::World::CastRay | ( | geom::Location | start_location, |
geom::Location | end_location | ||
) | const |
Definition at line 255 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetEpisode().
void carla::client::World::EnableEnvironmentObjects | ( | std::vector< uint64_t > | env_objects_ids, |
bool | enable | ||
) | const |
Definition at line 234 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetEpisode().
void carla::client::World::FreezeAllTrafficLights | ( | bool | frozen | ) |
Definition at line 222 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetEpisode().
Find actor by id, return nullptr if not found.
Definition at line 98 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by carla::nav::WalkerManager::GetAllTrafficLightWaypoints(), and GetId().
Return a list with all the actors currently present in the world.
Definition at line 106 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by carla::client::TrafficLight::GetGroupTrafficLights(), GetId(), GetTrafficLight(), GetTrafficLightFromOpenDRIVE(), GetTrafficSign(), carla::client::RssSensor::TickRssSensor(), and carla::traffic_manager::ALSM::Update().
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 112 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
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 36 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
std::vector< rpc::EnvironmentObject > carla::client::World::GetEnvironmentObjects | ( | uint8_t | queried_tag | ) | const |
Definition at line 230 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetEpisode().
|
inline |
Definition at line 165 of file World.h.
References _episode, ApplyColorTextureToObject(), ApplyColorTextureToObjects(), ApplyFloatColorTextureToObject(), ApplyFloatColorTextureToObjects(), ApplyTexturesToObject(), ApplyTexturesToObjects(), CastRay(), EnableEnvironmentObjects(), FreezeAllTrafficLights(), GetEnvironmentObjects(), GetLevelBBs(), GetNamesOfAllObjects(), GetTrafficLightsFromWaypoint(), GetTrafficLightsInJunction(), GroundProjection(), and ProjectPoint().
|
inline |
Get the id of the episode associated with this world.
Definition at line 59 of file World.h.
References _episode, ApplySettings(), GetActor(), GetActors(), GetBlueprintLibrary(), carla::client::detail::EpisodeProxyImpl< PointerT >::GetId(), GetLightManager(), GetMap(), GetRandomLocationFromNavigation(), GetSettings(), GetSnapshot(), GetSpectator(), GetTrafficLight(), GetTrafficLightFromOpenDRIVE(), GetTrafficSign(), GetVehiclesLightStates(), GetWeather(), LoadLevelLayer(), OnTick(), RemoveOnTick(), ResetAllTrafficLights(), carla::rpc::Rigid, SetPedestriansCrossFactor(), SetPedestriansSeed(), SetWeather(), SpawnActor(), Tick(), TrySpawnActor(), UnloadLevelLayer(), and WaitForTick().
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 226 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetEpisode().
SharedPtr< LightManager > carla::client::World::GetLightManager | ( | ) | const |
Definition at line 218 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
Return the map that describes this world.
Definition at line 24 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId(), GetTrafficLightsInJunction(), carla::client::RssSensor::Listen(), carla::client::Client::LoadWorldIfDifferent(), and carla::traffic_manager::TrafficManagerLocal::SetupLocalMap().
std::vector< std::string > carla::client::World::GetNamesOfAllObjects | ( | ) | const |
Definition at line 326 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetEpisode().
boost::optional< geom::Location > carla::client::World::GetRandomLocationFromNavigation | ( | ) | const |
Get a random location from the pedestrians navigation mesh.
Definition at line 44 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
rpc::EpisodeSettings carla::client::World::GetSettings | ( | ) | const |
Definition at line 52 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId(), and carla::client::RssSensor::TickRssSensor().
WorldSnapshot carla::client::World::GetSnapshot | ( | ) | const |
Return a snapshot of the world at this moment.
Definition at line 94 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::TrafficManagerLocal::Run(), carla::traffic_manager::TrafficLightStage::Update(), carla::traffic_manager::MotionPlanStage::Update(), and carla::traffic_manager::ALSM::Update().
Return the spectator actor.
The spectator controls the view in the simulator window.
Definition at line 48 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
Definition at line 183 of file World.cpp.
References GetActors(), carla::client::Landmark::GetId(), carla::client::TrafficSign::GetSignId(), and carla::StringUtil::Match().
Referenced by GetId(), and GetTrafficLightsFromWaypoint().
SharedPtr< Actor > carla::client::World::GetTrafficLightFromOpenDRIVE | ( | const road::SignId & | sign_id | ) | const |
Definition at line 199 of file World.cpp.
References GetActors(), carla::client::TrafficSign::GetSignId(), and carla::StringUtil::Match().
Referenced by GetId(), and GetTrafficLightsInJunction().
std::vector< SharedPtr< Actor > > carla::client::World::GetTrafficLightsFromWaypoint | ( | const Waypoint & | waypoint, |
double | distance | ||
) | const |
Definition at line 260 of file World.cpp.
References carla::client::Waypoint::GetAllLandmarksInDistance(), GetTrafficLight(), and carla::road::SignalType::IsTrafficLight().
Referenced by GetEpisode().
std::vector< SharedPtr< Actor > > carla::client::World::GetTrafficLightsInJunction | ( | const road::JuncId | junc_id | ) | const |
Definition at line 280 of file World.cpp.
References carla::road::Junction::GetControllers(), GetMap(), and GetTrafficLightFromOpenDRIVE().
Referenced by GetEpisode().
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().
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 40 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId(), and carla::traffic_manager::VehicleLightStage::UpdateWorldInfo().
rpc::WeatherParameters carla::client::World::GetWeather | ( | ) | const |
Retrieve the weather parameters currently active in the world.
Definition at line 86 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId(), and carla::traffic_manager::VehicleLightStage::UpdateWorldInfo().
boost::optional< rpc::LabelledPoint > carla::client::World::GroundProjection | ( | geom::Location | location, |
float | search_distance = 10000.0 |
||
) | const |
Definition at line 249 of file World.cpp.
References ProjectPoint().
Referenced by GetEpisode().
void carla::client::World::LoadLevelLayer | ( | rpc::MapLayer | map_layers | ) | const |
Definition at line 28 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
|
inline |
size_t carla::client::World::OnTick | ( | std::function< void(WorldSnapshot)> | callback | ) |
Register a callback to be called every time a world tick is received.
Definition at line 145 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
boost::optional< rpc::LabelledPoint > carla::client::World::ProjectPoint | ( | geom::Location | location, |
geom::Vector3D | direction, | ||
float | search_distance = 10000.f |
||
) | const |
Definition at line 240 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetEpisode(), and GroundProjection().
void carla::client::World::RemoveOnTick | ( | size_t | callback_id | ) |
Remove a callback registered with OnTick.
Definition at line 149 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
void carla::client::World::ResetAllTrafficLights | ( | ) |
Definition at line 214 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId(), and carla::traffic_manager::TrafficManagerLocal::SetRandomDeviceSeed().
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 159 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
void carla::client::World::SetPedestriansSeed | ( | unsigned int | seed | ) |
set the seed to use with random numbers in the pedestrians module
Definition at line 163 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
void carla::client::World::SetWeather | ( | const rpc::WeatherParameters & | weather | ) |
Change the weather in the simulation.
Definition at line 90 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
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 118 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId(), and TrySpawnActor().
uint64_t carla::client::World::Tick | ( | time_duration | timeout | ) |
Signal the simulator to continue to next tick (only has effect on synchronous mode).
Definition at line 153 of file World.cpp.
References _episode, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), and carla::time_duration::milliseconds().
Referenced by ApplySettings(), and GetId().
|
noexcept |
Same as SpawnActor but return nullptr on failure instead of throwing an exception.
Definition at line 126 of file World.cpp.
References SpawnActor().
Referenced by GetId().
void carla::client::World::UnloadLevelLayer | ( | rpc::MapLayer | map_layers | ) | const |
Definition at line 32 of file World.cpp.
References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().
Referenced by GetId().
WorldSnapshot carla::client::World::WaitForTick | ( | time_duration | timeout | ) | const |
Block calling thread until a world tick is received.
Definition at line 138 of file World.cpp.
References _episode, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), and carla::time_duration::milliseconds().
Referenced by GetId().
|
private |
Definition at line 235 of file World.h.
Referenced by ApplyColorTextureToObject(), ApplyColorTextureToObjects(), ApplyFloatColorTextureToObject(), ApplyFloatColorTextureToObjects(), ApplySettings(), CastRay(), EnableEnvironmentObjects(), FreezeAllTrafficLights(), GetActor(), GetActors(), GetBlueprintLibrary(), GetEnvironmentObjects(), GetEpisode(), GetId(), GetLevelBBs(), GetLightManager(), GetMap(), GetNamesOfAllObjects(), GetRandomLocationFromNavigation(), GetSettings(), GetSnapshot(), GetSpectator(), GetVehiclesLightStates(), GetWeather(), LoadLevelLayer(), MakeDebugHelper(), OnTick(), ProjectPoint(), RemoveOnTick(), ResetAllTrafficLights(), SetPedestriansCrossFactor(), SetPedestriansSeed(), SetWeather(), SpawnActor(), Tick(), UnloadLevelLayer(), and WaitForTick().