MCPcopy Index your code
hub / github.com/OpenDriveLab/TCP / process_act

Method process_act

roach/utils/rl_birdview_wrapper.py:124–142  ·  view source on GitHub ↗
(action, acc_as_action, train=True)

Source from the content-addressed store, hash-verified

122
123 @staticmethod
124 def process_act(action, acc_as_action, train=True):
125 if not train:
126 action = action[0]
127 if acc_as_action:
128 acc, steer = action.astype(np.float64)
129 if acc >= 0.0:
130 throttle = acc
131 brake = 0.0
132 else:
133 throttle = 0.0
134 brake = np.abs(acc)
135 else:
136 throttle, steer, brake = action.astype(np.float64)
137
138 throttle = np.clip(throttle, 0, 1)
139 steer = np.clip(steer, -1, 1)
140 brake = np.clip(brake, 0, 1)
141 control = carla.VehicleControl(throttle=throttle, steer=steer, brake=brake)
142 return control

Callers 2

stepMethod · 0.95
run_stepMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected