12 #include <rpc/client.h> 15 namespace traffic_manager {
33 const std::string &_host,
34 const uint16_t &_port)
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);
static const unsigned short TM_DEFAULT_PORT
void SetForceLaneChange(const carla::rpc::Actor &actor, const bool direction)
Method to force lane change on a vehicle.
void SetUpdateVehicleLights(const carla::rpc::Actor &_actor, const bool do_update)
Method to set the automatic management of the vehicle lights.
void SetOSMMode(const bool mode_switch)
Method to set Open Street Map mode.
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 setServerDetails(const std::string &_host, const uint16_t &_port)
Set parameters.
void SetKeepRightPercentage(const carla::rpc::Actor &actor, const float percentage)
Method to set % to keep on the right lane.
std::vector< cg::Location > Path
void SetLaneOffset(const carla::rpc::Actor &_actor, const float offset)
Method to set a lane offset displacement from the center line.
This file contains definitions of common data structures used in traffic manager. ...
void SetPercentageIgnoreWalkers(const carla::rpc::Actor &actor, const float percentage)
Method to specify the % chance of ignoring collisions with any walker.
::rpc::client * _client
RPC client.
void SetSynchronousMode(const bool mode)
Method to switch traffic manager into synchronous execution.
void SetRandomDeviceSeed(const uint64_t seed)
Method to set randomization seed.
void SetGlobalLaneOffset(const float offset)
Method to set a global lane offset displacement from the center line.
TrafficManagerClient & operator=(const TrafficManagerClient &)=default
std::string tmhost
Server port and host.
Action GetNextAction(const ActorId &actor_id)
Method to get the vehicle's next action.
void SetHybridPhysicsMode(const bool mode_switch)
Method to set hybrid physics mode.
#define DEBUG_ASSERT(predicate)
void SetHybridPhysicsRadius(const float radius)
Method to set hybrid physics mode.
std::pair< RoadOption, WaypointPtr > Action
void HealthCheckRemoteTM()
Check if remote traffic manager is alive.
void SetDesiredSpeed(const carla::rpc::Actor &_actor, const float value)
Set a vehicle's exact desired velocity.
void RemoveImportedRoute(const ActorId &actor_id, const bool remove_path)
Method to remove a route.
void UpdateUploadPath(const ActorId &actor_id, const Path path)
Method to update an already set list of points.
void SetPercentageRunningLight(const carla::rpc::Actor &actor, const float percentage)
Method to specify the % chance of running a traffic sign.
TrafficManagerClient(const std::string &_host, const uint16_t &_port)
Parametric constructor to initialize the parameters.
static const int64_t TM_TIMEOUT
void SetPercentageIgnoreVehicles(const carla::rpc::Actor &actor, const float percentage)
Method to specify the % chance of ignoring collisions with any vehicle.
std::vector< uint8_t > Route
void getServerDetails(std::string &_host, uint16_t &_port)
Get parameters.
Provides communication with the rpc of TrafficManagerServer.
void RemoveUploadPath(const ActorId &actor_id, const bool remove_path)
Method to remove a list of points.
void UpdateImportedRoute(const ActorId &actor_id, const Route route)
Method to update an already set list of points.
void SetRespawnDormantVehicles(const bool mode_switch)
Method to set automatic respawn of dormant vehicles.
void SetGlobalDistanceToLeadingVehicle(const float distance)
Method to specify how much distance a vehicle should maintain to the Global leading vehicle...
void SetRandomLeftLaneChangePercentage(const carla::rpc::Actor &actor, const float percentage)
Method to set % to randomly do a left lane change.
void RegisterVehicle(const std::vector< carla::rpc::Actor > &actor_list)
Register vehicles to remote traffic manager server via RPC client.
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 SetPercentageRunningSign(const carla::rpc::Actor &actor, const float percentage)
Method to specify the % chance of running any traffic sign.
void SetCustomPath(const carla::rpc::Actor &actor, const Path path, const bool empty_buffer)
Method to set our own imported path.
~TrafficManagerClient()
Destructor method.
void UnregisterVehicle(const std::vector< carla::rpc::Actor > &actor_list)
Unregister vehicles to remote traffic manager server via RPC client.
ActionBuffer GetActionBuffer(const ActorId &actor_id)
Method to get the vehicle's action buffer.
void SetGlobalPercentageSpeedDifference(const float percentage)
Method to set a global % decrease in velocity with respect to the speed limit.
void SetRandomRightLaneChangePercentage(const carla::rpc::Actor &actor, const float percentage)
Method to set % to randomly do a right lane change.
std::vector< Action > ActionBuffer
void SetDistanceToLeadingVehicle(const carla::rpc::Actor &actor, const float distance)
Method to specify how much distance a vehicle should maintain to the leading vehicle.
bool SynchronousTick()
Method to provide synchronous tick.
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 SetMaxBoundaries(const float lower, const float upper)
Method to set boundaries for respawning vehicles.
void SetImportedRoute(const carla::rpc::Actor &actor, const Route route, const bool empty_buffer)
Method to set our own imported route.
TrafficManagerClient(const TrafficManagerClient &)=default
void SetBoundariesRespawnDormantVehicles(const float lower_bound, const float upper_bound)
Method to set boundaries for respawning vehicles.