Lane Keeping¶
A pure lateral control task using a bicycle dynamics model. The agent must steer to follow a sine-wave lane with no other traffic. The reward is maximised when the vehicle stays centred on the lane.
Usage¶
env = gym.make("lane-keeping-v0")
Default configuration¶
{
"observation": {
"type": "AttributesObservation",
"attributes": ["state", "derivative", "reference_state"],
},
"action": {
"type": "ContinuousAction",
"steering_range": [-np.pi / 3, np.pi / 3],
"longitudinal": False,
"lateral": True,
"dynamical": True,
},
"simulation_frequency": 10,
"policy_frequency": 10,
"state_noise": 0.05,
"derivative_noise": 0.05,
"screen_width": 600,
"screen_height": 250,
"scaling": 7,
"centering_position": [0.4, 0.5],
}
More specifically, it is defined in:
- classmethod LaneKeepingEnv.default_config() dict[source]
Default environment configuration.
Can be overloaded in environment implementations, or by calling configure(). :return: a configuration dict
API¶
- class highway_env.envs.lane_keeping_env.LaneKeepingEnv(config: dict = None)[source]¶
A lane keeping control task.
- classmethod default_config() dict[source]¶
Default environment configuration.
Can be overloaded in environment implementations, or by calling configure(). :return: a configuration dict
- step(action: ndarray) tuple[ndarray, float, bool, bool, dict][source]¶
Perform an action and step the environment dynamics.
The action is executed by the ego-vehicle, and all other vehicles on the road performs their default behaviour for several simulation timesteps until the next decision making step.
- Parameters:
action – the action performed by the ego-vehicle
- Returns:
a tuple (observation, reward, terminated, truncated, info)