40 class BlueprintLibrary;
123 Actor *parent =
nullptr,
131 Actor *parent =
nullptr,
174 const std::vector<float> &vertices,
175 const std::vector<uint32_t> &triangles,
176 const std::string &material);
191 std::vector<geom::BoundingBox>
GetLevelBBs(uint8_t queried_tag)
const;
196 std::vector<uint64_t> env_objects_ids,
205 std::vector<rpc::LabelledPoint>
CastRay(
217 const std::string &actor_name,
222 const std::vector<std::string> &objects_names,
227 const std::string &actor_name,
232 const std::vector<std::string> &objects_names,
246 int32_t face_size = 512);
253 const std::string &actor_name,
260 const std::vector<std::string> &objects_names,
Contains all the necessary information for spawning an Actor.
Represents an actor in the simulation.
Class containing a reference to RoadInfoSignal.
float GetIMUSensorGravity() const
Get gravity value used for the IMU sensor accelerometer calculation.
SharedPtr< ActorList > GetActors() const
Return a list with all the actors currently present in the world.
void ApplyColorTextureToObject(const std::string &actor_name, const rpc::MaterialParameter ¶meter, const rpc::TextureColor &Texture)
std::vector< geom::BoundingBox > GetLevelBBs(uint8_t queried_tag) const
Returns all the BBs of all the elements of the level.
void LoadLevelLayer(rpc::MapLayer map_layers) const
SharedPtr< BlueprintLibrary > GetBlueprintLibrary() const
Return the list of blueprints available in this world.
World(const World &)=default
void EnableEnvironmentObjects(std::vector< uint64_t > env_objects_ids, bool enable) const
void FreezeAllTrafficLights(bool frozen)
std::vector< geom::Transform > GetEgoSpawnPoints() const
Get all ego spawn points available in the level.
WorldSnapshot GetSnapshot() const
Return a snapshot of the world at this moment.
DebugHelper MakeDebugHelper() const
void ResetAllTrafficLights()
bool HasSkyLightMap() const
void SetPublishTF(bool publish_tf)
Set whether to publish ROS2 TF information.
World & operator=(const World &)=default
rpc::WeatherParameters GetWeather() const
Retrieve the weather parameters currently active in the world.
SharedPtr< Actor > GetSpectator() const
Return the spectator actor.
uint64_t GetId() const
Get the id of the episode associated with this world.
rpc::VehicleLightStateList GetVehiclesLightStates() const
Returns a list of pairs where the firts element is the vehicle ID and the second one is the light sta...
SharedPtr< Actor > GetActor(ActorId id) const
Find actor by id, return nullptr if not found.
SharedPtr< Actor > GetTrafficLight(const Landmark &landmark) const
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.
World & operator=(World &&)=default
void SetPedestriansCrossFactor(float percentage)
set the probability that an agent could cross the roads in its path following percentage of 0....
uint64_t Tick(time_duration timeout)
Signal the simulator to continue to next tick (only has effect on synchronous mode).
detail::EpisodeProxy _episode
std::optional< rpc::LabelledPoint > GroundProjection(geom::Location location, float search_distance=10000.0) const
detail::EpisodeProxy GetEpisode() const
World(detail::EpisodeProxy episode)
std::optional< rpc::LabelledPoint > ProjectPoint(geom::Location location, geom::Vector3D direction, float search_distance=10000.f) const
bool IsWeatherEnabled() const
Query if the Weather is enabled or not.
WorldSnapshot WaitForTick(time_duration timeout) const
Block calling thread until a world tick is received.
std::vector< SharedPtr< Actor > > GetTrafficLightsInJunction(const road::JuncId junc_id) const
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)
std::vector< std::string > GetNamesOfAllObjects() const
uint64_t ApplySettings(const rpc::EpisodeSettings &settings, time_duration timeout)
void SetSkyLightMap(const rpc::TextureFloatColor &panorama, float intensity=1.0f, int32_t face_size=512)
Light the scene with an environment map: an equirectangular linear RGB(A) float panorama in the CARLA...
std::vector< rpc::EnvironmentObject > GetEnvironmentObjects(uint8_t queried_tag) const
SharedPtr< Map > GetMap() const
Return the map that describes this world.
std::vector< rpc::LabelledPoint > CastRay(geom::Location start_location, geom::Location end_location) const
std::vector< SharedPtr< Actor > > GetTrafficLightsFromWaypoint(const Waypoint &waypoint, double distance) const
void SetIMUSensorGravity(float gravity)
Set gravity value used for the IMU sensor accelerometer calculation.
void SpawnCustomMesh(const std::vector< float > &vertices, const std::vector< uint32_t > &triangles, const std::string &material)
Spawns a static procedural mesh with collision.
bool GetPublishTF() const
Get whether ROS2 TF information is being published.
void ApplyColorTextureToObjects(const std::vector< std::string > &objects_names, const rpc::MaterialParameter ¶meter, const rpc::TextureColor &Texture)
void ApplyFloatColorTextureToObjects(const std::vector< std::string > &objects_names, const rpc::MaterialParameter ¶meter, const rpc::TextureFloatColor &Texture)
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.
void SetPedestriansSeed(unsigned int seed)
set the seed to use with random numbers in the pedestrians module
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)
SharedPtr< LightManager > GetLightManager() const
std::optional< geom::Location > GetRandomLocationFromNavigation() const
Get a random location from the pedestrians navigation mesh.
SharedPtr< Actor > GetTrafficSign(const Landmark &landmark) const
void ApplyFloatColorTextureToObject(const std::string &actor_name, const rpc::MaterialParameter ¶meter, const rpc::TextureFloatColor &Texture)
void RemoveOnTick(size_t callback_id)
Remove a callback registered with OnTick.
SharedPtr< Actor > GetTrafficLightFromOpenDRIVE(const road::SignId &sign_id) const
size_t OnTick(std::function< void(WorldSnapshot)> callback)
Register a callback to be called every time a world tick is received.
void SetWeather(const rpc::WeatherParameters &weather)
Change the weather in the simulation.
rpc::EpisodeSettings GetSettings() const
void UnloadLevelLayer(rpc::MapLayer map_layers) const
auto GetId() const noexcept
Positive time duration up to milliseconds resolution.
std::vector< std::pair< ActorId, VehicleLightState::flag_type > > VehicleLightStateList
carla::SharedPtr< cc::Actor > Actor
carla::SharedPtr< cc::ActorList > ActorList
This file contains definitions of common data structures used in traffic manager.
std::shared_ptr< T > SharedPtr