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)
| 114 | |
| 115 | |
| 116 | def 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 | |
| 130 | def vector(location_1, location_2): |