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

Function get_speed

agents/tools/misc.py:31–40  ·  view source on GitHub ↗

Compute speed of a vehicle in Km/h. :param vehicle: the vehicle for which speed is calculated :return: speed as a float in Km/h

(vehicle)

Source from the content-addressed store, hash-verified

29
30
31def get_speed(vehicle):
32 """
33 Compute speed of a vehicle in Km/h.
34
35 :param vehicle: the vehicle for which speed is calculated
36 :return: speed as a float in Km/h
37 """
38 vel = vehicle.get_velocity()
39
40 return 3.6 * math.sqrt(vel.x ** 2 + vel.y ** 2 + vel.z ** 2)
41
42def is_within_distance_ahead(target_transform, current_transform, max_distance):
43 """

Callers 5

run_stepMethod · 0.90
update_informationMethod · 0.90
_tailgatingMethod · 0.90
car_following_managerMethod · 0.90

Calls 1

get_velocityMethod · 0.80

Tested by

no test coverage detected