Add keyword arguments for carla.TrafficManager Python API functions (#6246)

* Update TrafficManager.cpp

* Update CHANGELOG.md

* Remove all default values except for set_path and set_route
This commit is contained in:
xqgex 2023-03-09 03:53:51 -05:00 committed by GitHub
parent 34469375c7
commit 3ea23d6826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 29 deletions

View File

@ -8,6 +8,7 @@
* `Client.set_replayer_ignore_spectator(bool)` * `Client.set_replayer_ignore_spectator(bool)`
* `start_replaying.py` using flag `--move-spectator` * `start_replaying.py` using flag `--move-spectator`
* Added maps, vehicles, pedestrians and props catalogues to the documentation * Added maps, vehicles, pedestrians and props catalogues to the documentation
* Add keyword arguments for `carla.TrafficManager` Python API functions
## CARLA 0.9.14 ## CARLA 0.9.14

View File

@ -86,34 +86,34 @@ void export_trafficmanager() {
class_<ctm::TrafficManager>("TrafficManager", no_init) class_<ctm::TrafficManager>("TrafficManager", no_init)
.def("get_port", &ctm::TrafficManager::Port) .def("get_port", &ctm::TrafficManager::Port)
.def("vehicle_percentage_speed_difference", &ctm::TrafficManager::SetPercentageSpeedDifference) .def("vehicle_percentage_speed_difference", &ctm::TrafficManager::SetPercentageSpeedDifference, (arg("actor"), arg("percentage")))
.def("vehicle_lane_offset", &ctm::TrafficManager::SetLaneOffset) .def("vehicle_lane_offset", &ctm::TrafficManager::SetLaneOffset, (arg("actor"), arg("offset")))
.def("set_desired_speed", &ctm::TrafficManager::SetDesiredSpeed) .def("set_desired_speed", &ctm::TrafficManager::SetDesiredSpeed, (arg("actor"), arg("speed")))
.def("global_percentage_speed_difference", &ctm::TrafficManager::SetGlobalPercentageSpeedDifference) .def("global_percentage_speed_difference", &ctm::TrafficManager::SetGlobalPercentageSpeedDifference, (arg("percentage")))
.def("global_lane_offset", &ctm::TrafficManager::SetGlobalLaneOffset) .def("global_lane_offset", &ctm::TrafficManager::SetGlobalLaneOffset, (arg("offset")))
.def("update_vehicle_lights", &ctm::TrafficManager::SetUpdateVehicleLights) .def("update_vehicle_lights", &ctm::TrafficManager::SetUpdateVehicleLights, (arg("actor"), arg("do_update")))
.def("collision_detection", &ctm::TrafficManager::SetCollisionDetection) .def("collision_detection", &ctm::TrafficManager::SetCollisionDetection, (arg("reference_actor"), arg("other_actor"), arg("detect_collision")))
.def("force_lane_change", &ctm::TrafficManager::SetForceLaneChange) .def("force_lane_change", &ctm::TrafficManager::SetForceLaneChange, (arg("actor"), arg("direction")))
.def("auto_lane_change", &ctm::TrafficManager::SetAutoLaneChange) .def("auto_lane_change", &ctm::TrafficManager::SetAutoLaneChange, (arg("actor"), arg("enable")))
.def("distance_to_leading_vehicle", &ctm::TrafficManager::SetDistanceToLeadingVehicle) .def("distance_to_leading_vehicle", &ctm::TrafficManager::SetDistanceToLeadingVehicle, (arg("actor"), arg("distance")))
.def("ignore_walkers_percentage", &ctm::TrafficManager::SetPercentageIgnoreWalkers) .def("ignore_walkers_percentage", &ctm::TrafficManager::SetPercentageIgnoreWalkers, (arg("actor"), arg("perc")))
.def("ignore_vehicles_percentage", &ctm::TrafficManager::SetPercentageIgnoreVehicles) .def("ignore_vehicles_percentage", &ctm::TrafficManager::SetPercentageIgnoreVehicles, (arg("actor"), arg("perc")))
.def("ignore_lights_percentage", &ctm::TrafficManager::SetPercentageRunningLight) .def("ignore_lights_percentage", &ctm::TrafficManager::SetPercentageRunningLight, (arg("actor"), arg("perc")))
.def("ignore_signs_percentage", &ctm::TrafficManager::SetPercentageRunningSign) .def("ignore_signs_percentage", &ctm::TrafficManager::SetPercentageRunningSign, (arg("actor"), arg("perc")))
.def("set_global_distance_to_leading_vehicle", &ctm::TrafficManager::SetGlobalDistanceToLeadingVehicle) .def("set_global_distance_to_leading_vehicle", &ctm::TrafficManager::SetGlobalDistanceToLeadingVehicle, (arg("distance")))
.def("keep_right_rule_percentage", &ctm::TrafficManager::SetKeepRightPercentage) .def("keep_right_rule_percentage", &ctm::TrafficManager::SetKeepRightPercentage, (arg("actor"), arg("perc")))
.def("random_left_lanechange_percentage", &ctm::TrafficManager::SetRandomLeftLaneChangePercentage) .def("random_left_lanechange_percentage", &ctm::TrafficManager::SetRandomLeftLaneChangePercentage, (arg("actor"), arg("percentage")))
.def("random_right_lanechange_percentage", &ctm::TrafficManager::SetRandomRightLaneChangePercentage) .def("random_right_lanechange_percentage", &ctm::TrafficManager::SetRandomRightLaneChangePercentage, (arg("actor"), arg("percentage")))
.def("set_synchronous_mode", &ctm::TrafficManager::SetSynchronousMode) .def("set_synchronous_mode", &ctm::TrafficManager::SetSynchronousMode, (arg("mode_switch")))
.def("set_hybrid_physics_mode", &ctm::TrafficManager::SetHybridPhysicsMode) .def("set_hybrid_physics_mode", &ctm::TrafficManager::SetHybridPhysicsMode, (arg("enabled")))
.def("set_hybrid_physics_radius", &ctm::TrafficManager::SetHybridPhysicsRadius) .def("set_hybrid_physics_radius", &ctm::TrafficManager::SetHybridPhysicsRadius, (arg("r")))
.def("set_random_device_seed", &ctm::TrafficManager::SetRandomDeviceSeed) .def("set_random_device_seed", &ctm::TrafficManager::SetRandomDeviceSeed, (arg("value")))
.def("set_osm_mode", &carla::traffic_manager::TrafficManager::SetOSMMode) .def("set_osm_mode", &carla::traffic_manager::TrafficManager::SetOSMMode, (arg("mode_switch")))
.def("set_path", &InterSetCustomPath, (arg("empty_buffer") = true)) .def("set_path", &InterSetCustomPath, (arg("actor"), arg("path"), arg("empty_buffer")=true))
.def("set_route", &InterSetImportedRoute, (arg("empty_buffer") = true)) .def("set_route", &InterSetImportedRoute, (arg("actor"), arg("path"), arg("empty_buffer")=true))
.def("set_respawn_dormant_vehicles", &carla::traffic_manager::TrafficManager::SetRespawnDormantVehicles) .def("set_respawn_dormant_vehicles", &carla::traffic_manager::TrafficManager::SetRespawnDormantVehicles, (arg("mode_switch")))
.def("set_boundaries_respawn_dormant_vehicles", &carla::traffic_manager::TrafficManager::SetBoundariesRespawnDormantVehicles) .def("set_boundaries_respawn_dormant_vehicles", &carla::traffic_manager::TrafficManager::SetBoundariesRespawnDormantVehicles, (arg("lower_bound"), arg("upper_bound")))
.def("get_next_action", &InterGetNextAction) .def("get_next_action", &InterGetNextAction, (arg("actor")))
.def("get_all_actions", &InterGetActionBuffer) .def("get_all_actions", &InterGetActionBuffer, (arg("actor")))
.def("shut_down", &ctm::TrafficManager::ShutDown); .def("shut_down", &ctm::TrafficManager::ShutDown);
} }