From 7b1dfcd6923231ef67e6d6bdf5f407d0bf4035d6 Mon Sep 17 00:00:00 2001 From: Alexander Koufos Date: Fri, 3 May 2019 15:24:30 -0700 Subject: [PATCH] Issue #3: Renames function - Renames the function for checking distance of actor from a location to better match the functionality, since this can be used for any actor, not only vehicles. --- Event4.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Event4.py b/Event4.py index 174f4c7..f92fa5f 100644 --- a/Event4.py +++ b/Event4.py @@ -71,13 +71,15 @@ def spawn_vehicle(world, blueprints, location, verbose=False): def is_vehicle_in_range( vehicle, +def is_actor_in_range( + actor, origin=carla.Location(0.0, 0.0, 0.0), max_distance=100.0, verbose=False ): - dist_from_origin = vehicle.get_location().distance(origin) + dist_from_origin = actor.get_location().distance(origin) if verbose: - print("Vehicle", vehicle.id, "is", dist_from_origin, "meters away.") + print("Actor", actor.id, "is", dist_from_origin, "meters away.") if dist_from_origin < max_distance: return True