Skip to content

Commit

Permalink
fix: set traci default view if it doesn't exist (#191)
Browse files Browse the repository at this point in the history
* fix: set traci default view if it doesn't exist

* Fix pre-commit

* Remove unused files

* Remove reportArgumentType

* Update pyright

---------

Co-authored-by: Lucas Alegre <[email protected]>
  • Loading branch information
KevynKelso and LucasAlegre authored Mar 20, 2024
1 parent a134ebb commit c3ce351
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 407 deletions.
2 changes: 1 addition & 1 deletion docs/documentation/observations.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Observation Functions

To create a new obsevation function, you must create a class that inherits from the ObservationFunction class:
To create a new observation function, you must create a class that inherits from the ObservationFunction class:

```{eval-rst}
.. autoclass:: sumo_rl.environment.observations.ObservationFunction
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,16 @@ reportInvalidTypeVarUse = "none"
# reportUnknownVariableType = "warning" # -> raises warnings
# reportUnknownArgumentType = "warning" # -> raises warnings
reportGeneralTypeIssues = "none" # -> commented out raises 489 errors
reportArgumentType = "none"
reportUntypedFunctionDecorator = "none" # -> pytest.mark.parameterize issues

reportOptionalMemberAccess = "none" # -> commented out raises warnings
reportPrivateImportUsage = "warning" # -> this raises warnings because we use not exported modules from gym (wrappers)

reportPrivateUsage = "warning"
reportUnboundVariable = "warning"
reportCallIssue = "warning"
reportAttributeAccessIssue = "warning"

[tool.pytest.ini_options]
filterwarnings = ['ignore:.*The environment .* is out of date.*']
Expand Down
2 changes: 2 additions & 0 deletions sumo_rl/environment/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ def _start_simulation(self):
self.sumo = traci.getConnection(self.label)

if self.use_gui or self.render_mode is not None:
if "DEFAULT_VIEW" not in dir(traci.gui): # traci.gui.DEFAULT_VIEW is not defined in libsumo
traci.gui.DEFAULT_VIEW = "View #0"
self.sumo.gui.setSchema(traci.gui.DEFAULT_VIEW, "real world")

def reset(self, seed: Optional[int] = None, **kwargs):
Expand Down
6 changes: 3 additions & 3 deletions sumo_rl/environment/resco_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def grid4x4(parallel=True, **kwargs):
Number of agents = 16
Number of actions = 4
Agents have the same obsevation and action space
Agents have the same observation and action space
"""
kwargs.update(
{
Expand All @@ -33,7 +33,7 @@ def arterial4x4(parallel=True, **kwargs):
Number of agents = 16
Number of actions = 5
Agents have the same obsevation and action space
Agents have the same observation and action space
"""
kwargs.update(
{
Expand Down Expand Up @@ -73,7 +73,7 @@ def cologne3(parallel=True, **kwargs):
Number of agents: 3
Number of actions: 2 agents with 4 actions and 1 agent with 3 actions
2 agents have the same obsevation and action space and 1 has different spaces
2 agents have the same observation and action space and 1 has different spaces
"""
kwargs.update(
{
Expand Down
271 changes: 0 additions & 271 deletions sumo_rl/util/xml2csv.py

This file was deleted.

Loading

0 comments on commit c3ce351

Please sign in to comment.