MCPcopy Create free account
hub / github.com/OpenDriveLab/TCP / get_collision

Function get_collision

leaderboard/team_code/roach_ap_agent.py:56–66  ·  view source on GitHub ↗
(p1, v1, p2, v2)

Source from the content-addressed store, hash-verified

54
55
56def get_collision(p1, v1, p2, v2):
57 A = np.stack([v1, -v2], 1)
58 b = p2 - p1
59
60 if abs(np.linalg.det(A)) < 1e-3:
61 return False, None
62
63 x = np.linalg.solve(A, b)
64 collides = all(x >= 0) and all(x <= 1) # how many seconds until collision
65
66 return collides, p1 + x[0] * v1
67
68
69class ROACHAgent(autonomous_agent.AutonomousAgent):

Callers 1

_is_walker_hazardMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected