12#include <rpc/client.h>
15namespace traffic_manager {
52 const std::string &_host,
53 const uint16_t &_port)
63 _client->set_timeout(TM_TIMEOUT);
95 _client->call(
"register_vehicle", std::move(actor_list));
102 _client->call(
"unregister_vehicle", std::move(actor_list));
111 _client->call(
"set_percentage_speed_difference", std::move(_actor), percentage);
120 _client->call(
"set_lane_offset", std::move(_actor), offset);
128 _client->call(
"set_desired_speed", std::move(_actor), value);
136 _client->call(
"set_global_percentage_speed_difference", percentage);
144 _client->call(
"set_global_lane_offset", offset);
152 _client->call(
"update_vehicle_lights", std::move(_actor), do_update);
161 _client->call(
"set_collision_detection", reference_actor, other_actor, detect_collision);
169 _client->call(
"set_force_lane_change", actor, direction);
177 _client->call(
"set_auto_lane_change", actor, enable);
185 _client->call(
"set_distance_to_leading_vehicle", actor, distance);
193 _client->call(
"set_percentage_ignore_walkers", actor, percentage);
201 _client->call(
"set_percentage_ignore_vehicles", actor, percentage);
209 _client->call(
"set_percentage_running_light", actor, percentage);
217 _client->call(
"set_percentage_running_sign", actor, percentage);
224 _client->call(
"set_synchronous_mode", mode);
230 _client->call(
"set_synchronous_mode_timeout_in_milisecond", time);
236 return _client->call(
"synchronous_tick").as<
bool>();
242 _client->call(
"health_check_remote_TM");
248 _client->call(
"set_global_distance_to_leading_vehicle",distance);
254 _client->call(
"keep_right_rule_percentage", actor, percentage);
260 _client->call(
"random_left_lanechange_percentage", actor, percentage);
266 _client->call(
"random_right_lanechange_percentage", actor, percentage);
272 _client->call(
"set_hybrid_physics_mode", mode_switch);
278 _client->call(
"set_hybrid_physics_radius", radius);
284 _client->call(
"set_random_device_seed", seed);
290 _client->call(
"set_osm_mode", mode_switch);
296 _client->call(
"set_path", actor, path, empty_buffer);
302 _client->call(
"remove_custom_path", actor_id, remove_path);
308 _client->call(
"update_custom_path", actor_id, path);
314 _client->call(
"set_imported_route", actor, route, empty_buffer);
320 _client->call(
"remove_imported_route", actor_id, remove_path);
326 _client->call(
"update_imported_route", actor_id, route);
332 _client->call(
"set_respawn_dormant_vehicles", mode_switch);
338 _client->call(
"set_boundaries_respawn_dormant_vehicles", lower_bound, upper_bound);
344 _client->call(
"set_max_boundaries", lower, upper);
350 _client->call(
"get_next_action", actor_id);
357 _client->call(
"get_all_actions", actor_id);
#define DEBUG_ASSERT(predicate)
提供与TrafficManagerServer的RPC通信功能。
void SetGlobalLaneOffset(const float offset)
设置全局车道偏移量,相对于中心线。
Action GetNextAction(const ActorId &actor_id)
获取车辆下一个动作的方法
void HealthCheckRemoteTM()
检查远程交通管理器(TM)是否存活
TrafficManagerClient & operator=(TrafficManagerClient &&)=default
移动赋值运算符,默认实现。
void SetPercentageIgnoreWalkers(const carla::rpc::Actor &actor, const float percentage)
设置车辆忽略行人的碰撞概率。
void SetDesiredSpeed(const carla::rpc::Actor &_actor, const float value)
设置车辆的精确期望速度。
void SetGlobalPercentageSpeedDifference(const float percentage)
设置全局相对于限速的速度百分比差异。
TrafficManagerClient(TrafficManagerClient &&)=default
移动构造函数,默认实现。
void SetMaxBoundaries(const float lower, const float upper)
设置最大边界的方法
void SetBoundariesRespawnDormantVehicles(const float lower_bound, const float upper_bound)
设置重生车辆的边界的方法
TrafficManagerClient & operator=(const TrafficManagerClient &)=default
拷贝赋值运算符,默认实现。
void SetRandomDeviceSeed(const uint64_t seed)
设置随机化种子
void SetKeepRightPercentage(const carla::rpc::Actor &actor, const float percentage)
设置车辆保持在右侧车道的百分比
void SetSynchronousMode(const bool mode)
将交通管理器切换为同步执行模式。
TrafficManagerClient(const TrafficManagerClient &)=default
拷贝构造函数,默认实现。
ActionBuffer GetActionBuffer(const ActorId &actor_id)
获取车辆动作缓冲区的方法
void RemoveUploadPath(const ActorId &actor_id, const bool remove_path)
移除一系列点(路径)
void SetPercentageRunningLight(const carla::rpc::Actor &actor, const float percentage)
设置车辆闯红灯的概率。
void RegisterVehicle(const std::vector< carla::rpc::Actor > &actor_list)
通过RPC客户端向远程交通管理服务器注册车辆。
void UnregisterVehicle(const std::vector< carla::rpc::Actor > &actor_list)
通过RPC客户端从远程交通管理服务器注销车辆。
void SetOSMMode(const bool mode_switch)
设置Open Street Map模式
void getServerDetails(std::string &_host, uint16_t &_port)
获取服务器详细信息。
void SetPercentageSpeedDifference(const carla::rpc::Actor &_actor, const float percentage)
设置车辆相对于限速的速度百分比差异。
void SetCustomPath(const carla::rpc::Actor &actor, const Path path, const bool empty_buffer)
设置自定义路径
void UpdateImportedRoute(const ActorId &actor_id, const Route route)
更新已设置的导入路线的方法
void SetUpdateVehicleLights(const carla::rpc::Actor &_actor, const bool do_update)
设置车辆灯光的自动管理。
void SetRandomRightLaneChangePercentage(const carla::rpc::Actor &actor, const float percentage)
设置车辆随机进行右车道变换的百分比
void SetPercentageIgnoreVehicles(const carla::rpc::Actor &actor, const float percentage)
设置车辆忽略其他车辆的碰撞概率。
void SetForceLaneChange(const carla::rpc::Actor &actor, const bool direction)
强制车辆换道。
void SetDistanceToLeadingVehicle(const carla::rpc::Actor &actor, const float distance)
设置车辆与前车应保持的距离。
void SetLaneOffset(const carla::rpc::Actor &_actor, const float offset)
设置车辆相对于中心线的车道偏移量。
void SetSynchronousModeTimeOutInMiliSecond(const double time)
设置同步执行模式下的超时时间(以毫秒为单位)
void SetAutoLaneChange(const carla::rpc::Actor &actor, const bool enable)
启用/禁用车辆的自动换道功能。
void SetPercentageRunningSign(const carla::rpc::Actor &actor, const float percentage)
设置车辆无视任何交通标志的概率。
void setServerDetails(const std::string &_host, const uint16_t &_port)
设置服务器详细信息。
::rpc::client * _client
RPC客户端
void SetRandomLeftLaneChangePercentage(const carla::rpc::Actor &actor, const float percentage)
设置车辆随机进行左车道变换的百分比
void SetImportedRoute(const carla::rpc::Actor &actor, const Route route, const bool empty_buffer)
设置我们自己的导入路线的方法
void SetHybridPhysicsRadius(const float radius)
设置混合物理模式的半径
void SetGlobalDistanceToLeadingVehicle(const float distance)
设置全局领航车辆应保持的距离
TrafficManagerClient(const std::string &_host, const uint16_t &_port)
参数化构造函数,用于初始化连接参数。
void UpdateUploadPath(const ActorId &actor_id, const Path path)
更新已设置的点列表的方法
void SetHybridPhysicsMode(const bool mode_switch)
设置混合物理模式
~TrafficManagerClient()
析构函数,用于清理资源
bool SynchronousTick()
提供同步滴答(tick)操作
void SetCollisionDetection(const carla::rpc::Actor &reference_actor, const carla::rpc::Actor &other_actor, const bool detect_collision)
设置车辆间的碰撞检测规则。
void SetRespawnDormantVehicles(const bool mode_switch)
设置休眠车辆的自动重生模式的方法
void RemoveImportedRoute(const ActorId &actor_id, const bool remove_path)
移除路线的方法
std::string tmhost
服务器端口和主机
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
动作类型别名。
carla::ActorId ActorId
参与者的智能指针类型