Core Package

l2r.core.controller

l2r.core.templates

Note

The templates module provides useful abstract classes which we recommend using for compatability with the RacingEnv.

class l2r.core.templates.AbstractAgent(*args, **kwargs)[source]

Bases: abc.ABC

Abstract agent class. A potentially useful template for racing agents.

abstract select_action()[source]

Select an action to take.

class l2r.core.templates.AbstractInterface(*args, **kwargs)[source]

Bases: abc.ABC

Abstract simulator interface to receive data from the simulator.

abstract get_data()[source]

This method is used to return the most up-to-date information from the interface.

abstract reset()[source]

Used to reset the interface, often to clear existing data.

abstract start()[source]

The start method is used to start communication with the simulator.

class l2r.core.templates.AbstractReward(*args, **kwargs)[source]

Bases: abc.ABC

Abstract reward class. It is recommended that new reward policies follow this template so that they are compatible with the RacingEnv.

abstract get_reward(state, **kwargs)[source]

Return the reward for the provided state.

Parameters

state (varies) – the current environment state

abstract reset()[source]

Reset the reward policy.

set_track(inside_path, outside_path, centre_path, car_dims)[source]

Store the track and vehicle information as class variables. This is useful for evaluating the reward based on the position of the vehicle.

Parameters
  • inside_path (matplotlib.Path) – ENU coordinates of the inside track boundary

  • outside_path (matplotlib.Path) – ENU coordinates of the outside track boundary

  • centre_path (matplotlib.Path) – ENU coordinates of the track’s centerline

  • car_dims (list) – dimensions of the vehicle in meters: [length, width]

l2r.core.tracker