30 const std::string &host,
32 size_t worker_threads = 0u);
37 _simulator->SetNetworkingTimeout(timeout);
41 return _simulator->GetNetworkingTimeout();
46 return _simulator->GetClientVersion();
51 return _simulator->GetServerVersion();
55 return _simulator->GetAvailableMaps();
59 return _simulator->SetFilesBaseFolder(path);
62 std::vector<std::string>
GetRequiredFiles(
const std::string &folder =
"",
const bool download =
true)
const {
63 return _simulator->GetRequiredFiles(folder, download);
67 _simulator->RequestFile(name);
71 return World{_simulator->ReloadEpisode(reset_settings)};
76 bool reset_settings =
true,
78 return World{_simulator->LoadEpisode(std::move(map_name), reset_settings, map_layers)};
85 bool reset_settings =
true,
89 std::string current_map_name = current_map->GetName();
90 std::string map_name_prefix =
"Carla/Maps/";
91 std::string map_name_without_prefix = map_name;
92 std::string map_name_with_prefix = map_name_prefix + map_name;
93 if(!(map_name_without_prefix == current_map_name) && !(map_name_with_prefix == current_map_name)){
94 World World{_simulator->LoadEpisode(std::move(map_name), reset_settings, map_layers)};
99 std::string opendrive,
101 bool reset_settings =
true)
const {
102 return World{_simulator->LoadOpenDriveEpisode(
103 std::move(opendrive), params, reset_settings)};
108 return World{_simulator->GetCurrentEpisode()};
118 return _simulator->GetCurrentEpisode();
122 return _simulator->StartRecorder(name, additional_data);
126 _simulator->StopRecorder();
130 return _simulator->ShowRecorderFileInfo(name, show_all);
134 return _simulator->ShowRecorderCollisions(name, type1, type2);
138 return _simulator->ShowRecorderActorsBlocked(name, min_time, min_distance);
141 std::string
ReplayFile(std::string name,
double start,
double duration,
142 uint32_t follow_id,
bool replay_sensors) {
143 return _simulator->ReplayFile(name, start, duration, follow_id, replay_sensors);
147 _simulator->StopReplayer(keep_actors);
151 _simulator->SetReplayerTimeFactor(time_factor);
155 _simulator->SetReplayerIgnoreHero(ignore_hero);
159 _simulator->SetReplayerIgnoreSpectator(ignore_spectator);
163 std::vector<rpc::Command> commands,
164 bool do_tick_cue =
false)
const {
165 _simulator->ApplyBatch(std::move(commands), do_tick_cue);
169 std::vector<rpc::Command> commands,
170 bool do_tick_cue =
false)
const {
171 auto responses = _simulator->ApplyBatchSync(std::move(commands),
false);
173 _simulator->Tick(_simulator->GetNetworkingTimeout());
184 const std::string &host,
186 size_t worker_threads)
188 new detail::Simulator(host, port, worker_threads),
World ReloadWorld(bool reset_settings=true) const
bool SetFilesBaseFolder(const std::string &path)
Seting for map generation from opendrive without additional geometry.
std::vector< std::string > GetRequiredFiles(const std::string &folder="", const bool download=true) const
std::vector< rpc::CommandResponse > ApplyBatchSync(std::vector< rpc::Command > commands, bool do_tick_cue=false) const
void SetReplayerIgnoreHero(bool ignore_hero)
void SetReplayerTimeFactor(double time_factor)
static const unsigned short TM_DEFAULT_PORT
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
This file contains definitions of common data structures used in traffic manager. ...
SharedPtr< Map > GetMap() const
Return the map that describes this world.
std::vector< std::string > GetAvailableMaps() const
World GetWorld() const
Return an instance of the world currently active in the simulator.
std::string ShowRecorderCollisions(std::string name, char type1, char type2)
std::string GetClientVersion() const
Return the version string of this client API.
std::string ReplayFile(std::string name, double start, double duration, uint32_t follow_id, bool replay_sensors)
std::string StartRecorder(std::string name, bool additional_data=false)
std::shared_ptr< detail::Simulator > _simulator
This class integrates all the various stages of the traffic manager appropriately using messengers...
Client(const std::string &host, uint16_t port, size_t worker_threads=0u)
Construct a carla client.
World GenerateOpenDriveWorld(std::string opendrive, const rpc::OpendriveGenerationParameters ¶ms, bool reset_settings=true) const
std::string ShowRecorderActorsBlocked(std::string name, double min_time, double min_distance)
World LoadWorld(std::string map_name, bool reset_settings=true, rpc::MapLayer map_layers=rpc::MapLayer::All) const
carla::client::detail::EpisodeProxy GetCurrentEpisode() const
Return an instance of the Episode currently active in the simulator.
TrafficManager GetInstanceTM(uint16_t port=TM_DEFAULT_PORT) const
Return an instance of the TrafficManager currently active in the simulator.
Positive time duration up to milliseconds resolution.
std::string GetServerVersion() const
Return the version string of the simulator we are connected to.
void SetReplayerIgnoreSpectator(bool ignore_spectator)
void LoadWorldIfDifferent(std::string map_name, bool reset_settings=true, rpc::MapLayer map_layers=rpc::MapLayer::All) const
Return (and load) a new world (map) only when the requested map is different from the current one...
std::string ShowRecorderFileInfo(std::string name, bool show_all)
void RequestFile(const std::string &name) const
void SetTimeout(time_duration timeout)
Set a timeout for networking operations.
void StopReplayer(bool keep_actors)
void ApplyBatch(std::vector< rpc::Command > commands, bool do_tick_cue=false) const
time_duration GetTimeout()