Action Space

MetaDrive receives normalized action as input to control each target vehicle: \(\mathbf a = [a_1, a_2]^T \in [-1, 1]^2\).

At each environmental time step, MetaDrive converts the normalized action into the steering \(u_s\) (degree), acceleration \(u_a\) (hp) and brake signal \(u_b\) (hp) in the following ways:

\[\begin{split}u_s & = S_{max} a_1 ~\\ u_a & = F_{max} \max(0, a_2) ~\\ u_b & = -B_{max} \min(0, a_2)\end{split}\]

wherein \(S_{max}\) (degree) is the maximal steering angle, \(F_{max}\) (hp) is the maximal engine force, and \(B_{max}\) (hp) is the maximal brake force. Since the accurate values of these parameters are varying across different types of vehicle, please refer to the VehicleParameterSpace Class for details.

By such design, the action space for each agent is always fixed to gym.spaces.Box(low=-1.0, high=1.0, shape=(2, )). However, we provides a config named extra_action_dim (int) which allows user to add more dimensions in the action space. For example, if we set config["extra_action_dim"] = 1, then the action space for each agent will become Box(-1.0, 1.0, shape=(3, )). This allow the user to write environment wrapper that introduce more input action dimensions.