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

Method get_action

TCP/model.py:330–344  ·  view source on GitHub ↗
(self, mu, sigma)

Source from the content-addressed store, hash-verified

328
329
330 def get_action(self, mu, sigma):
331 action = self._get_action_beta(mu.view(1,2), sigma.view(1,2))
332 acc, steer = action[:, 0], action[:, 1]
333 if acc >= 0.0:
334 throttle = acc
335 brake = torch.zeros_like(acc)
336 else:
337 throttle = torch.zeros_like(acc)
338 brake = torch.abs(acc)
339
340 throttle = torch.clamp(throttle, 0, 1)
341 steer = torch.clamp(steer, -1, 1)
342 brake = torch.clamp(brake, 0, 1)
343
344 return throttle, steer, brake

Callers 1

validation_stepMethod · 0.80

Calls 1

_get_action_betaMethod · 0.95

Tested by

no test coverage detected