12#include <rpc/client.h>
15namespace traffic_manager {
33 const std::string &_host,
34 const uint16_t &_port)
41 _client->set_timeout(TM_TIMEOUT);
68 _client->call(
"register_vehicle", std::move(actor_list));
74 _client->call(
"unregister_vehicle", std::move(actor_list));
81 _client->call(
"set_percentage_speed_difference", std::move(_actor), percentage);
88 _client->call(
"set_lane_offset", std::move(_actor), offset);
94 _client->call(
"set_desired_speed", std::move(_actor), value);
101 _client->call(
"set_global_percentage_speed_difference", percentage);
108 _client->call(
"set_global_lane_offset", offset);
114 _client->call(
"update_vehicle_lights", std::move(_actor), do_update);
120 _client->call(
"set_collision_detection", reference_actor, other_actor, detect_collision);
127 _client->call(
"set_force_lane_change", actor, direction);
133 _client->call(
"set_auto_lane_change", actor, enable);
140 _client->call(
"set_distance_to_leading_vehicle", actor, distance);
146 _client->call(
"set_percentage_ignore_walkers", actor, percentage);
152 _client->call(
"set_percentage_ignore_vehicles", actor, percentage);
158 _client->call(
"set_percentage_running_light", actor, percentage);
164 _client->call(
"set_percentage_running_sign", actor, percentage);
170 _client->call(
"set_synchronous_mode", mode);
176 _client->call(
"set_synchronous_mode_timeout_in_milisecond", time);
182 return _client->call(
"synchronous_tick").as<
bool>();
188 _client->call(
"health_check_remote_TM");
195 _client->call(
"set_global_distance_to_leading_vehicle",distance);
201 _client->call(
"keep_right_rule_percentage", actor, percentage);
207 _client->call(
"random_left_lanechange_percentage", actor, percentage);
213 _client->call(
"random_right_lanechange_percentage", actor, percentage);
219 _client->call(
"set_hybrid_physics_mode", mode_switch);
225 _client->call(
"set_hybrid_physics_radius", radius);
231 _client->call(
"set_random_device_seed", seed);
237 _client->call(
"set_osm_mode", mode_switch);
243 _client->call(
"set_path", actor, path, empty_buffer);
249 _client->call(
"remove_custom_path", actor_id, remove_path);
255 _client->call(
"update_custom_path", actor_id, path);
261 _client->call(
"set_imported_route", actor, route, empty_buffer);
267 _client->call(
"remove_imported_route", actor_id, remove_path);
273 _client->call(
"update_imported_route", actor_id, route);
279 _client->call(
"set_respawn_dormant_vehicles", mode_switch);
285 _client->call(
"set_boundaries_respawn_dormant_vehicles", lower_bound, upper_bound);
291 _client->call(
"set_max_boundaries", lower, upper);
297 _client->call(
"get_next_action", actor_id);
304 _client->call(
"get_all_actions", actor_id);
#define DEBUG_ASSERT(predicate)
Provides communication with the rpc of TrafficManagerServer.
void SetGlobalLaneOffset(const float offset)
Method to set a global lane offset displacement from the center line.
Action GetNextAction(const ActorId &actor_id)
Method to get the vehicle's next action.
void HealthCheckRemoteTM()
Check if remote traffic manager is alive
TrafficManagerClient & operator=(TrafficManagerClient &&)=default
void SetPercentageIgnoreWalkers(const carla::rpc::Actor &actor, const float percentage)
Method to specify the % chance of ignoring collisions with any walker.
void SetDesiredSpeed(const carla::rpc::Actor &_actor, const float value)
Set a vehicle's exact desired velocity.
void SetGlobalPercentageSpeedDifference(const float percentage)
Method to set a global % decrease in velocity with respect to the speed limit.
TrafficManagerClient(TrafficManagerClient &&)=default
void SetMaxBoundaries(const float lower, const float upper)
Method to set boundaries for respawning vehicles.
void SetBoundariesRespawnDormantVehicles(const float lower_bound, const float upper_bound)
Method to set boundaries for respawning vehicles.
TrafficManagerClient & operator=(const TrafficManagerClient &)=default
void SetRandomDeviceSeed(const uint64_t seed)
Method to set randomization seed.
void SetKeepRightPercentage(const carla::rpc::Actor &actor, const float percentage)
Method to set % to keep on the right lane.
void SetSynchronousMode(const bool mode)
Method to switch traffic manager into synchronous execution.
TrafficManagerClient(const TrafficManagerClient &)=default
ActionBuffer GetActionBuffer(const ActorId &actor_id)
Method to get the vehicle's action buffer.
void RemoveUploadPath(const ActorId &actor_id, const bool remove_path)
Method to remove a list of points.
void SetPercentageRunningLight(const carla::rpc::Actor &actor, const float percentage)
Method to specify the % chance of running a traffic sign.
void RegisterVehicle(const std::vector< carla::rpc::Actor > &actor_list)
Register vehicles to remote traffic manager server via RPC client.
void UnregisterVehicle(const std::vector< carla::rpc::Actor > &actor_list)
Unregister vehicles to remote traffic manager server via RPC client.
void SetOSMMode(const bool mode_switch)
Method to set Open Street Map mode.
void getServerDetails(std::string &_host, uint16_t &_port)
Get parameters.
void SetPercentageSpeedDifference(const carla::rpc::Actor &_actor, const float percentage)
Method to set a vehicle's % decrease in velocity with respect to the speed limit.
void SetCustomPath(const carla::rpc::Actor &actor, const Path path, const bool empty_buffer)
Method to set our own imported path.
void UpdateImportedRoute(const ActorId &actor_id, const Route route)
Method to update an already set list of points.
void SetUpdateVehicleLights(const carla::rpc::Actor &_actor, const bool do_update)
Method to set the automatic management of the vehicle lights
void SetRandomRightLaneChangePercentage(const carla::rpc::Actor &actor, const float percentage)
Method to set % to randomly do a right lane change.
void SetPercentageIgnoreVehicles(const carla::rpc::Actor &actor, const float percentage)
Method to specify the % chance of ignoring collisions with any vehicle.
void SetForceLaneChange(const carla::rpc::Actor &actor, const bool direction)
Method to force lane change on a vehicle.
void SetDistanceToLeadingVehicle(const carla::rpc::Actor &actor, const float distance)
Method to specify how much distance a vehicle should maintain to the leading vehicle.
void SetLaneOffset(const carla::rpc::Actor &_actor, const float offset)
Method to set a lane offset displacement from the center line.
void SetSynchronousModeTimeOutInMiliSecond(const double time)
Method to set tick timeout for synchronous execution.
void SetAutoLaneChange(const carla::rpc::Actor &actor, const bool enable)
Enable/disable automatic lane change on a vehicle.
void SetPercentageRunningSign(const carla::rpc::Actor &actor, const float percentage)
Method to specify the % chance of running any traffic sign.
void setServerDetails(const std::string &_host, const uint16_t &_port)
Set parameters.
::rpc::client * _client
RPC client.
void SetRandomLeftLaneChangePercentage(const carla::rpc::Actor &actor, const float percentage)
Method to set % to randomly do a left lane change.
void SetImportedRoute(const carla::rpc::Actor &actor, const Route route, const bool empty_buffer)
Method to set our own imported route.
void SetHybridPhysicsRadius(const float radius)
Method to set hybrid physics mode.
void SetGlobalDistanceToLeadingVehicle(const float distance)
Method to specify how much distance a vehicle should maintain to the Global leading vehicle.
TrafficManagerClient(const std::string &_host, const uint16_t &_port)
Parametric constructor to initialize the parameters.
void UpdateUploadPath(const ActorId &actor_id, const Path path)
Method to update an already set list of points.
void SetHybridPhysicsMode(const bool mode_switch)
Method to set hybrid physics mode.
~TrafficManagerClient()
Destructor method.
bool SynchronousTick()
Method to provide synchronous tick.
void SetCollisionDetection(const carla::rpc::Actor &reference_actor, const carla::rpc::Actor &other_actor, const bool detect_collision)
Method to set collision detection rules between vehicles.
void SetRespawnDormantVehicles(const bool mode_switch)
Method to set automatic respawn of dormant vehicles.
void RemoveImportedRoute(const ActorId &actor_id, const bool remove_path)
Method to remove a route.
std::string tmhost
Server port and host.
static const unsigned short TM_DEFAULT_PORT
static const int64_t TM_TIMEOUT
std::vector< uint8_t > Route
std::vector< cg::Location > Path
std::vector< Action > ActionBuffer
std::pair< RoadOption, WaypointPtr > Action
This file contains definitions of common data structures used in traffic manager.