32 #include <boost/optional.hpp>    40   class BlueprintLibrary;
    43   class WalkerAIController;
    44   class WalkerNavigation;
    50     : 
public std::enable_shared_from_this<Simulator>,
    61         const std::string &host,
    63         size_t worker_threads = 0u,
    64         bool enable_garbage_collection = 
false);
    87         std::string opendrive,
    89         bool reset_settings = 
true);
   148     std::vector<std::string> 
GetRequiredFiles(
const std::string &folder = 
"", 
const bool download = 
true) 
const;
   152     std::vector<uint8_t> 
GetCacheFile(
const std::string &name, 
const bool request_otherwise) 
const;
   196       return _episode->RegisterOnTickEvent(std::move(callback));
   271     std::vector<geom::BoundingBox> 
GetLevelBBs(uint8_t queried_tag)
 const {
   280       std::vector<uint64_t> env_objects_ids,
   326     std::vector<rpc::Actor> 
GetActorsById(
const std::vector<ActorId> &actor_ids)
 const {
   328       return _episode->GetActorsById(actor_ids);
   358         Actor *parent = 
nullptr,
   371       return _episode->GetState()->GetActorSnapshot(actor_id);
   560         uint64_t MaxSubsteps,
   561         float MaxSubstepDeltaTime,
   562         std::string VehicleJSON,
   563         std::string PowertrainJSON,
   564         std::string TireJSON,
   565         std::string BaseJSONPath) {
   601     std::string 
ReplayFile(std::string name, 
double start, 
double duration,
   602         uint32_t follow_id, 
bool replay_sensors) {
   603       return _client.
ReplayFile(std::move(name), start, duration, follow_id, replay_sensors);
   647         uint32_t gbuffer_id);
   707     void ApplyBatch(std::vector<rpc::Command> commands, 
bool do_tick_cue) {
   730         std::vector<rpc::LightState>& lights,
   731         bool discard_client = 
false)
 const {
   741       return _episode->RegisterLightUpdateChangeEvent(std::move(callback));
   746       _episode->RemoveLightUpdateChangeEvent(
id);
   758         const std::vector<std::string> &objects_name,
   763         const std::vector<std::string> &objects_name,
 void DisableActorConstantVelocity(const Actor &actor)
 
void SetVehicleAutopilot(Vehicle &vehicle, bool enabled=true)
 
void EnableActorConstantVelocity(const Actor &actor, const geom::Vector3D &vector)
 
rpc::VehicleLightStateList GetVehiclesLightStates()
Returns a list of pairs where the firts element is the vehicle ID and the second one is the light sta...
 
std::vector< geom::BoundingBox > GetLightBoxes(const TrafficLight &trafficLight) const
 
std::shared_ptr< Episode > _episode
 
bool DestroyActor(Actor &actor)
 
time_duration GetNetworkingTimeout()
 
void AddPendingException(std::string e)
 
boost::optional< rpc::Actor > GetActorById(ActorId id) const
 
void ApplyAckermannControllerSettings(rpc::ActorId vehicle, const rpc::AckermannControllerSettings &settings)
 
Seting for map generation from opendrive without additional geometry. 
 
void SetLightStateToVehicle(rpc::ActorId vehicle, const rpc::VehicleLightState &light_state)
 
void AddActorImpulse(const Actor &actor, const geom::Vector3D &impulse)
 
void EnableChronoPhysics(Vehicle &vehicle, uint64_t MaxSubsteps, float MaxSubstepDeltaTime, std::string VehicleJSON, std::string PowertrainJSON, std::string TireJSON, std::string BaseJSONPath)
 
bool DestroyActor(ActorId actor_id)
 
std::vector< rpc::LabelledPoint > CastRay(geom::Location start_location, geom::Location end_location) const
 
std::vector< rpc::Actor > GetActorsById(const std::vector< ActorId > &actor_ids) const
 
void ApplyAckermannControlToVehicle(rpc::ActorId vehicle, const rpc::VehicleAckermannControl &control)
 
bool SetFilesBaseFolder(const std::string &path)
 
void SetActorTargetVelocity(rpc::ActorId actor, const geom::Vector3D &vector)
 
void SetActorDead(Actor &actor)
 
void SetActorLocation(rpc::ActorId actor, const geom::Location &location)
 
bool AddTrafficManagerRunning(std::pair< std::string, uint16_t > trafficManagerInfo) const
Informs the server that a Traffic Manager is running on <IP, port> 
 
void ApplyPhysicsControlToVehicle(rpc::ActorId vehicle, const rpc::VehiclePhysicsControl &physics_control)
 
void SetBonesTransform(rpc::ActorId walker, const rpc::WalkerBoneControlIn &bones)
 
std::string ShowRecorderFileInfo(std::string name, bool show_all)
 
void EnableCarSim(rpc::ActorId vehicle, std::string simfile_path)
 
bool AddTrafficManagerRunning(std::pair< std::string, uint16_t > trafficManagerInfo) const
Informs that a Traffic Manager is running on <IP, port> 
 
std::string GetClientVersion()
 
ActorSnapshot GetActorSnapshot(ActorId actor_id) const
 
std::vector< rpc::LightState > QueryLightsStateToServer() const
 
void ShowVehicleDebugTelemetry(rpc::ActorId vehicle, bool enabled)
 
std::shared_ptr< WalkerNavigation > GetNavigation()
 
time_duration GetTimeout() const
 
void SetActorSimulatePhysics(Actor &actor, bool enabled)
 
std::vector< std::string > GetAvailableMaps()
 
void CloseVehicleDoor(rpc::ActorId vehicle, const rpc::VehicleDoor door_idx)
 
void SetTrafficLightState(rpc::ActorId traffic_light, const rpc::TrafficLightState trafficLightState)
 
std ::string GetEndpoint()
 
void UpdateServerLightsState(std::vector< rpc::LightState > &lights, bool discard_client=false) const
 
void SetTrafficLightState(TrafficLight &trafficLight, const rpc::TrafficLightState trafficLightState)
 
rpc::VehiclePhysicsControl GetVehiclePhysicsControl(const Vehicle &vehicle) const
 
void SetActorTransform(rpc::ActorId actor, const geom::Transform &transform)
 
void GetPoseFromAnimation(rpc::ActorId walker)
 
std::string ReplayFile(std::string name, double start, double duration, uint32_t follow_id, bool replay_sensors)
 
SharedPtr< LightManager > GetLightManager() const
 
bool IsEnabledForROS(const Sensor &sensor)
 
void ShowVehicleDebugTelemetry(Vehicle &vehicle, bool enabled=true)
 
void ApplyControlToVehicle(Vehicle &vehicle, const rpc::VehicleControl &control)
 
rpc::AckermannControllerSettings GetAckermannControllerSettings(const Vehicle &vehicle) const
 
void SetActorCollisions(rpc::ActorId actor, bool enabled)
 
std::vector< ActorId > GetGroupTrafficLights(rpc::ActorId traffic_light)
 
float GetWheelSteerAngle(Vehicle &vehicle, rpc::VehicleWheelLocation wheel_location)
 
rpc::AckermannControllerSettings GetAckermannControllerSettings(rpc::ActorId vehicle) const
 
std::vector< std::string > GetNamesOfAllObjects() const
 
void SetTrafficLightYellowTime(rpc::ActorId traffic_light, float yellow_time)
 
std::vector< uint8_t > GetCacheFile(const std::string &name, const bool request_otherwise) const
 
void OpenVehicleDoor(rpc::ActorId vehicle, const rpc::VehicleDoor door_idx)
 
void UpdateDayNightCycle(const bool active) const
 
void EnableActorConstantVelocity(rpc::ActorId actor, const geom::Vector3D &vector)
 
void SetTrafficLightGreenTime(TrafficLight &trafficLight, float greenTime)
 
static SharedPtr< Actor > MakeActor(EpisodeProxy episode, rpc::Actor actor_description, GarbageCollectionPolicy garbage_collection_policy)
Create an Actor based on the provided actor_description. 
 
std::vector< std::string > GetRequiredFiles(const std::string &folder="", const bool download=true) const
 
void SetWeatherParameters(const rpc::WeatherParameters &weather)
 
void ApplyAckermannControllerSettings(Vehicle &vehicle, const rpc::AckermannControllerSettings &settings)
 
void SetLightsToVehicle(Vehicle &vehicle, const rpc::VehicleControl &control)
 
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
 
SharedPtr< LightManager > _light_manager
 
void FreezeTrafficLight(TrafficLight &trafficLight, bool freeze)
 
std::vector< std::pair< ActorId, VehicleLightState::flag_type > > VehicleLightStateList
 
rpc::WalkerBoneControlOut GetBonesTransform(Walker &walker)
 
This file contains definitions of common data structures used in traffic manager. ...
 
const GarbageCollectionPolicy _gc_policy
 
size_t RegisterOnTickEvent(std::function< void(WorldSnapshot)> callback)
 
rpc::EpisodeSettings GetEpisodeSettings()
 
SharedPtr< Actor > GetSpectator()
 
void DrawDebugShape(const rpc::DebugShape &shape)
 
void SetActorDead(rpc::ActorId actor)
 
void ApplyAckermannControlToVehicle(Vehicle &vehicle, const rpc::VehicleAckermannControl &control)
 
boost::optional< geom::Location > GetRandomLocationFromNavigation()
 
Simulator(const std::string &host, uint16_t port, size_t worker_threads=0u, bool enable_garbage_collection=false)
 
std::string ShowRecorderActorsBlocked(std::string name, double min_time, double min_distance)
 
void SetReplayerIgnoreSpectator(bool ignore_spectator)
 
std::vector< ActorId > GetGroupTrafficLights(TrafficLight &trafficLight)
 
void AddActorAngularImpulse(rpc::ActorId actor, const geom::Vector3D &vector)
 
void FreezeTrafficLight(rpc::ActorId traffic_light, bool freeze)
 
EpisodeProxy GetCurrentEpisode()
 
void SetReplayerIgnoreHero(bool ignore_hero)
 
void ResetTrafficLightGroup(rpc::ActorId traffic_light)
 
void SetActorTargetAngularVelocity(const Actor &actor, const geom::Vector3D &vector)
 
std::vector< rpc::EnvironmentObject > GetEnvironmentObjects(uint8_t queried_tag) const
 
bool IsTrafficManagerRunning(uint16_t port) const
Querry to know if a Traffic Manager is running on port. 
 
void AddActorAngularImpulse(const Actor &actor, const geom::Vector3D &vector)
 
void RemoveOnTickEvent(size_t id)
 
void ApplyControlToVehicle(rpc::ActorId vehicle, const rpc::VehicleControl &control)
 
void EnableForROS(const Sensor &sensor)
 
void LoadLevelLayer(rpc::MapLayer map_layer) const
 
SharedPtr< Map > _cached_map
 
void ApplyBatch(std::vector< rpc::Command > commands, bool do_tick_cue)
 
void GetPoseFromAnimation(Walker &walker)
 
void UseCarSimRoad(Vehicle &vehicle, bool enabled)
 
void StopReplayer(bool keep_actors)
 
void SetActorCollisions(Actor &actor, bool enabled)
 
void SetActorLocation(Actor &actor, const geom::Location &location)
 
std::string ShowRecorderActorsBlocked(std::string name, double min_time, double min_distance)
 
uint64_t SetEpisodeSettings(const rpc::EpisodeSettings &settings)
 
void DrawDebugShape(const rpc::DebugShape &shape)
 
#define DEBUG_ASSERT(predicate)
 
rpc::EpisodeSettings GetEpisodeSettings()
 
std::vector< rpc::LabelledPoint > CastRay(geom::Location start_location, geom::Location end_location) const
 
void RemoveLightUpdateChangeEvent(size_t id)
 
void SetReplayerTimeFactor(double time_factor)
 
std::pair< bool, rpc::LabelledPoint > ProjectPoint(geom::Location location, geom::Vector3D direction, float search_distance) const
 
void SetActorAutopilot(rpc::ActorId vehicle, bool enabled)
 
rpc::VehiclePhysicsControl GetVehiclePhysicsControl(rpc::ActorId vehicle) const
 
SharedPtr< Actor > SpawnActor(const ActorBlueprint &blueprint, const geom::Transform &transform, Actor *parent=nullptr, rpc::AttachmentType attachment_type=rpc::AttachmentType::Rigid, GarbageCollectionPolicy gc=GarbageCollectionPolicy::Inherit)
Spawns an actor into the simulation. 
 
std::string StartRecorder(std::string name, bool additional_data)
 
Connects and controls a CARLA Simulator. 
 
rpc::WeatherParameters GetWeatherParameters()
 
void BlendPose(Walker &walker, float blend)
 
void SetTrafficLightRedTime(TrafficLight &trafficLight, float redTime)
 
rpc::ActorState GetActorState(const Actor &actor) const
 
void EnableCarSim(Vehicle &vehicle, std::string simfile_path)
 
void FreezeAllTrafficLights(bool frozen)
 
void EnableEnvironmentObjects(std::vector< uint64_t > env_objects_ids, bool enable) const
 
void BlendPose(rpc::ActorId walker, float blend)
 
std::pair< std::string, uint16_t > GetTrafficManagerRunning(uint16_t port) const
Gets a pair filled with the <IP, port> of the Trafic Manager running on port. 
 
void AddActorForce(const Actor &actor, const geom::Vector3D &force)
 
EpisodeProxy LoadEpisode(std::string map_name, bool reset_settings=true, rpc::MapLayer map_layers=rpc::MapLayer::All)
 
void ApplyColorTextureToObjects(const std::vector< std::string > &objects_name, const rpc::MaterialParameter ¶meter, const rpc::TextureColor &Texture)
– Texture updating operations 
 
std::string GetServerVersion()
 
void EnableChronoPhysics(rpc::ActorId vehicle, uint64_t MaxSubsteps, float MaxSubstepDeltaTime, std::string VehicleJSON, std::string PowertrainJSON, std::string TireJSON, std::string BaseJSONPath)
 
#define RELEASE_ASSERT(pred)
 
void ApplyBatch(std::vector< rpc::Command > commands, bool do_tick_cue)
 
std::vector< geom::BoundingBox > GetLevelBBs(uint8_t queried_tag) const
Returns all the BBs of all the elements of the level. 
 
rpc::ActorState actor_state
 
void OpenVehicleDoor(Vehicle &vehicle, const rpc::VehicleDoor door_idx)
 
float GetWheelSteerAngle(rpc::ActorId vehicle, rpc::VehicleWheelLocation wheel_location)
 
void GetReadyCurrentEpisode()
 
void DestroyTrafficManager(uint16_t port) const
 
EpisodeProxy ReloadEpisode(bool reset_settings=true)
 
std::string ShowRecorderFileInfo(std::string name, bool show_all)
 
void AddActorImpulse(rpc::ActorId actor, const geom::Vector3D &impulse)
 
std::string ShowRecorderCollisions(std::string name, char type1, char type2)
 
void SubscribeToSensor(const Sensor &sensor, std::function< void(SharedPtr< sensor::SensorData >)> callback)
 
void AddActorTorque(const Actor &actor, const geom::Vector3D &torque)
 
void DestroyTrafficManager(uint16_t port) const
 
std::vector< rpc::CommandResponse > ApplyBatchSync(std::vector< rpc::Command > commands, bool do_tick_cue)
 
std::string GetServerVersion()
 
rpc::VehicleLightState GetVehicleLightState(const Vehicle &vehicle) const
 
void ResetAllTrafficLights()
 
void SetTrafficLightRedTime(rpc::ActorId traffic_light, float red_time)
 
rpc::VehicleLightState GetVehicleLightState(rpc::ActorId vehicle) const
 
geom::Vector3D GetActorAngularVelocity(const Actor &actor) const
 
void UnSubscribeFromSensor(Actor &sensor)
 
SharedPtr< Actor > MakeActor(rpc::Actor actor_description, GarbageCollectionPolicy gc=GarbageCollectionPolicy::Disabled)
Creates an actor instance out of a description of an existing actor. 
 
void UpdateServerLightsState(std::vector< rpc::LightState > &lights, bool discard_client=false) const
 
void SetTimeout(time_duration timeout)
 
void SetActorTargetAngularVelocity(rpc::ActorId actor, const geom::Vector3D &vector)
 
void ResetAllTrafficLights()
 
GarbageCollectionPolicy GetGarbageCollectionPolicy() const
 
void SetActorEnableGravity(Actor &actor, bool enabled)
 
Provides communication with the rpc and streaming servers of a CARLA simulator. 
 
geom::Transform transform
 
WorldSnapshot GetWorldSnapshot() const
 
void SetNetworkingTimeout(time_duration timeout)
 
void UpdateDayNightCycle(const bool active) const
 
std::string ReplayFile(std::string name, double start, double duration, uint32_t follow_id, bool replay_sensors)
 
size_t RegisterLightUpdateChangeEvent(std::function< void(WorldSnapshot)> callback)
 
void CloseVehicleDoor(Vehicle &vehicle, const rpc::VehicleDoor door_idx)
 
void UnloadLevelLayer(rpc::MapLayer map_layer) const
 
void UnregisterAIController(const WalkerAIController &controller)
 
void DisableForROS(const Sensor &sensor)
 
void SetActorSimulatePhysics(rpc::ActorId actor, bool enabled)
 
std::vector< rpc::LightState > QueryLightsStateToServer() const
 
void UseCarSimRoad(rpc::ActorId vehicle, bool enabled)
 
void SetReplayerIgnoreSpectator(bool ignore_spectator)
 
uint64_t Tick(time_duration timeout)
 
SharedPtr< Map > GetCurrentMap()
 
bool DestroyActor(rpc::ActorId actor)
 
void SetWeatherParameters(const rpc::WeatherParameters &weather)
 
void ApplyControlToWalker(Walker &walker, const rpc::WalkerControl &control)
 
EpisodeProxy LoadOpenDriveEpisode(std::string opendrive, const rpc::OpendriveGenerationParameters ¶ms, bool reset_settings=true)
 
Represents an actor in the simulation. 
 
rpc::WalkerBoneControlOut GetBonesTransform(rpc::ActorId walker)
 
geom::Vector3D angular_velocity
 
void SetActorCollisions(ActorId actor_id, bool enabled)
 
void SetReplayerIgnoreHero(bool ignore_hero)
 
void SetLightStateToVehicle(Vehicle &vehicle, const rpc::VehicleLightState light_state)
 
void RequestFile(const std::string &name) const
 
std::pair< std::string, uint16_t > GetTrafficManagerRunning(uint16_t port) const
Gets a pair filled with the <IP, port> of the Trafic Manager running on port. 
 
Positive time duration up to milliseconds resolution. 
 
geom::Location GetActorLocation(const Actor &actor) const
 
std::vector< geom::BoundingBox > GetLightBoxes(rpc::ActorId traffic_light) const
 
void SetTrafficLightYellowTime(TrafficLight &trafficLight, float yellowTime)
 
void SetTrafficLightGreenTime(rpc::ActorId traffic_light, float green_time)
 
void SetActorTransform(Actor &actor, const geom::Transform &transform)
 
void StopReplayer(bool keep_actors)
 
void SetBonesTransform(Walker &walker, const rpc::WalkerBoneControlIn &bones)
 
void SetWheelSteerDirection(Vehicle &vehicle, rpc::VehicleWheelLocation wheel_location, float angle_in_deg)
 
std::string ShowRecorderCollisions(std::string name, char type1, char type2)
 
std::vector< rpc::EnvironmentObject > GetEnvironmentObjects(uint8_t queried_tag) const
 
std::vector< rpc::Actor > GetAllTheActorsInTheEpisode() const
 
void UnloadLevelLayer(rpc::MapLayer map_layers) const
 
auto GetCurrentEpisodeId()
 
Contains all the necessary information for spawning an Actor. 
 
void RegisterAIController(const WalkerAIController &controller)
 
geom::Vector3D GetActorAcceleration(const Actor &actor) const
 
void SetActorEnableGravity(rpc::ActorId actor, bool enabled)
 
void AddActorImpulse(const Actor &actor, const geom::Vector3D &impulse, const geom::Vector3D &location)
 
void SetPedestriansCrossFactor(float percentage)
 
std::string GetClientVersion()
 
void SubscribeToGBuffer(Actor &sensor, uint32_t gbuffer_id, std::function< void(SharedPtr< sensor::SensorData >)> callback)
 
SharedPtr< BlueprintLibrary > GetBlueprintLibrary()
 
void SetActorDead(ActorId actor_id)
 
std::pair< bool, rpc::LabelledPoint > ProjectPoint(geom::Location location, geom::Vector3D direction, float search_distance) const
 
void AddActorForce(rpc::ActorId actor, const geom::Vector3D &force)
 
ActorSnapshot GetActorSnapshot(const Actor &actor) const
 
geom::Vector3D GetActorVelocity(const Actor &actor) const
 
void SetWheelSteerDirection(rpc::ActorId vehicle, rpc::VehicleWheelLocation vehicle_wheel, float angle_in_deg)
 
auto ApplyBatchSync(std::vector< rpc::Command > commands, bool do_tick_cue)
 
Inherit (privately) to suppress copy/move construction and assignment. 
 
void AddActorForce(const Actor &actor, const geom::Vector3D &force, const geom::Vector3D &location)
 
Defines the physical appearance of a vehicle whitch is obtained by the sensors. 
 
void ApplyControlToWalker(rpc::ActorId walker, const rpc::WalkerControl &control)
 
void UnSubscribeFromGBuffer(Actor &sensor, uint32_t gbuffer_id)
 
bool ShouldUpdateMap(rpc::MapInfo &map_info)
 
std::string StartRecorder(std::string name, bool additional_data)
 
const std::string GetEndpoint() const
 
void ApplyPhysicsControlToVehicle(Vehicle &vehicle, const rpc::VehiclePhysicsControl &physicsControl)
 
void EnableEnvironmentObjects(std::vector< uint64_t > env_objects_ids, bool enable) const
 
geom::Vector3D acceleration
 
void SetActorTargetVelocity(const Actor &actor, const geom::Vector3D &vector)
 
rpc::WeatherParameters GetWeatherParameters()
 
void LoadLevelLayer(rpc::MapLayer map_layers) const
 
void SetPedestriansSeed(unsigned int seed)
 
void ResetTrafficLightGroup(TrafficLight &trafficLight)
 
WorldSnapshot WaitForTick(time_duration timeout)
 
std::string _open_drive_file
 
bool IsTrafficManagerRunning(uint16_t port) const
Query to know if a Traffic Manager is running on port. 
 
void SetReplayerTimeFactor(double time_factor)
 
void DisableActorConstantVelocity(rpc::ActorId actor)
 
std::vector< std::string > GetAvailableMaps()
 
std::vector< geom::BoundingBox > GetLevelBBs(uint8_t queried_tag) const
Returns all the BBs of all the elements of the level. 
 
geom::Transform GetActorTransform(const Actor &actor) const