MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / distance_vehicle

Function distance_vehicle

agents/tools/misc.py:116–127  ·  view source on GitHub ↗

Returns the 2D distance from a waypoint to a vehicle :param waypoint: actual waypoint :param vehicle_transform: transform of the target vehicle

(waypoint, vehicle_transform)

Source from the content-addressed store, hash-verified

114
115
116def distance_vehicle(waypoint, vehicle_transform):
117 """
118 Returns the 2D distance from a waypoint to a vehicle
119
120 :param waypoint: actual waypoint
121 :param vehicle_transform: transform of the target vehicle
122 """
123 loc = vehicle_transform.location
124 x = waypoint.transform.location.x - loc.x
125 y = waypoint.transform.location.y - loc.y
126
127 return math.sqrt(x * x + y * y)
128
129
130def vector(location_1, location_2):

Callers 1

run_stepMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected