igp2.simplesim package

Submodules

igp2.simplesim.plot_simulation module

igp2.simplesim.plot_simulation.plot_diagnostics(agents: ~typing.Dict[int, ~igp2.agents.agent.Agent], actions: ~typing.Dict[int, ~typing.List[~igp2.core.vehicle.Action]]) -> (<class 'matplotlib.figure.Figure'>, <class 'matplotlib.axes._axes.Axes'>)[source]
igp2.simplesim.plot_simulation.plot_maneuvers(agent: Agent, ax: Axes) Axes[source]
igp2.simplesim.plot_simulation.plot_predictions(ego_agent: MCTSAgent, agents: Dict[int, Agent], ax: Axes, debug: bool = False) Axes[source]
igp2.simplesim.plot_simulation.plot_simulation(simulation: ~igp2.simplesim.simulation.Simulation, axes: ~matplotlib.axes._axes.Axes | None = None, debug: bool = False, map_plotter=None) -> (<class 'matplotlib.figure.Figure'>, <class 'matplotlib.axes._axes.Axes'>)[source]

Plot the current agents and the road layout for visualisation purposes.

Parameters:
  • simulation – The simulation to plot.

  • axes – Axis to draw on

  • debug – If True then plot diagnostic information.

  • map_plotter – Function overriden default method to map road layout

igp2.simplesim.simulation module

class igp2.simplesim.simulation.Simulation(scenario_map: Map, fps: int = 20, open_loop: bool = False)[source]

Bases: object

A lightweight simulator for IGP2 to perform rapid testing.

property actions: Dict[int, List[Action]]

List of actions (acceleration and steering) taken by every vehicle.

add_agent(new_agent: Agent, rolename: str | None = None)[source]

Add a new agent to the simulation.

Parameters:
  • new_agent – Agent to add.

  • rolename – Currently unused. Optional string to describe role of the vehicle.

property agents: Dict[int, Agent]

Agents in the simulation, mapping agent IDs to agents.

get_observations(agent_id: int = 0)[source]

Get observations for the given agent. Can be overridden to add occlusions to the environment for example.

Parameters:

agent_id – The ID of the agent for which to retrieve observations.

remove_agent(agent_id: int)[source]

Remove an agent from the simulation.

Parameters:

agent_id – Agent ID to remove.

reset()[source]

Remove all agents and reset internal state of simulation.

property scenario_map: Map

The road layout of the simulation.

property state: Dict[int, AgentState]

Current joint state of the simulation.

step() bool[source]

Advance simulation by one time step.

Returns:

True if any agent is still alive else False.

property t: int

The current time step of the simulation.

take_actions()[source]

Module contents