Skip to content

Commit

Permalink
Issue #3: Renames function
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
exoticDFT committed May 3, 2019
1 parent 4c42bd3 commit 7b1dfcd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Event4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7b1dfcd

Please sign in to comment.