Now that we have the action space of the CARLA Gym environment defined, we can look at how to convert the continuous or discrete actions we have defined into values the CARLA simulation server will accept.
Since we have followed the same convention for two-dimensional bounded action values in both the continuous and discrete action spaces, we can simply convert the actions into steer, throttle, and brake commands using the following code snippet:
throttle = float(np.clip(action[0], 0, 1)brake = float(np.abs(np.cllip(action[0], -1, 0)steer = float(p.clip(action[1], -1, 1)hand_brake = Falsereverse = False
As you can see, this is where action[0] is for throttle and brake, and action[1] is for the ...