From ed7cf21949988e9d0c652a27670afa0e75e87f78 Mon Sep 17 00:00:00 2001 From: Tucker Alban Date: Thu, 21 Dec 2023 20:58:15 -0500 Subject: [PATCH] [Bugfix] pycharm debug loading project modules as standard library modules (#2126) * Bugfix types module for pycharm. * Fix sstudio.types module imports. * Fix envision.types. * Make format. * Rename math to core_math. * Allow compatibility import of envision.types. * Allow compatibility import of smarts.sstudio.types * Make format. * Update utils.math to utils.core_math. * Rename logging to core_logging. * Improve compatability. * Make format. * Update changelog. * Fix tests and type test. * Fix format test. --- CHANGELOG.md | 2 + docs/sim/bubbles.rst | 6 +- docs/sim/minimal_scenario_studio.py | 2 +- docs/sim/scenario_studio.rst | 20 ++--- envision/__init__.py | 6 ++ envision/client.py | 8 +- envision/data_formatter.py | 2 +- envision/{types.py => etypes.py} | 0 envision/tests/test_data_formatter.py | 12 +-- examples/direct/bubble_example.py | 6 +- .../traffic_histories_vehicle_replacement.py | 2 +- scenarios/open_drive/od_4lane/scenario.py | 2 +- scenarios/open_drive/od_newmarket/scenario.py | 2 +- scenarios/sumo/figure_eight/scenario.py | 2 +- .../scenario.py | 2 +- .../scenario.py | 2 +- .../scenario.py | 2 +- .../scenario.py | 2 +- .../scenario.py | 2 +- .../sumo/intersections/2lane/scenario.py | 2 +- .../intersections/2lane_circle/scenario.py | 2 +- .../sumo/intersections/4lane/scenario.py | 2 +- .../sumo/intersections/6lane/scenario.py | 8 +- .../sumo/merge/3lane_agents_1/scenario.py | 2 +- .../sumo/merge/3lane_agents_2/scenario.py | 2 +- .../3lane_cruise_agents_1/scenario.py | 2 +- .../3lane_cruise_agents_3/scenario.py | 2 +- .../3lane_cut_in_agents_1/scenario.py | 2 +- .../3lane_overtake_agents_1/scenario.py | 2 +- .../cruise_2lane_agents_1/scenario.py | 2 +- .../straight/cutin_2lane_agents_1/scenario.py | 2 +- .../merge_exit_sumo_t_agents_1/scenario.py | 2 +- .../overtake_2lane_agents_1/scenario.py | 2 +- .../sumo/tests/same_location/scenario.py | 2 +- .../merge_exit_sumo_agents_1/scenario.py | 2 +- .../merge_exit_sumo_t_agents_1/scenario.py | 2 +- .../merge_exit_sumo_t_agents_2/scenario.py | 2 +- .../straight_2lane_sumo_agents_1/scenario.py | 2 +- .../scenario.py | 2 +- .../straight_3lanes_sumo_agents_1/scenario.py | 2 +- .../scenario.py | 2 +- .../scenario.py | 2 +- scenarios/sumo/zoo_intersection/scenario.py | 2 +- .../entrypoints/benchmark_runner_v0.py | 2 +- smarts/core/actor_capture_manager.py | 2 +- smarts/core/agent_manager.py | 4 +- smarts/core/argoverse_map.py | 6 +- smarts/core/bubble_manager.py | 14 ++-- smarts/core/chassis.py | 2 +- smarts/core/controllers/direct_controller.py | 2 +- .../controllers/lane_following_controller.py | 6 +- .../trajectory_tracking_controller.py | 2 +- smarts/core/coordinates.py | 2 +- smarts/core/default_map_builder.py | 2 +- smarts/core/id_actor_capture_manager.py | 2 +- smarts/core/lanepoints.py | 2 +- smarts/core/lidar.py | 2 +- smarts/core/local_traffic_provider.py | 10 ++- smarts/core/models/controller_parameters.yaml | 25 ++++++ smarts/core/opendrive_road_network.py | 6 +- smarts/core/plan.py | 8 +- smarts/core/road_map.py | 2 +- smarts/core/scenario.py | 18 ++--- smarts/core/sensor.py | 2 +- smarts/core/sensors/local_sensor_resolver.py | 2 +- .../core/sensors/parallel_sensor_resolver.py | 2 +- smarts/core/serialization/default.py | 4 +- smarts/core/shape.py | 4 +- smarts/core/smarts.py | 6 +- smarts/core/sumo_road_network.py | 4 +- smarts/core/sumo_traffic_simulation.py | 2 +- smarts/core/tests/test_boids.py | 2 +- smarts/core/tests/test_bubble_hijacking.py | 2 +- smarts/core/tests/test_bubble_manager.py | 2 +- smarts/core/tests/test_collision.py | 2 +- smarts/core/tests/test_controller_lane.py | 2 +- smarts/core/tests/test_map.py | 2 +- smarts/core/tests/test_parallel_sensors.py | 2 +- smarts/core/tests/test_scenario.py | 2 +- smarts/core/tests/test_sensor_worker.py | 2 +- smarts/core/tests/test_sensors.py | 4 +- smarts/core/tests/test_smarts_frame_rate.py | 2 +- ...st_traffic_provider_collision_avoidance.py | 2 +- .../test_trajectory_interpolation_provider.py | 2 +- smarts/core/tests/test_trap_manager.py | 2 +- smarts/core/traffic_history.py | 2 +- smarts/core/traffic_history_provider.py | 2 +- smarts/core/trap_manager.py | 4 +- smarts/core/utils/__init__.py | 8 ++ .../utils/adapters/ego_centric_adapters.py | 4 +- .../utils/{logging.py => core_logging.py} | 0 smarts/core/utils/{math.py => core_math.py} | 0 smarts/core/utils/dummy.py | 2 +- smarts/core/utils/pybullet.py | 2 +- smarts/core/utils/sumo.py | 2 +- smarts/core/utils/tests/test_math.py | 2 +- smarts/core/vehicle.py | 2 +- smarts/core/vehicle_state.py | 2 +- smarts/core/waymo_map.py | 10 +-- .../10_agents_to_n_roads/10_roads/scenario.py | 8 +- .../10_agents_to_n_roads/1_roads/scenario.py | 8 +- .../10_agents_to_n_roads/20_roads/scenario.py | 8 +- .../10_agents_to_n_roads/50_roads/scenario.py | 8 +- .../10_replays/scenario.py | 2 +- .../1_replay/scenario.py | 2 +- .../20_replays/scenario.py | 2 +- .../50_replays/scenario.py | 2 +- .../diagnostic/n_agents/10_agents/scenario.py | 2 +- .../diagnostic/n_agents/1_agents/scenario.py | 2 +- .../diagnostic/n_agents/20_agents/scenario.py | 2 +- .../diagnostic/n_agents/50_agents/scenario.py | 2 +- .../n_local_actors/10_actors/scenario.py | 2 +- .../n_local_actors/1_actors/scenario.py | 2 +- .../n_local_actors/200_actors/scenario.py | 2 +- .../n_local_actors/20_actors/scenario.py | 2 +- .../n_local_actors/50_actors/scenario.py | 2 +- .../n_sumo_actors/10_actors/scenario.py | 2 +- .../n_sumo_actors/1_actors/scenario.py | 2 +- .../n_sumo_actors/200_actors/scenario.py | 2 +- .../n_sumo_actors/20_actors/scenario.py | 2 +- .../n_sumo_actors/50_actors/scenario.py | 2 +- smarts/diagnostic/run.py | 2 +- smarts/env/custom_observations.py | 2 +- smarts/env/gymnasium/hiway_env_v1.py | 4 +- smarts/env/gymnasium/wrappers/metric/costs.py | 2 +- smarts/env/rllib_hiway_env.py | 2 +- smarts/env/tests/test_determinism.py | 2 +- smarts/env/wrappers/utils/rendering.py | 2 +- smarts/ray/sensors/ray_sensor_resolver.py | 2 +- .../sensors/tests/test_ray_sensor_resolver.py | 2 +- .../ros/src/smarts_ros/scripts/ros_driver.py | 4 +- smarts/sstudio/__init__.py | 5 ++ smarts/sstudio/generators.py | 24 +++--- smarts/sstudio/genhistories.py | 8 +- smarts/sstudio/genscenario.py | 80 ++++++++++--------- smarts/sstudio/od2mesh.py | 2 +- smarts/sstudio/scenario_construction.py | 2 +- smarts/sstudio/{types => sstypes}/__init__.py | 34 ++++---- .../{types => sstypes}/actor/__init__.py | 0 .../actor/social_agent_actor.py | 4 +- .../{types => sstypes}/actor/traffic_actor.py | 6 +- .../actor/traffic_engine_actor.py | 2 +- smarts/sstudio/{types => sstypes}/bubble.py | 10 +-- .../{types => sstypes}/bubble_limits.py | 2 +- .../sstudio/{types => sstypes}/condition.py | 0 .../sstudio/{types => sstypes}/constants.py | 0 smarts/sstudio/{types => sstypes}/dataset.py | 0 .../{types => sstypes}/distribution.py | 0 .../{types => sstypes}/entry_tactic.py | 4 +- smarts/sstudio/{types => sstypes}/map_spec.py | 0 smarts/sstudio/{types => sstypes}/mission.py | 6 +- smarts/sstudio/{types => sstypes}/route.py | 2 +- smarts/sstudio/{types => sstypes}/scenario.py | 16 ++-- .../{types => sstypes}/standard_metadata.py | 0 smarts/sstudio/{types => sstypes}/traffic.py | 4 +- .../{types => sstypes}/traffic_model.py | 0 smarts/sstudio/{types => sstypes}/zone.py | 2 +- smarts/sstudio/sumo2mesh.py | 2 +- smarts/sstudio/tests/baseline.rou.xml | 20 ++--- smarts/sstudio/tests/test_conditions.py | 2 +- smarts/sstudio/tests/test_generate.py | 6 +- zoo/evaluation/run_evaluation.py | 6 +- .../straight_turn-left_1/scenario.py | 2 +- .../straight_turn-left_2/scenario.py | 2 +- .../turn-left_turn-left_1/scenario.py | 2 +- .../turn-left_turn-left_2/scenario.py | 2 +- .../turn-right_turn-left_1/scenario.py | 2 +- .../turn-right_turn-left_2/scenario.py | 2 +- .../scenarios/4lane_left_turn/scenario.py | 2 +- .../scenarios/4lane_right_turn/scenario.py | 2 +- .../scenarios/4lane_straight/scenario.py | 2 +- .../scenarios/4lane_left_turn/scenario.py | 2 +- .../scenarios/4lane_right_turn/scenario.py | 2 +- .../scenarios/4lane_straight/scenario.py | 2 +- 174 files changed, 400 insertions(+), 318 deletions(-) rename envision/{types.py => etypes.py} (100%) rename smarts/core/utils/{logging.py => core_logging.py} (100%) rename smarts/core/utils/{math.py => core_math.py} (100%) rename smarts/sstudio/{types => sstypes}/__init__.py (57%) rename smarts/sstudio/{types => sstypes}/actor/__init__.py (100%) rename smarts/sstudio/{types => sstypes}/actor/social_agent_actor.py (96%) rename smarts/sstudio/{types => sstypes}/actor/traffic_actor.py (94%) rename smarts/sstudio/{types => sstypes}/actor/traffic_engine_actor.py (95%) rename smarts/sstudio/{types => sstypes}/bubble.py (95%) rename smarts/sstudio/{types => sstypes}/bubble_limits.py (97%) rename smarts/sstudio/{types => sstypes}/condition.py (100%) rename smarts/sstudio/{types => sstypes}/constants.py (100%) rename smarts/sstudio/{types => sstypes}/dataset.py (100%) rename smarts/sstudio/{types => sstypes}/distribution.py (100%) rename smarts/sstudio/{types => sstypes}/entry_tactic.py (97%) rename smarts/sstudio/{types => sstypes}/map_spec.py (100%) rename smarts/sstudio/{types => sstypes}/mission.py (96%) rename smarts/sstudio/{types => sstypes}/route.py (98%) rename smarts/sstudio/{types => sstypes}/scenario.py (92%) rename smarts/sstudio/{types => sstypes}/standard_metadata.py (100%) rename smarts/sstudio/{types => sstypes}/traffic.py (97%) rename smarts/sstudio/{types => sstypes}/traffic_model.py (100%) rename smarts/sstudio/{types => sstypes}/zone.py (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a5e98481f..cfed5df5b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Copy and pasting the git commit messages is __NOT__ enough. ### Added ### Changed - `VehicleIndex.build_agent_vehicle()` no longer has `filename` and `surface_patches` parameters. +- The following modules have been renamed: `envision.types` -> `envision.etypes`, `smarts.core.utils.logging` -> `smarts.core.utils.core_logging`, `smarts.core.utils.math` -> `smarts.core.utils.core_math`, `smarts.sstudio.types` -> `smarts.sstudio.sstypes`. For compatibility reasons they can still be imported by their original module name. ### Deprecated ### Fixed - Fixed an issue where `AgentInterface.vehicle_type` would not affect agent vehicles when attempting to take over an existing vehicle. @@ -26,6 +27,7 @@ Copy and pasting the git commit messages is __NOT__ enough. - Fixed a `pkg_resources` deprecation warning in `python3.10` and up. - Fixed the envision camera to center on the map which was broken due to a change in the `gltf` metadata hierarchy. - Fixed an issue where you would need to install `waymo` in order to use any kind of dataset histories. +- Fixed an issue where Pycharm would load `smarts/sstudio/types` as the integrated `types` module. See #2125. ### Removed ### Security diff --git a/docs/sim/bubbles.rst b/docs/sim/bubbles.rst index 6ef0d273bb..bd75e24a08 100644 --- a/docs/sim/bubbles.rst +++ b/docs/sim/bubbles.rst @@ -22,7 +22,7 @@ Bubbles can be fixed to a static location defined either as an edge or a positio .. code-block:: python - import smarts.sstudio.types as t + import smarts.sstudio.sstypes as t zoo_agent_actor = t.SocialAgentActor( # Unique agent name name="zoo-agent", @@ -45,7 +45,7 @@ Bubbles that are vehicle-relative can be attached to specific actors by specifyi .. code-block:: python - import smarts.sstudio.types as t + import smarts.sstudio.sstypes as t t.Bubble( ..., # The target of the bubble to follow the given actor @@ -61,7 +61,7 @@ There is currently no interface for dynamically-created bubbles. However, if the .. code-block:: python - import smarts.sstudio.types as t + import smarts.sstudio.sstypes as t scenario_iter = Scenario.scenario_variations(path) scenario = next(scenario) scenario.bubbles.append( diff --git a/docs/sim/minimal_scenario_studio.py b/docs/sim/minimal_scenario_studio.py index 1692019f7e..96f9928b52 100644 --- a/docs/sim/minimal_scenario_studio.py +++ b/docs/sim/minimal_scenario_studio.py @@ -1,6 +1,6 @@ from pathlib import Path -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t from smarts.sstudio import gen_scenario traffic_actor = t.TrafficActor( diff --git a/docs/sim/scenario_studio.rst b/docs/sim/scenario_studio.rst index 9c53091176..41def6283e 100644 --- a/docs/sim/scenario_studio.rst +++ b/docs/sim/scenario_studio.rst @@ -7,9 +7,9 @@ Scenario Studio =============== -The Scenario Studio ``sstudio`` of SMARTS is a stand alone package :mod:`~smarts.sstudio` that supports flexible and expressive scenario specification. The ``sstudio`` domain specific language (DSL) has a simple ontology defined by :mod:`~smarts.sstudio.types` to help express your scenario needs in SMARTS. +The Scenario Studio ``sstudio`` of SMARTS is a stand alone package :mod:`~smarts.sstudio` that supports flexible and expressive scenario specification. The ``sstudio`` domain specific language (DSL) has a simple ontology defined by :mod:`~smarts.sstudio.sstypes` to help express your scenario needs in SMARTS. -A scenario is formed by combining several inputs, such as (i) road map, (ii) traffic, (iii) social agents, (iv) ego agents, (v) bubbles, (vi) friction patches, and (vii) traffic histories. Refer to :class:`~smarts.sstudio.types.scenario.Scenario`. +A scenario is formed by combining several inputs, such as (i) road map, (ii) traffic, (iii) social agents, (iv) ego agents, (v) bubbles, (vi) friction patches, and (vii) traffic histories. Refer to :class:`~smarts.sstudio.sstypes.scenario.Scenario`. SMARTS interacts with road maps abstractly (via polymorphism) through the :class:`~smarts.core.road_map.RoadMap` interface in order to support multiple map formats and allow for extending to support new map formats. @@ -21,10 +21,10 @@ A typical scenario creation workflow is as follows. 2. Design the map. * For a SUMO road network, create the map using `netedit `_ and save it in the new scenario folder. - * For other road networks, define and instantiate a :class:`~smarts.sstudio.types.map_spec.MapSpec` object in ``scenario.py``. Pass the ``MapSpec`` object to :class:`~smarts.sstudio.types.scenario.Scenario` in ``scenario.py``. + * For other road networks, define and instantiate a :class:`~smarts.sstudio.sstypes.map_spec.MapSpec` object in ``scenario.py``. Pass the ``MapSpec`` object to :class:`~smarts.sstudio.sstypes.scenario.Scenario` in ``scenario.py``. -3. Add traffic, social agents, ego agents, friction patches, map spec, etc, to :class:`~smarts.sstudio.types.scenario.Scenario` in ``scenario.py``. -4. Feed the created :class:`~smarts.sstudio.types.scenario.Scenario` object to :func:`~smarts.sstudio.genscenario.gen_scenario` in ``scenario.py`` to generate the scenario. +3. Add traffic, social agents, ego agents, friction patches, map spec, etc, to :class:`~smarts.sstudio.sstypes.scenario.Scenario` in ``scenario.py``. +4. Feed the created :class:`~smarts.sstudio.sstypes.scenario.Scenario` object to :func:`~smarts.sstudio.genscenario.gen_scenario` in ``scenario.py`` to generate the scenario. .. code:: python @@ -48,7 +48,7 @@ Following sections below explain how to handle and edit (i) traffic, (ii) social Traffic ------- -A minimal ``scenario.py`` instantiating a :class:`~smarts.sstudio.types.traffic.Traffic` object. +A minimal ``scenario.py`` instantiating a :class:`~smarts.sstudio.sstypes.traffic.Traffic` object. .. literalinclude:: ./minimal_scenario_studio.py :language: python @@ -61,17 +61,17 @@ Simply run the ``scenario.py`` file as a regular Python script to generate the s Traffic vehicles are controlled by either ``SUMO`` or ``SMARTS`` engine. Defaults to ``engine="SUMO"``. ``engine="SUMO"`` can only be used on SUMO road networks. For other map types use ``engine="SMARTS"``. -:class:`~smarts.sstudio.types.traffic.Flow` is used to generate repeated vehicle runs on the same route. Vehicle route, departure rate, and behavior, can be configured here. +:class:`~smarts.sstudio.sstypes.traffic.Flow` is used to generate repeated vehicle runs on the same route. Vehicle route, departure rate, and behavior, can be configured here. The example above simply uses a random route ``route=RandomRoute()``. A more specific route may be used such as :python:`Route(begin=("gneE72", 0, "random"), end=("edge2", 1, "max"))` which defines the edge id, lane id, and offset into the lane, to designate the start and end vehicle positions. -:class:`~smarts.sstudio.types.actor.traffic_actor.TrafficActor` is used to specify a spec for traffic actors (e.g. Vehicles, Pedestrians, etc). The defaults provided are for a car. +:class:`~smarts.sstudio.sstypes.actor.traffic_actor.TrafficActor` is used to specify a spec for traffic actors (e.g. Vehicles, Pedestrians, etc). The defaults provided are for a car. Acceleration, deceleration, speed distribution, imperfection distribution, and other configurations, can be specified for the traffic. When :func:`~smarts.sstudio.genscenario.gen_scenario` is executed, a dir named "traffic" will be created under ``output_dir`` which contains background vehicle and route definitions. .. important:: - If you want to train a policy on one scenario, remember to set the ``end`` time of :class:`~smarts.sstudio.types.traffic.Flow` larger or equal to your expected training time, since SMARTS will continue the flow after each ``reset`` call. + If you want to train a policy on one scenario, remember to set the ``end`` time of :class:`~smarts.sstudio.sstypes.traffic.Flow` larger or equal to your expected training time, since SMARTS will continue the flow after each ``reset`` call. However, if there are multiple scenarios to train for one worker, you can relax this restriction since after the scenario change, the flow will also be reset to the beginning time. @@ -143,7 +143,7 @@ Scenario Studio also allows generation of *missions* for ego agents to complete. Friction patches ---------------- -The Scenario Studio of SMARTS also allows the generation of *friction patches* which consists of a list of *surface patches* for ego agents and social agents. These surface patches uses :class:`~smarts.sstudio.types.zone.PositionalZone` as in the case of bubbles. When we run :func:`~smarts.sstudio.genscenario.gen_scenario` passing in ``friction_maps``, a `"`friction_map.pkl"`` file will be created under the output dir. +The Scenario Studio of SMARTS also allows the generation of *friction patches* which consists of a list of *surface patches* for ego agents and social agents. These surface patches uses :class:`~smarts.sstudio.sstypes.zone.PositionalZone` as in the case of bubbles. When we run :func:`~smarts.sstudio.genscenario.gen_scenario` passing in ``friction_maps``, a `"`friction_map.pkl"`` file will be created under the output dir. .. code-block:: python diff --git a/envision/__init__.py b/envision/__init__.py index d5d822d2c0..ecd80fe7ac 100644 --- a/envision/__init__.py +++ b/envision/__init__.py @@ -17,3 +17,9 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. + +import sys + +from . import etypes as types + +sys.modules[f"{__name__}.{types=}".partition("=")[0]] = types diff --git a/envision/client.py b/envision/client.py index e3eb247fde..9546271c1e 100644 --- a/envision/client.py +++ b/envision/client.py @@ -32,11 +32,11 @@ import numpy as np -from envision import types +from envision import etypes from envision.client_config import EnvisionStateFilter from envision.data_formatter import EnvisionDataFormatter, EnvisionDataFormatterArgs +from smarts.core.utils.core_logging import suppress_websocket from smarts.core.utils.file import unpack -from smarts.core.utils.logging import suppress_websocket @dataclass @@ -219,7 +219,7 @@ def _connect( if data_formatter_args: data_formatter = EnvisionDataFormatter(data_formatter_args) - def optionally_serialize_and_write(state: Union[types.State, str], ws): + def optionally_serialize_and_write(state: Union[etypes.State, str], ws): # if not already serialized if not isinstance(state, str): if data_formatter: @@ -307,7 +307,7 @@ def run_socket(endpoint, wait_between_retries): except (BrokenPipeError, KeyboardInterrupt, EOFError): pass - def send(self, state: Union[types.State, types.Preamble]): + def send(self, state: Union[etypes.State, etypes.Preamble]): """Send the given envision state to the remote as the most recent state.""" if not self._headless and self._process.is_alive(): self._state_queue.put(state) diff --git a/envision/data_formatter.py b/envision/data_formatter.py index 3e8a124bac..461cb21ff3 100644 --- a/envision/data_formatter.py +++ b/envision/data_formatter.py @@ -41,7 +41,7 @@ import numpy as np -from envision.types import ( +from envision.etypes import ( SignalLightState, SignalState, State, diff --git a/envision/types.py b/envision/etypes.py similarity index 100% rename from envision/types.py rename to envision/etypes.py diff --git a/envision/tests/test_data_formatter.py b/envision/tests/test_data_formatter.py index adb983bee1..c8a1d01bc5 100644 --- a/envision/tests/test_data_formatter.py +++ b/envision/tests/test_data_formatter.py @@ -27,7 +27,7 @@ import numpy as np import pytest -import smarts.sstudio.types as t +import smarts.sstudio.sstypes as t from envision.client import Client from envision.data_formatter import ( EnvisionDataFormatter, @@ -35,7 +35,7 @@ Operation, _formatter_map, ) -from envision.types import State, TrafficActorState, TrafficActorType, VehicleType +from envision.etypes import State, TrafficActorState, TrafficActorType, VehicleType from smarts.core import seed from smarts.core.agent_interface import AgentInterface from smarts.core.controllers import ActionSpaceType @@ -302,10 +302,10 @@ def sim_data(): [], [4], { - 0: "car-west_0_0-east_0_max--41457-668134-0-0.0", + 0: "car-west_0_0-east_0_max--22530-248058-0-0.0", 1: None, - 2: "car-west_1_0-east_1_max--31231--18481-1-0.0", - 3: "car-west_2_0-east_2_max-674625--72317-2-0.0", + 2: "car-west_1_0-east_1_max-810328-635068-1-0.0", + 3: "car-west_2_0-east_2_max--22462--73609-2-0.0", 4: "AGENT_1", }, [], @@ -398,7 +398,7 @@ def side_effect(state: State): es = EnvisionDataFormatter(EnvisionDataFormatterArgs(None)) assert state.scenario_id is not None with mock.patch( - "envision.types.State.scenario_id", new_callable=PropertyMock + "envision.etypes.State.scenario_id", new_callable=PropertyMock ) as state_scenario_id: state_scenario_id.return_value = None es.add_any(state) diff --git a/examples/direct/bubble_example.py b/examples/direct/bubble_example.py index ef3437a87a..777f1abadd 100644 --- a/examples/direct/bubble_example.py +++ b/examples/direct/bubble_example.py @@ -15,8 +15,8 @@ from smarts.core.observations import Observation from smarts.core.scenario import Scenario from smarts.core.smarts import SMARTS -from smarts.core.utils.logging import timeit -from smarts.sstudio.types import Bubble, PositionalZone, SocialAgentActor +from smarts.core.utils.core_logging import timeit +from smarts.sstudio.sstypes import Bubble, PositionalZone, SocialAgentActor from smarts.zoo.agent_spec import AgentSpec from smarts.zoo.registry import register @@ -177,7 +177,7 @@ class ObservationState: def __init__(self) -> None: self.last_observations: Dict[str, Observation] = {} - def observation_callback(self, obs: Observation): + def observation_callback(self, obs: Dict[str, Observation]): self.last_observations = obs obs_state = ObservationState() diff --git a/examples/direct/traffic_histories_vehicle_replacement.py b/examples/direct/traffic_histories_vehicle_replacement.py index fc36d8fd24..09ce8f6726 100644 --- a/examples/direct/traffic_histories_vehicle_replacement.py +++ b/examples/direct/traffic_histories_vehicle_replacement.py @@ -16,7 +16,7 @@ from smarts.core.smarts import SMARTS from smarts.core.traffic_history import TrafficHistory from smarts.core.traffic_history_provider import TrafficHistoryProvider -from smarts.core.utils.math import radians_to_vec, rounder_for_dt +from smarts.core.utils.core_math import radians_to_vec, rounder_for_dt from smarts.zoo.agent_spec import AgentSpec logging.basicConfig(level=logging.INFO) diff --git a/scenarios/open_drive/od_4lane/scenario.py b/scenarios/open_drive/od_4lane/scenario.py index d8b650194c..221cbe223a 100644 --- a/scenarios/open_drive/od_4lane/scenario.py +++ b/scenarios/open_drive/od_4lane/scenario.py @@ -1,7 +1,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import Scenario +from smarts.sstudio.sstypes import Scenario gen_scenario( Scenario(), diff --git a/scenarios/open_drive/od_newmarket/scenario.py b/scenarios/open_drive/od_newmarket/scenario.py index d8b650194c..221cbe223a 100644 --- a/scenarios/open_drive/od_newmarket/scenario.py +++ b/scenarios/open_drive/od_newmarket/scenario.py @@ -1,7 +1,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import Scenario +from smarts.sstudio.sstypes import Scenario gen_scenario( Scenario(), diff --git a/scenarios/sumo/figure_eight/scenario.py b/scenarios/sumo/figure_eight/scenario.py index abd41dcaeb..4bda21176f 100644 --- a/scenarios/sumo/figure_eight/scenario.py +++ b/scenarios/sumo/figure_eight/scenario.py @@ -1,7 +1,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import Scenario +from smarts.sstudio.sstypes import Scenario gen_scenario( scenario=Scenario(), diff --git a/scenarios/sumo/intersections/1_to_1lane_left_turn_c_agents_1/scenario.py b/scenarios/sumo/intersections/1_to_1lane_left_turn_c_agents_1/scenario.py index 17f3324ec0..6b0339f646 100644 --- a/scenarios/sumo/intersections/1_to_1lane_left_turn_c_agents_1/scenario.py +++ b/scenarios/sumo/intersections/1_to_1lane_left_turn_c_agents_1/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Flow, MapZone, Mission, diff --git a/scenarios/sumo/intersections/1_to_2lane_left_turn_c_agents_1/scenario.py b/scenarios/sumo/intersections/1_to_2lane_left_turn_c_agents_1/scenario.py index 46955f3b18..6582a5695b 100644 --- a/scenarios/sumo/intersections/1_to_2lane_left_turn_c_agents_1/scenario.py +++ b/scenarios/sumo/intersections/1_to_2lane_left_turn_c_agents_1/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Flow, Mission, Route, diff --git a/scenarios/sumo/intersections/1_to_2lane_left_turn_t_agents_1/scenario.py b/scenarios/sumo/intersections/1_to_2lane_left_turn_t_agents_1/scenario.py index 420537e82d..e0c8942d32 100644 --- a/scenarios/sumo/intersections/1_to_2lane_left_turn_t_agents_1/scenario.py +++ b/scenarios/sumo/intersections/1_to_2lane_left_turn_t_agents_1/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Flow, Mission, Route, diff --git a/scenarios/sumo/intersections/1_to_3lane_left_turn_middle_lane_c_agents_1/scenario.py b/scenarios/sumo/intersections/1_to_3lane_left_turn_middle_lane_c_agents_1/scenario.py index c5fa5bd959..d5ad0ffbb5 100644 --- a/scenarios/sumo/intersections/1_to_3lane_left_turn_middle_lane_c_agents_1/scenario.py +++ b/scenarios/sumo/intersections/1_to_3lane_left_turn_middle_lane_c_agents_1/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Flow, Mission, Route, diff --git a/scenarios/sumo/intersections/1_to_3lane_left_turn_sumo_c_agents_1/scenario.py b/scenarios/sumo/intersections/1_to_3lane_left_turn_sumo_c_agents_1/scenario.py index f69ecc72c8..fb14b1cbb5 100644 --- a/scenarios/sumo/intersections/1_to_3lane_left_turn_sumo_c_agents_1/scenario.py +++ b/scenarios/sumo/intersections/1_to_3lane_left_turn_sumo_c_agents_1/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Flow, Mission, Route, diff --git a/scenarios/sumo/intersections/2lane/scenario.py b/scenarios/sumo/intersections/2lane/scenario.py index c7d047993e..b5c80d2e40 100644 --- a/scenarios/sumo/intersections/2lane/scenario.py +++ b/scenarios/sumo/intersections/2lane/scenario.py @@ -1,7 +1,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, JunctionModel, diff --git a/scenarios/sumo/intersections/2lane_circle/scenario.py b/scenarios/sumo/intersections/2lane_circle/scenario.py index 5295dcb110..b3e192c111 100644 --- a/scenarios/sumo/intersections/2lane_circle/scenario.py +++ b/scenarios/sumo/intersections/2lane_circle/scenario.py @@ -1,6 +1,6 @@ from pathlib import Path -import smarts.sstudio.types as t +import smarts.sstudio.sstypes as t from smarts.sstudio import gen_scenario laner_agent = t.SocialAgentActor( diff --git a/scenarios/sumo/intersections/4lane/scenario.py b/scenarios/sumo/intersections/4lane/scenario.py index cb9bf50295..a6386743c3 100644 --- a/scenarios/sumo/intersections/4lane/scenario.py +++ b/scenarios/sumo/intersections/4lane/scenario.py @@ -1,7 +1,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( EndlessMission, Flow, JunctionEdgeIDResolver, diff --git a/scenarios/sumo/intersections/6lane/scenario.py b/scenarios/sumo/intersections/6lane/scenario.py index 2538fa1840..023ea5a652 100644 --- a/scenarios/sumo/intersections/6lane/scenario.py +++ b/scenarios/sumo/intersections/6lane/scenario.py @@ -2,10 +2,10 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, Route, Scenario, SocialAgentActor, Traffic -from smarts.sstudio.types.entry_tactic import IdEntryTactic -from smarts.sstudio.types.route import RandomRoute -from smarts.sstudio.types.traffic import Trip +from smarts.sstudio.sstypes import Mission, Route, Scenario, SocialAgentActor, Traffic +from smarts.sstudio.sstypes.entry_tactic import IdEntryTactic +from smarts.sstudio.sstypes.route import RandomRoute +from smarts.sstudio.sstypes.traffic import Trip def actor_gen(id_): diff --git a/scenarios/sumo/merge/3lane_agents_1/scenario.py b/scenarios/sumo/merge/3lane_agents_1/scenario.py index 5c42c18e58..ed3adece41 100644 --- a/scenarios/sumo/merge/3lane_agents_1/scenario.py +++ b/scenarios/sumo/merge/3lane_agents_1/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Flow, Mission, Route, diff --git a/scenarios/sumo/merge/3lane_agents_2/scenario.py b/scenarios/sumo/merge/3lane_agents_2/scenario.py index 7a62dc7d2d..4a6d19bfac 100644 --- a/scenarios/sumo/merge/3lane_agents_2/scenario.py +++ b/scenarios/sumo/merge/3lane_agents_2/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Flow, Mission, Route, diff --git a/scenarios/sumo/straight/3lane_cruise_agents_1/scenario.py b/scenarios/sumo/straight/3lane_cruise_agents_1/scenario.py index 3976eb6db9..0ce7bc390c 100644 --- a/scenarios/sumo/straight/3lane_cruise_agents_1/scenario.py +++ b/scenarios/sumo/straight/3lane_cruise_agents_1/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Flow, Mission, Route, diff --git a/scenarios/sumo/straight/3lane_cruise_agents_3/scenario.py b/scenarios/sumo/straight/3lane_cruise_agents_3/scenario.py index d1503ec72d..0f08d5f8ea 100644 --- a/scenarios/sumo/straight/3lane_cruise_agents_3/scenario.py +++ b/scenarios/sumo/straight/3lane_cruise_agents_3/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Flow, Mission, Route, diff --git a/scenarios/sumo/straight/3lane_cut_in_agents_1/scenario.py b/scenarios/sumo/straight/3lane_cut_in_agents_1/scenario.py index b0d5884534..5d8c13adf1 100644 --- a/scenarios/sumo/straight/3lane_cut_in_agents_1/scenario.py +++ b/scenarios/sumo/straight/3lane_cut_in_agents_1/scenario.py @@ -25,7 +25,7 @@ from numpy import random from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, Mission, diff --git a/scenarios/sumo/straight/3lane_overtake_agents_1/scenario.py b/scenarios/sumo/straight/3lane_overtake_agents_1/scenario.py index 2372e2e33a..70d65a3e14 100644 --- a/scenarios/sumo/straight/3lane_overtake_agents_1/scenario.py +++ b/scenarios/sumo/straight/3lane_overtake_agents_1/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, Mission, diff --git a/scenarios/sumo/straight/cruise_2lane_agents_1/scenario.py b/scenarios/sumo/straight/cruise_2lane_agents_1/scenario.py index 7ad744cfe8..79fc83622a 100644 --- a/scenarios/sumo/straight/cruise_2lane_agents_1/scenario.py +++ b/scenarios/sumo/straight/cruise_2lane_agents_1/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, Mission, diff --git a/scenarios/sumo/straight/cutin_2lane_agents_1/scenario.py b/scenarios/sumo/straight/cutin_2lane_agents_1/scenario.py index 44fab3536f..34a6581300 100644 --- a/scenarios/sumo/straight/cutin_2lane_agents_1/scenario.py +++ b/scenarios/sumo/straight/cutin_2lane_agents_1/scenario.py @@ -5,7 +5,7 @@ from numpy import random from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, Mission, diff --git a/scenarios/sumo/straight/merge_exit_sumo_t_agents_1/scenario.py b/scenarios/sumo/straight/merge_exit_sumo_t_agents_1/scenario.py index 67446cff1e..ba03f44c7b 100644 --- a/scenarios/sumo/straight/merge_exit_sumo_t_agents_1/scenario.py +++ b/scenarios/sumo/straight/merge_exit_sumo_t_agents_1/scenario.py @@ -4,7 +4,7 @@ from smarts.core.colors import Colors from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, EndlessMission, Flow, diff --git a/scenarios/sumo/straight/overtake_2lane_agents_1/scenario.py b/scenarios/sumo/straight/overtake_2lane_agents_1/scenario.py index 8cf54f404f..cb3e230812 100644 --- a/scenarios/sumo/straight/overtake_2lane_agents_1/scenario.py +++ b/scenarios/sumo/straight/overtake_2lane_agents_1/scenario.py @@ -23,7 +23,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, Mission, diff --git a/scenarios/sumo/tests/same_location/scenario.py b/scenarios/sumo/tests/same_location/scenario.py index 6467d48291..792cade925 100644 --- a/scenarios/sumo/tests/same_location/scenario.py +++ b/scenarios/sumo/tests/same_location/scenario.py @@ -1,6 +1,6 @@ from pathlib import Path -import smarts.sstudio.types as types +import smarts.sstudio.sstypes as types from smarts.sstudio.genscenario import gen_agent_missions, gen_traffic scenario = str(Path(__file__).parent) diff --git a/scenarios/sumo/vehicle_following/merge_exit_sumo_agents_1/scenario.py b/scenarios/sumo/vehicle_following/merge_exit_sumo_agents_1/scenario.py index f233806849..76ec140f01 100644 --- a/scenarios/sumo/vehicle_following/merge_exit_sumo_agents_1/scenario.py +++ b/scenarios/sumo/vehicle_following/merge_exit_sumo_agents_1/scenario.py @@ -4,7 +4,7 @@ from smarts.core.colors import Colors from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, EndlessMission, Flow, diff --git a/scenarios/sumo/vehicle_following/merge_exit_sumo_t_agents_1/scenario.py b/scenarios/sumo/vehicle_following/merge_exit_sumo_t_agents_1/scenario.py index 5662462a87..6706bbad73 100644 --- a/scenarios/sumo/vehicle_following/merge_exit_sumo_t_agents_1/scenario.py +++ b/scenarios/sumo/vehicle_following/merge_exit_sumo_t_agents_1/scenario.py @@ -4,7 +4,7 @@ from smarts.core.colors import Colors from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, EndlessMission, Flow, diff --git a/scenarios/sumo/vehicle_following/merge_exit_sumo_t_agents_2/scenario.py b/scenarios/sumo/vehicle_following/merge_exit_sumo_t_agents_2/scenario.py index d39c58b9c0..fa6dc0c44a 100644 --- a/scenarios/sumo/vehicle_following/merge_exit_sumo_t_agents_2/scenario.py +++ b/scenarios/sumo/vehicle_following/merge_exit_sumo_t_agents_2/scenario.py @@ -4,7 +4,7 @@ from smarts.core.colors import Colors from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, EndlessMission, Flow, diff --git a/scenarios/sumo/vehicle_following/straight_2lane_sumo_agents_1/scenario.py b/scenarios/sumo/vehicle_following/straight_2lane_sumo_agents_1/scenario.py index 9c872e6f46..4e2d6b5652 100644 --- a/scenarios/sumo/vehicle_following/straight_2lane_sumo_agents_1/scenario.py +++ b/scenarios/sumo/vehicle_following/straight_2lane_sumo_agents_1/scenario.py @@ -4,7 +4,7 @@ from smarts.core.colors import Colors from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, EndlessMission, Flow, diff --git a/scenarios/sumo/vehicle_following/straight_2lane_sumo_t_agents_1/scenario.py b/scenarios/sumo/vehicle_following/straight_2lane_sumo_t_agents_1/scenario.py index 0f6fe2c37a..d83b78b6a5 100644 --- a/scenarios/sumo/vehicle_following/straight_2lane_sumo_t_agents_1/scenario.py +++ b/scenarios/sumo/vehicle_following/straight_2lane_sumo_t_agents_1/scenario.py @@ -4,7 +4,7 @@ from smarts.core.colors import Colors from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, EndlessMission, Flow, diff --git a/scenarios/sumo/vehicle_following/straight_3lanes_sumo_agents_1/scenario.py b/scenarios/sumo/vehicle_following/straight_3lanes_sumo_agents_1/scenario.py index 44cdaa8f17..1933e57288 100644 --- a/scenarios/sumo/vehicle_following/straight_3lanes_sumo_agents_1/scenario.py +++ b/scenarios/sumo/vehicle_following/straight_3lanes_sumo_agents_1/scenario.py @@ -4,7 +4,7 @@ from smarts.core.colors import Colors from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, EndlessMission, Flow, diff --git a/scenarios/sumo/vehicle_following/straight_3lanes_sumo_t_agents_1/scenario.py b/scenarios/sumo/vehicle_following/straight_3lanes_sumo_t_agents_1/scenario.py index 8e8876cd46..ba6e040225 100644 --- a/scenarios/sumo/vehicle_following/straight_3lanes_sumo_t_agents_1/scenario.py +++ b/scenarios/sumo/vehicle_following/straight_3lanes_sumo_t_agents_1/scenario.py @@ -4,7 +4,7 @@ from smarts.core.colors import Colors from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, EndlessMission, Flow, diff --git a/scenarios/sumo/vehicle_following/straight_3lanes_sumo_t_agents_2/scenario.py b/scenarios/sumo/vehicle_following/straight_3lanes_sumo_t_agents_2/scenario.py index 5fd52147af..4aaf4fd17d 100644 --- a/scenarios/sumo/vehicle_following/straight_3lanes_sumo_t_agents_2/scenario.py +++ b/scenarios/sumo/vehicle_following/straight_3lanes_sumo_t_agents_2/scenario.py @@ -4,7 +4,7 @@ from smarts.core.colors import Colors from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, EndlessMission, Flow, diff --git a/scenarios/sumo/zoo_intersection/scenario.py b/scenarios/sumo/zoo_intersection/scenario.py index d21f018630..e79360c4c8 100644 --- a/scenarios/sumo/zoo_intersection/scenario.py +++ b/scenarios/sumo/zoo_intersection/scenario.py @@ -2,7 +2,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, EndlessMission, Flow, diff --git a/smarts/benchmark/entrypoints/benchmark_runner_v0.py b/smarts/benchmark/entrypoints/benchmark_runner_v0.py index beb1749f2e..0068a80c2e 100644 --- a/smarts/benchmark/entrypoints/benchmark_runner_v0.py +++ b/smarts/benchmark/entrypoints/benchmark_runner_v0.py @@ -31,8 +31,8 @@ from smarts.benchmark.driving_smarts import load_config from smarts.core import config +from smarts.core.utils.core_logging import suppress_output from smarts.core.utils.import_utils import import_module_from_file -from smarts.core.utils.logging import suppress_output from smarts.env.gymnasium.wrappers.metric.formula import FormulaBase, Score from smarts.env.gymnasium.wrappers.metric.metrics import Metrics from smarts.env.gymnasium.wrappers.metric.types import Record diff --git a/smarts/core/actor_capture_manager.py b/smarts/core/actor_capture_manager.py index 6489bf9ee5..4de044222d 100644 --- a/smarts/core/actor_capture_manager.py +++ b/smarts/core/actor_capture_manager.py @@ -29,7 +29,7 @@ from smarts.core.actor import ActorState from smarts.core.plan import Plan from smarts.core.vehicle import Vehicle -from smarts.sstudio.types import ConditionRequires +from smarts.sstudio.sstypes import ConditionRequires class ActorCaptureManager: diff --git a/smarts/core/agent_manager.py b/smarts/core/agent_manager.py index 1a44fd4acf..cf3c8d19bf 100644 --- a/smarts/core/agent_manager.py +++ b/smarts/core/agent_manager.py @@ -23,7 +23,7 @@ from concurrent import futures from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union -from envision.types import format_actor_id +from envision.etypes import format_actor_id from smarts.core.actor import ActorRole from smarts.core.agent_interface import AgentInterface from smarts.core.bubble_manager import BubbleManager @@ -34,7 +34,7 @@ from smarts.core.sensor_manager import SensorManager from smarts.core.utils.id import SocialAgentId from smarts.core.vehicle_state import VehicleState -from smarts.sstudio.types.actor.social_agent_actor import SocialAgentActor +from smarts.sstudio.sstypes.actor.social_agent_actor import SocialAgentActor from smarts.zoo.registry import make as make_social_agent diff --git a/smarts/core/argoverse_map.py b/smarts/core/argoverse_map.py index 50f58a8846..12eb039e16 100644 --- a/smarts/core/argoverse_map.py +++ b/smarts/core/argoverse_map.py @@ -33,14 +33,14 @@ from smarts.core.lanepoints import LanePoint, LanePoints, LinkedLanePoint from smarts.core.road_map import RoadMap, RoadMapWithCaches, Waypoint from smarts.core.route_cache import RouteWithCache -from smarts.core.utils.glb import make_map_glb, make_road_line_glb -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( inplace_unwrap, line_intersect_vectorized, radians_to_vec, vec_2d, ) -from smarts.sstudio.types import MapSpec +from smarts.core.utils.glb import make_map_glb, make_road_line_glb +from smarts.sstudio.sstypes import MapSpec try: import rtree diff --git a/smarts/core/bubble_manager.py b/smarts/core/bubble_manager.py index 8d5aee19d3..42f50a05d6 100644 --- a/smarts/core/bubble_manager.py +++ b/smarts/core/bubble_manager.py @@ -47,11 +47,11 @@ from smarts.core.utils.string import truncate from smarts.core.vehicle import Vehicle from smarts.core.vehicle_index import VehicleIndex -from smarts.sstudio.types import BoidAgentActor -from smarts.sstudio.types import Bubble as SSBubble -from smarts.sstudio.types import BubbleLimits, SocialAgentActor -from smarts.sstudio.types.actor.traffic_engine_actor import TrafficEngineActor -from smarts.sstudio.types.condition import Condition +from smarts.sstudio.sstypes import BoidAgentActor +from smarts.sstudio.sstypes import Bubble as SSBubble +from smarts.sstudio.sstypes import BubbleLimits, SocialAgentActor +from smarts.sstudio.sstypes.actor.traffic_engine_actor import TrafficEngineActor +from smarts.sstudio.sstypes.condition import Condition from smarts.zoo.registry import make as make_social_agent @@ -82,7 +82,7 @@ class BubbleCaptureState(Enum): class Bubble: - """Wrapper around `sstudio.types.Bubble` to cache bubble geometry (and does some + """Wrapper around `sstudio.sstypes.Bubble` to cache bubble geometry (and does some internal Bubble-related business logic). """ @@ -214,7 +214,7 @@ def admissibility( running_cursors: Set["Cursor"], ): """The vehicle_id we are querying for and the `other_vehicle_ids` _presently in - this :class:`~smarts.sstudio.types.bubble.Bubble`. + this :class:`~smarts.sstudio.sstypes.bubble.Bubble`. """ for prefix in self.exclusion_prefixes: if vehicle_id.startswith(prefix): diff --git a/smarts/core/chassis.py b/smarts/core/chassis.py index 14c613d3c4..5457239dff 100644 --- a/smarts/core/chassis.py +++ b/smarts/core/chassis.py @@ -41,7 +41,7 @@ JointInfo, JointState, ) -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( min_angles_difference_signed, radians_to_vec, vec_to_radians, diff --git a/smarts/core/controllers/direct_controller.py b/smarts/core/controllers/direct_controller.py index a1c0f13b93..563a753b0d 100644 --- a/smarts/core/controllers/direct_controller.py +++ b/smarts/core/controllers/direct_controller.py @@ -24,7 +24,7 @@ from smarts.core.chassis import AckermannChassis, BoxChassis from smarts.core.coordinates import Pose -from smarts.core.utils.math import fast_quaternion_from_angle, radians_to_vec +from smarts.core.utils.core_math import fast_quaternion_from_angle, radians_to_vec class DirectController: diff --git a/smarts/core/controllers/lane_following_controller.py b/smarts/core/controllers/lane_following_controller.py index 550696000c..bf2983c0c8 100644 --- a/smarts/core/controllers/lane_following_controller.py +++ b/smarts/core/controllers/lane_following_controller.py @@ -25,7 +25,11 @@ from smarts.core.controllers.trajectory_tracking_controller import ( TrajectoryTrackingController, ) -from smarts.core.utils.math import lerp, low_pass_filter, min_angles_difference_signed +from smarts.core.utils.core_math import ( + lerp, + low_pass_filter, + min_angles_difference_signed, +) METER_PER_SECOND_TO_KM_PER_HR = 3.6 diff --git a/smarts/core/controllers/trajectory_tracking_controller.py b/smarts/core/controllers/trajectory_tracking_controller.py index 92a8f6c516..40fa7934f4 100644 --- a/smarts/core/controllers/trajectory_tracking_controller.py +++ b/smarts/core/controllers/trajectory_tracking_controller.py @@ -23,7 +23,7 @@ import numpy as np from numpy.linalg import matrix_power -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( lerp, low_pass_filter, min_angles_difference_signed, diff --git a/smarts/core/coordinates.py b/smarts/core/coordinates.py index 930ac9ad16..d0cb7ecdb7 100644 --- a/smarts/core/coordinates.py +++ b/smarts/core/coordinates.py @@ -26,7 +26,7 @@ from shapely.geometry import Point as SPoint from typing_extensions import SupportsIndex -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( fast_quaternion_from_angle, radians_to_vec, yaw_from_quaternion, diff --git a/smarts/core/default_map_builder.py b/smarts/core/default_map_builder.py index 99dd5e3170..04e729c03f 100644 --- a/smarts/core/default_map_builder.py +++ b/smarts/core/default_map_builder.py @@ -31,7 +31,7 @@ def _cache_result(map_spec, road_map, road_map_hash: str): global _existing_map - from smarts.sstudio.types import MapSpec + from smarts.sstudio.sstypes import MapSpec class _RoadMapInfo(NamedTuple): map_spec: MapSpec # pytype: disable=invalid-annotation diff --git a/smarts/core/id_actor_capture_manager.py b/smarts/core/id_actor_capture_manager.py index 88bfb5a356..671271367a 100644 --- a/smarts/core/id_actor_capture_manager.py +++ b/smarts/core/id_actor_capture_manager.py @@ -26,7 +26,7 @@ from smarts.core.condition_state import ConditionState from smarts.core.plan import Mission from smarts.core.vehicle import Vehicle -from smarts.sstudio.types import IdEntryTactic +from smarts.sstudio.sstypes import IdEntryTactic class IdActorCaptureManager(ActorCaptureManager): diff --git a/smarts/core/lanepoints.py b/smarts/core/lanepoints.py index f1086064a8..53a02842e0 100644 --- a/smarts/core/lanepoints.py +++ b/smarts/core/lanepoints.py @@ -31,7 +31,7 @@ from smarts.core.coordinates import Heading, Point, Pose from smarts.core.road_map import RoadMap -from smarts.core.utils.math import fast_quaternion_from_angle, vec_to_radians +from smarts.core.utils.core_math import fast_quaternion_from_angle, vec_to_radians @dataclass(frozen=True) diff --git a/smarts/core/lidar.py b/smarts/core/lidar.py index 84687a999f..27258d8af3 100644 --- a/smarts/core/lidar.py +++ b/smarts/core/lidar.py @@ -26,7 +26,7 @@ from .lidar_sensor_params import SensorParams from .utils import pybullet -from .utils.math import batches, rotate_quat +from .utils.core_math import batches, rotate_quat from .utils.pybullet import bullet_client as bc diff --git a/smarts/core/local_traffic_provider.py b/smarts/core/local_traffic_provider.py index 61bc8a058a..751dd91eb2 100644 --- a/smarts/core/local_traffic_provider.py +++ b/smarts/core/local_traffic_provider.py @@ -44,13 +44,17 @@ from .scenario import Scenario from .signals import SignalLightState, SignalState from .traffic_provider import TrafficProvider +from .utils.core_math import ( + min_angles_difference_signed, + radians_to_vec, + vec_to_radians, +) from .utils.kinematics import ( distance_covered, stopping_distance, stopping_time, time_to_cover, ) -from .utils.math import min_angles_difference_signed, radians_to_vec, vec_to_radians from .vehicle import VEHICLE_CONFIGS, VehicleState MAX_IMPATIENCE = 3.0 @@ -484,7 +488,7 @@ def __init__(self, flow: Dict[str, Any], owner: LocalTrafficProvider): self._dest_offset = None self._wrong_way: bool = False - # The default values here all attempt to match those in sstudio.types, + # The default values here all attempt to match those in sstudio.sstypes, # which in turn attempt to match Sumo's defaults. self._min_space_cush = float(self._vtype.get("minGap", 2.5)) speed_factor = float(self._vtype.get("speedFactor", 1.0)) @@ -641,7 +645,7 @@ def _resolve_flow_pos( def _resolve_flow_speed(self, flow: Dict[str, Any]) -> float: depart_speed = flow.get("departSpeed", 0.0) - # maxSpeed's default attempts to match the one in sstudio.types, + # maxSpeed's default attempts to match the one in sstudio.sstypes, # which in turn attempt to match Sumo's default. max_speed = float(self._vtype.get("maxSpeed", 55.5)) if depart_speed == "random": diff --git a/smarts/core/models/controller_parameters.yaml b/smarts/core/models/controller_parameters.yaml index 6cfec16778..d775c05a8e 100644 --- a/smarts/core/models/controller_parameters.yaml +++ b/smarts/core/models/controller_parameters.yaml @@ -49,3 +49,28 @@ bus: max_btorque : 1200 max_steering : 12.56 steering_gear_ratio : 17.4 +truck: + control: + final_heading_gain: 0.15 + final_lateral_gain: 5.3 + final_steering_filter_constant: 27.5 + throttle_filter_constant: 2 + velocity_gain: 6.1 + velocity_integral_gain: 0 + traction_gain: 8 + final_lateral_error_derivative_gain: 0.45 + final_heading_error_derivative_gain: 2.5 + initial_look_ahead_distant: 3 + derivative_activation: 1 + speed_reduction_activation: 0 + velocity_damping_gain: 0.001 + windup_gain: 0.01 + chassis: + chassis_aero_force_gain : 0.63 + max_brake_gain : 10000 + max_turn_radius : 2.2 + wheel_radius : 0.31265 + max_torque : 2100 + max_btorque : 1200 + max_steering : 12.56 + steering_gear_ratio : 17.4 \ No newline at end of file diff --git a/smarts/core/opendrive_road_network.py b/smarts/core/opendrive_road_network.py index 58c6391d25..35b74f3413 100644 --- a/smarts/core/opendrive_road_network.py +++ b/smarts/core/opendrive_road_network.py @@ -75,8 +75,7 @@ from smarts.core.road_map import RoadMap, RoadMapWithCaches, Waypoint from smarts.core.route_cache import RouteWithCache -from smarts.core.utils.key_wrapper import KeyWrapper -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( CubicPolynomial, constrain_angle, get_linear_segments_for_range, @@ -85,7 +84,8 @@ radians_to_vec, vec_2d, ) -from smarts.sstudio.types import MapSpec +from smarts.core.utils.key_wrapper import KeyWrapper +from smarts.sstudio.sstypes import MapSpec from .coordinates import BoundingBox, Heading, Point, Pose, RefLinePoint from .lanepoints import LanePoints, LinkedLanePoint diff --git a/smarts/core/plan.py b/smarts/core/plan.py index 255d49180b..7ceef9a8eb 100644 --- a/smarts/core/plan.py +++ b/smarts/core/plan.py @@ -32,8 +32,8 @@ from smarts.core.coordinates import Dimensions, Heading, Point, Pose, RefLinePoint from smarts.core.road_map import RoadMap -from smarts.core.utils.math import min_angles_difference_signed, vec_to_radians -from smarts.sstudio.types import EntryTactic, TrapEntryTactic +from smarts.core.utils.core_math import min_angles_difference_signed, vec_to_radians +from smarts.sstudio.sstypes import EntryTactic, TrapEntryTactic MISSING = sys.maxsize @@ -203,7 +203,7 @@ class VehicleSpec: class Mission: """A navigation mission describing a desired trip.""" - # XXX: Note that this Mission differs from sstudio.types.Mission in that + # XXX: Note that this Mission differs from sstudio.sstypes.Mission in that # this can be less specific as to the particular route taken to the goal, # whereas sstudio.type.Mission includes a specific, predetermined/static route # (which might be random, but is still determined before running the scenario). @@ -275,7 +275,7 @@ class LapMission(Mission): num_laps: Optional[int] = None # None means infinite # of laps - # If a route was specified in a sstudio.types.LapMission object, + # If a route was specified in a sstudio.sstypes.LapMission object, # then this should be set to its road length route_length: Optional[float] = None diff --git a/smarts/core/road_map.py b/smarts/core/road_map.py index c1e171a2c8..53022e0bbc 100644 --- a/smarts/core/road_map.py +++ b/smarts/core/road_map.py @@ -34,7 +34,7 @@ from shapely.geometry import Polygon from smarts.core.coordinates import BoundingBox, Heading, Point, Pose, RefLinePoint -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( fast_quaternion_from_angle, min_angles_difference_signed, signed_dist_to_line, diff --git a/smarts/core/scenario.py b/smarts/core/scenario.py index f426e3fe17..4fc06296c6 100644 --- a/smarts/core/scenario.py +++ b/smarts/core/scenario.py @@ -59,16 +59,16 @@ ) from smarts.core.road_map import RoadMap from smarts.core.traffic_history import TrafficHistory -from smarts.core.utils.file import make_dir_in_smarts_log_dir, path2hash -from smarts.core.utils.id import SocialAgentId -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( combination_pairs_with_unique_indices, radians_to_vec, vec_to_radians, ) -from smarts.sstudio import types as sstudio_types -from smarts.sstudio.types import EntryTactic, MapSpec -from smarts.sstudio.types import Via as SSVia +from smarts.core.utils.file import make_dir_in_smarts_log_dir, path2hash +from smarts.core.utils.id import SocialAgentId +from smarts.sstudio import sstypes as sstudio_types +from smarts.sstudio.sstypes import EntryTactic, MapSpec +from smarts.sstudio.sstypes import Via as SSVia VehicleWindow = TrafficHistory.TrafficHistoryVehicleWindow @@ -95,10 +95,10 @@ class Scenario: missions: agent_id to mission mapping. map_spec: - If specified, allows specifying a :class:`~smarts.sstudio.types.map_spec.MapSpec` at run-time + If specified, allows specifying a :class:`~smarts.sstudio.sstypes.map_spec.MapSpec` at run-time to override any spec that may have been pre-specified in the scenario folder (or the default if none were). - Also see comments around the :class:`~smarts.sstudio.types.map_spec.MapSpec` definition. + Also see comments around the :class:`~smarts.sstudio.sstypes.map_spec.MapSpec` definition. """ def __init__( @@ -725,7 +725,7 @@ def discover_traffic_histories(scenario_root: str): @staticmethod def _extract_mission(mission, road_map): - """Takes a sstudio.types.(Mission, EndlessMission, etc.) and converts it to + """Takes a sstudio.sstypes.(Mission, EndlessMission, etc.) and converts it to the corresponding SMARTS mission types. """ diff --git a/smarts/core/sensor.py b/smarts/core/sensor.py index 5e85332906..0c38e60eff 100644 --- a/smarts/core/sensor.py +++ b/smarts/core/sensor.py @@ -45,7 +45,7 @@ from smarts.core.renderer_base import RendererBase from smarts.core.road_map import RoadMap, Waypoint from smarts.core.signals import SignalState -from smarts.core.utils.math import squared_dist +from smarts.core.utils.core_math import squared_dist from smarts.core.vehicle_state import VehicleState, neighborhood_vehicles_around_vehicle diff --git a/smarts/core/sensors/local_sensor_resolver.py b/smarts/core/sensors/local_sensor_resolver.py index 6f3ce89633..7b4e678254 100644 --- a/smarts/core/sensors/local_sensor_resolver.py +++ b/smarts/core/sensors/local_sensor_resolver.py @@ -25,8 +25,8 @@ from smarts.core.sensors import SensorResolver, Sensors from smarts.core.simulation_frame import SimulationFrame from smarts.core.simulation_local_constants import SimulationLocalConstants +from smarts.core.utils.core_logging import timeit from smarts.core.utils.file import replace -from smarts.core.utils.logging import timeit logger = logging.getLogger(__name__) diff --git a/smarts/core/sensors/parallel_sensor_resolver.py b/smarts/core/sensors/parallel_sensor_resolver.py index 3335ede279..39e51c20f0 100644 --- a/smarts/core/sensors/parallel_sensor_resolver.py +++ b/smarts/core/sensors/parallel_sensor_resolver.py @@ -33,8 +33,8 @@ from smarts.core.sensors import SensorResolver, Sensors from smarts.core.simulation_frame import SimulationFrame from smarts.core.simulation_local_constants import SimulationLocalConstants +from smarts.core.utils.core_logging import timeit from smarts.core.utils.file import replace -from smarts.core.utils.logging import timeit logger = logging.getLogger(__name__) diff --git a/smarts/core/serialization/default.py b/smarts/core/serialization/default.py index 58e732f245..f946092aa1 100644 --- a/smarts/core/serialization/default.py +++ b/smarts/core/serialization/default.py @@ -68,10 +68,10 @@ def __eq__(self, __o: object) -> bool: return self.road_map_hash == getattr(__o, "road_map_hash") def deproxy(self): - import smarts.sstudio.types + import smarts.sstudio.sstypes from smarts.core.simulation_local_constants import SimulationLocalConstants - assert isinstance(self.road_map_spec, smarts.sstudio.types.MapSpec) + assert isinstance(self.road_map_spec, smarts.sstudio.sstypes.MapSpec) road_map, _ = self.road_map_spec.builder_fn(self.road_map_spec) return SimulationLocalConstants(road_map, self.road_map_hash) diff --git a/smarts/core/shape.py b/smarts/core/shape.py index f021a0caf6..cd15a9e910 100644 --- a/smarts/core/shape.py +++ b/smarts/core/shape.py @@ -21,7 +21,7 @@ from typing import List, Optional, Union from smarts.core.coordinates import Point -from smarts.core.utils.math import is_close +from smarts.core.utils.core_math import is_close ## Note: the methods in this file are not efficient / optimized, ## so they shouldn't be used on the critical path(s). @@ -141,7 +141,7 @@ def distance_point_to_line( if offset == 0: return euclidean_distance(point, p1) u = offset / euclidean_distance(line_start, line_end) - intersection = (p1[0] + u * (p2[0] - p1[0]), p1[1] + u * (p2[1] - p1[1])) + intersection = Point(p1[0] + u * (p2[0] - p1[0]), p1[1] + u * (p2[1] - p1[1])) return euclidean_distance(point, intersection) diff --git a/smarts/core/smarts.py b/smarts/core/smarts.py index bc23732f41..a6eaffbbc5 100644 --- a/smarts/core/smarts.py +++ b/smarts/core/smarts.py @@ -38,7 +38,7 @@ import numpy as np -from envision import types as envision_types +from envision import etypes as envision_types from envision.client import Client as EnvisionClient from smarts import VERSION from smarts.core.actor_capture_manager import ActorCaptureManager @@ -46,7 +46,7 @@ from smarts.core.plan import Plan from smarts.core.renderer_base import RendererBase from smarts.core.simulation_local_constants import SimulationLocalConstants -from smarts.core.utils.logging import timeit +from smarts.core.utils.core_logging import timeit from smarts.core.utils.type_operations import TypeSuite from . import config, models @@ -82,8 +82,8 @@ from .traffic_provider import TrafficProvider from .trap_manager import TrapManager from .utils import pybullet +from .utils.core_math import rounder_for_dt from .utils.id import Id -from .utils.math import rounder_for_dt from .utils.pybullet import bullet_client as bc from .vehicle import Vehicle from .vehicle_index import VehicleIndex diff --git a/smarts/core/sumo_road_network.py b/smarts/core/sumo_road_network.py index 308dc0b4ed..d79df24cc2 100644 --- a/smarts/core/sumo_road_network.py +++ b/smarts/core/sumo_road_network.py @@ -30,15 +30,15 @@ from shapely.geometry import Polygon from shapely.ops import nearest_points, snap -from smarts.sstudio.types import MapSpec +from smarts.sstudio.sstypes import MapSpec from .coordinates import BoundingBox, Heading, Point, Pose, RefLinePoint from .lanepoints import LanePoint, LanePoints, LinkedLanePoint from .road_map import RoadMap, Waypoint from .route_cache import RouteWithCache +from .utils.core_math import inplace_unwrap, radians_to_vec, vec_2d from .utils.geometry import buffered_shape from .utils.glb import make_map_glb, make_road_line_glb -from .utils.math import inplace_unwrap, radians_to_vec, vec_2d from smarts.core.utils.sumo import sumolib # isort:skip from sumolib.net.edge import Edge # isort:skip diff --git a/smarts/core/sumo_traffic_simulation.py b/smarts/core/sumo_traffic_simulation.py index 3826c6a5fe..89806e9538 100644 --- a/smarts/core/sumo_traffic_simulation.py +++ b/smarts/core/sumo_traffic_simulation.py @@ -45,7 +45,7 @@ from smarts.core.signals import SignalLightState, SignalState from smarts.core.sumo_road_network import SumoRoadNetwork from smarts.core.traffic_provider import TrafficProvider -from smarts.core.utils.logging import suppress_output +from smarts.core.utils.core_logging import suppress_output from smarts.core.vehicle import VEHICLE_CONFIGS, VehicleState from smarts.core.utils.sumo import traci, TraciConn # isort:skip diff --git a/smarts/core/tests/test_boids.py b/smarts/core/tests/test_boids.py index 293d14e0a2..ff2a56e67a 100644 --- a/smarts/core/tests/test_boids.py +++ b/smarts/core/tests/test_boids.py @@ -29,7 +29,7 @@ from helpers.scenario import temp_scenario from shapely.geometry import Point -import smarts.sstudio.types as t +import smarts.sstudio.sstypes as t from smarts.core import seed from smarts.core.local_traffic_provider import LocalTrafficProvider from smarts.core.scenario import Scenario diff --git a/smarts/core/tests/test_bubble_hijacking.py b/smarts/core/tests/test_bubble_hijacking.py index 31500d6030..96acc800b6 100644 --- a/smarts/core/tests/test_bubble_hijacking.py +++ b/smarts/core/tests/test_bubble_hijacking.py @@ -30,7 +30,7 @@ from helpers.scenario import temp_scenario from shapely.geometry import Point -import smarts.sstudio.types as t +import smarts.sstudio.sstypes as t from smarts.core.local_traffic_provider import LocalTrafficProvider from smarts.core.scenario import Scenario from smarts.core.smarts import SMARTS diff --git a/smarts/core/tests/test_bubble_manager.py b/smarts/core/tests/test_bubble_manager.py index c9b7547d58..ff2b1f4246 100644 --- a/smarts/core/tests/test_bubble_manager.py +++ b/smarts/core/tests/test_bubble_manager.py @@ -26,7 +26,7 @@ import pytest from helpers.scenario import temp_scenario -import smarts.sstudio.types as t +import smarts.sstudio.sstypes as t from smarts.core.controllers import ActionSpaceType from smarts.core.coordinates import Heading, Pose from smarts.core.scenario import Scenario diff --git a/smarts/core/tests/test_collision.py b/smarts/core/tests/test_collision.py index 8efdef0137..037c7bc526 100644 --- a/smarts/core/tests/test_collision.py +++ b/smarts/core/tests/test_collision.py @@ -38,7 +38,7 @@ from smarts.core.utils.pybullet import bullet_client as bc from smarts.core.vehicle import VEHICLE_CONFIGS from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t @pytest.fixture diff --git a/smarts/core/tests/test_controller_lane.py b/smarts/core/tests/test_controller_lane.py index 64772bab96..e5283eebb3 100644 --- a/smarts/core/tests/test_controller_lane.py +++ b/smarts/core/tests/test_controller_lane.py @@ -21,7 +21,7 @@ # THE SOFTWARE. import pytest -import smarts.sstudio.types as t +import smarts.sstudio.sstypes as t from smarts.core.agent import Agent from smarts.core.agent_interface import AgentInterface, AgentType from smarts.core.controllers import LaneFollowingController diff --git a/smarts/core/tests/test_map.py b/smarts/core/tests/test_map.py index 01ba68c0dd..d426df25e1 100644 --- a/smarts/core/tests/test_map.py +++ b/smarts/core/tests/test_map.py @@ -33,7 +33,7 @@ from smarts.core.road_map import RoadMap from smarts.core.scenario import Scenario from smarts.core.sumo_road_network import SumoRoadNetwork -from smarts.sstudio.types import MapSpec +from smarts.sstudio.sstypes import MapSpec @pytest.fixture diff --git a/smarts/core/tests/test_parallel_sensors.py b/smarts/core/tests/test_parallel_sensors.py index 2843b3a96b..f1681d9b19 100644 --- a/smarts/core/tests/test_parallel_sensors.py +++ b/smarts/core/tests/test_parallel_sensors.py @@ -33,7 +33,7 @@ from smarts.core.simulation_local_constants import SimulationLocalConstants from smarts.core.smarts import SMARTS from smarts.core.sumo_traffic_simulation import SumoTrafficSimulation -from smarts.core.utils.logging import diff_unpackable +from smarts.core.utils.core_logging import diff_unpackable AGENT_IDS = [f"agent-00{i}" for i in range(3)] diff --git a/smarts/core/tests/test_scenario.py b/smarts/core/tests/test_scenario.py index 85ae0d52d1..9cc3688427 100644 --- a/smarts/core/tests/test_scenario.py +++ b/smarts/core/tests/test_scenario.py @@ -27,7 +27,7 @@ from smarts.core.scenario import Scenario from smarts.core.utils.id import SocialAgentId from smarts.sstudio.genscenario import gen_agent_missions, gen_social_agent_missions -from smarts.sstudio.types import Mission, Route, SocialAgentActor +from smarts.sstudio.sstypes import Mission, Route, SocialAgentActor AGENT_ID = "Agent-007" diff --git a/smarts/core/tests/test_sensor_worker.py b/smarts/core/tests/test_sensor_worker.py index c687df33f6..a3619cc69c 100644 --- a/smarts/core/tests/test_sensor_worker.py +++ b/smarts/core/tests/test_sensor_worker.py @@ -36,7 +36,7 @@ from smarts.core.simulation_frame import SimulationFrame from smarts.core.smarts import SMARTS from smarts.core.sumo_traffic_simulation import SumoTrafficSimulation -from smarts.core.utils.logging import diff_unpackable +from smarts.core.utils.core_logging import diff_unpackable SimulationState = SimulationFrame SensorState = Any diff --git a/smarts/core/tests/test_sensors.py b/smarts/core/tests/test_sensors.py index dc8d976725..4cbe14d57e 100644 --- a/smarts/core/tests/test_sensors.py +++ b/smarts/core/tests/test_sensors.py @@ -29,9 +29,9 @@ from smarts.core.plan import Plan from smarts.core.scenario import Scenario from smarts.core.sensors import DrivenPathSensor, TripMeterSensor, WaypointsSensor -from smarts.core.utils.math import squared_dist +from smarts.core.utils.core_math import squared_dist from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t AGENT_ID = "Agent-007" diff --git a/smarts/core/tests/test_smarts_frame_rate.py b/smarts/core/tests/test_smarts_frame_rate.py index c3fc3cb39b..60a7e936d3 100644 --- a/smarts/core/tests/test_smarts_frame_rate.py +++ b/smarts/core/tests/test_smarts_frame_rate.py @@ -30,7 +30,7 @@ from smarts.core.smarts import SMARTS from smarts.core.sumo_traffic_simulation import SumoTrafficSimulation from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t AGENT_1 = "Agent_007" diff --git a/smarts/core/tests/test_traffic_provider_collision_avoidance.py b/smarts/core/tests/test_traffic_provider_collision_avoidance.py index 72b1160b19..2c60f4cdf1 100644 --- a/smarts/core/tests/test_traffic_provider_collision_avoidance.py +++ b/smarts/core/tests/test_traffic_provider_collision_avoidance.py @@ -24,7 +24,7 @@ # TODO: Rename temp_scenario(...) from helpers.scenario import temp_scenario -import smarts.sstudio.types as t +import smarts.sstudio.sstypes as t from smarts.core.local_traffic_provider import LocalTrafficProvider from smarts.core.scenario import Scenario from smarts.core.smarts import SMARTS diff --git a/smarts/core/tests/test_trajectory_interpolation_provider.py b/smarts/core/tests/test_trajectory_interpolation_provider.py index 530e029af9..2b66c2ba54 100644 --- a/smarts/core/tests/test_trajectory_interpolation_provider.py +++ b/smarts/core/tests/test_trajectory_interpolation_provider.py @@ -24,7 +24,7 @@ import numpy as np import pytest -import smarts.sstudio.types as t +import smarts.sstudio.sstypes as t from smarts.core.agent import Agent from smarts.core.agent_interface import AgentInterface, AgentType from smarts.core.chassis import BoxChassis diff --git a/smarts/core/tests/test_trap_manager.py b/smarts/core/tests/test_trap_manager.py index 28844bc46f..d8ebc0a7ce 100644 --- a/smarts/core/tests/test_trap_manager.py +++ b/smarts/core/tests/test_trap_manager.py @@ -22,7 +22,7 @@ import pytest from helpers.scenario import temp_scenario -import smarts.sstudio.types as t +import smarts.sstudio.sstypes as t from smarts.core.agent_interface import AgentInterface, AgentType from smarts.core.local_traffic_provider import LocalTrafficProvider from smarts.core.scenario import Scenario diff --git a/smarts/core/traffic_history.py b/smarts/core/traffic_history.py index afe7c021c1..8fef1b4bea 100644 --- a/smarts/core/traffic_history.py +++ b/smarts/core/traffic_history.py @@ -40,7 +40,7 @@ ) from smarts.core.coordinates import Dimensions -from smarts.core.utils.math import radians_to_vec +from smarts.core.utils.core_math import radians_to_vec from smarts.core.vehicle import VEHICLE_CONFIGS T = TypeVar("T") diff --git a/smarts/core/traffic_history_provider.py b/smarts/core/traffic_history_provider.py index d04d13c337..b136cf4f84 100644 --- a/smarts/core/traffic_history_provider.py +++ b/smarts/core/traffic_history_provider.py @@ -33,7 +33,7 @@ from smarts.core.signals import SignalLightState, SignalState from smarts.core.traffic_history import TrafficHistory from smarts.core.traffic_provider import TrafficProvider -from smarts.core.utils.math import rounder_for_dt +from smarts.core.utils.core_math import rounder_for_dt from smarts.core.vehicle import VEHICLE_CONFIGS, VehicleState diff --git a/smarts/core/trap_manager.py b/smarts/core/trap_manager.py index 5d24b6c6a8..0a00799ff9 100644 --- a/smarts/core/trap_manager.py +++ b/smarts/core/trap_manager.py @@ -29,10 +29,10 @@ from smarts.core.condition_state import ConditionState from smarts.core.coordinates import Point as MapPoint from smarts.core.plan import Mission, Plan, Start, default_entry_tactic +from smarts.core.utils.core_math import clip, squared_dist from smarts.core.utils.file import replace -from smarts.core.utils.math import clip, squared_dist from smarts.core.vehicle import Vehicle -from smarts.sstudio.types import MapZone, PositionalZone, TrapEntryTactic +from smarts.sstudio.sstypes import MapZone, PositionalZone, TrapEntryTactic @dataclass diff --git a/smarts/core/utils/__init__.py b/smarts/core/utils/__init__.py index d5d822d2c0..087eb556ff 100644 --- a/smarts/core/utils/__init__.py +++ b/smarts/core/utils/__init__.py @@ -17,3 +17,11 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. + +import sys + +from . import core_logging as logging +from . import core_math as math + +sys.modules[f"{__name__}.{math=}".partition("=")[0]] = math +sys.modules[f"{__name__}.{logging=}".partition("=")[0]] = logging diff --git a/smarts/core/utils/adapters/ego_centric_adapters.py b/smarts/core/utils/adapters/ego_centric_adapters.py index 9b732988e0..f10b0bc1d1 100644 --- a/smarts/core/utils/adapters/ego_centric_adapters.py +++ b/smarts/core/utils/adapters/ego_centric_adapters.py @@ -28,12 +28,12 @@ from smarts.core.coordinates import Heading from smarts.core.observations import Observation, ViaPoint from smarts.core.plan import PositionalGoal, Via -from smarts.core.utils.file import replace as _replace -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( position_to_ego_frame, world_position_from_ego_frame, wrap_value, ) +from smarts.core.utils.file import replace as _replace def ego_centric_observation_adapter(obs: Observation, *args: Any, **kwargs: Any) -> Any: diff --git a/smarts/core/utils/logging.py b/smarts/core/utils/core_logging.py similarity index 100% rename from smarts/core/utils/logging.py rename to smarts/core/utils/core_logging.py diff --git a/smarts/core/utils/math.py b/smarts/core/utils/core_math.py similarity index 100% rename from smarts/core/utils/math.py rename to smarts/core/utils/core_math.py diff --git a/smarts/core/utils/dummy.py b/smarts/core/utils/dummy.py index 8b16507d05..071ec13f09 100644 --- a/smarts/core/utils/dummy.py +++ b/smarts/core/utils/dummy.py @@ -25,7 +25,7 @@ import numpy as np -import smarts.sstudio.types as t +import smarts.sstudio.sstypes as t from smarts.core.coordinates import Dimensions, Heading, RefLinePoint from smarts.core.events import Events from smarts.core.observations import ( diff --git a/smarts/core/utils/pybullet.py b/smarts/core/utils/pybullet.py index 51bafbc35c..a903925809 100644 --- a/smarts/core/utils/pybullet.py +++ b/smarts/core/utils/pybullet.py @@ -20,7 +20,7 @@ import functools import inspect -from smarts.core.utils.logging import suppress_output +from smarts.core.utils.core_logging import suppress_output # XXX: Importing pybullet logs an annoying build version tag. There's no "friendly" # way to fix this since they simply use print(...). Disabling logging at the diff --git a/smarts/core/utils/sumo.py b/smarts/core/utils/sumo.py index 1dfee12e10..1abf31ab17 100644 --- a/smarts/core/utils/sumo.py +++ b/smarts/core/utils/sumo.py @@ -31,7 +31,7 @@ from typing import Any, List, Optional from smarts.core.utils import networking -from smarts.core.utils.logging import suppress_output +from smarts.core.utils.core_logging import suppress_output try: import sumo diff --git a/smarts/core/utils/tests/test_math.py b/smarts/core/utils/tests/test_math.py index ce730048b5..e234ed9148 100644 --- a/smarts/core/utils/tests/test_math.py +++ b/smarts/core/utils/tests/test_math.py @@ -21,7 +21,7 @@ # THE SOFTWARE. import numpy as np -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( combination_pairs_with_unique_indices, position_to_ego_frame, world_position_from_ego_frame, diff --git a/smarts/core/vehicle.py b/smarts/core/vehicle.py index 34449ce7c3..9aca717f4b 100644 --- a/smarts/core/vehicle.py +++ b/smarts/core/vehicle.py @@ -50,8 +50,8 @@ ViaSensor, WaypointsSensor, ) +from .utils.core_math import rotate_cw_around_point from .utils.custom_exceptions import RendererException -from .utils.math import rotate_cw_around_point from .vehicle_state import VEHICLE_CONFIGS, VehicleConfig, VehicleState diff --git a/smarts/core/vehicle_state.py b/smarts/core/vehicle_state.py index 12f2154aac..dca4b935bd 100644 --- a/smarts/core/vehicle_state.py +++ b/smarts/core/vehicle_state.py @@ -30,7 +30,7 @@ from .actor import ActorState from .colors import SceneColors from .coordinates import Dimensions, Heading, Pose -from .utils.math import rotate_cw_around_point +from .utils.core_math import rotate_cw_around_point @dataclass(frozen=True) diff --git a/smarts/core/waymo_map.py b/smarts/core/waymo_map.py index 05d7718156..0ef3e34168 100644 --- a/smarts/core/waymo_map.py +++ b/smarts/core/waymo_map.py @@ -38,17 +38,17 @@ from smarts.core.lanepoints import LanePoints, LinkedLanePoint from smarts.core.road_map import RoadMap, RoadMapWithCaches, Waypoint from smarts.core.route_cache import RouteWithCache -from smarts.core.utils.file import read_tfrecord_file -from smarts.core.utils.geometry import buffered_shape -from smarts.core.utils.glb import make_map_glb, make_road_line_glb -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( inplace_unwrap, line_intersect_vectorized, radians_to_vec, ray_boundary_intersect, vec_2d, ) -from smarts.sstudio.types import MapSpec +from smarts.core.utils.file import read_tfrecord_file +from smarts.core.utils.geometry import buffered_shape +from smarts.core.utils.glb import make_map_glb, make_road_line_glb +from smarts.sstudio.sstypes import MapSpec from smarts.waymo.exceptions import WaymoDatasetError from smarts.waymo.waymo_open_dataset.protos import scenario_pb2 from smarts.waymo.waymo_open_dataset.protos.map_pb2 import ( diff --git a/smarts/diagnostic/10_agents_to_n_roads/10_roads/scenario.py b/smarts/diagnostic/10_agents_to_n_roads/10_roads/scenario.py index 1aa9d98b09..57ef30aef4 100644 --- a/smarts/diagnostic/10_agents_to_n_roads/10_roads/scenario.py +++ b/smarts/diagnostic/10_agents_to_n_roads/10_roads/scenario.py @@ -22,7 +22,13 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Route, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import ( + Mission, + RandomRoute, + Route, + Scenario, + SocialAgentActor, +) def gen_actors(id_): diff --git a/smarts/diagnostic/10_agents_to_n_roads/1_roads/scenario.py b/smarts/diagnostic/10_agents_to_n_roads/1_roads/scenario.py index b78be8e4d2..f4650dcb56 100644 --- a/smarts/diagnostic/10_agents_to_n_roads/1_roads/scenario.py +++ b/smarts/diagnostic/10_agents_to_n_roads/1_roads/scenario.py @@ -22,7 +22,13 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Route, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import ( + Mission, + RandomRoute, + Route, + Scenario, + SocialAgentActor, +) def gen_actors(id_): diff --git a/smarts/diagnostic/10_agents_to_n_roads/20_roads/scenario.py b/smarts/diagnostic/10_agents_to_n_roads/20_roads/scenario.py index 1aa9d98b09..57ef30aef4 100644 --- a/smarts/diagnostic/10_agents_to_n_roads/20_roads/scenario.py +++ b/smarts/diagnostic/10_agents_to_n_roads/20_roads/scenario.py @@ -22,7 +22,13 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Route, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import ( + Mission, + RandomRoute, + Route, + Scenario, + SocialAgentActor, +) def gen_actors(id_): diff --git a/smarts/diagnostic/10_agents_to_n_roads/50_roads/scenario.py b/smarts/diagnostic/10_agents_to_n_roads/50_roads/scenario.py index 1aa9d98b09..57ef30aef4 100644 --- a/smarts/diagnostic/10_agents_to_n_roads/50_roads/scenario.py +++ b/smarts/diagnostic/10_agents_to_n_roads/50_roads/scenario.py @@ -22,7 +22,13 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Route, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import ( + Mission, + RandomRoute, + Route, + Scenario, + SocialAgentActor, +) def gen_actors(id_): diff --git a/smarts/diagnostic/10_agents_with_replay/10_replays/scenario.py b/smarts/diagnostic/10_agents_with_replay/10_replays/scenario.py index b8faebf2a3..b4a2267654 100644 --- a/smarts/diagnostic/10_agents_with_replay/10_replays/scenario.py +++ b/smarts/diagnostic/10_agents_with_replay/10_replays/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import Mission, RandomRoute, Scenario, SocialAgentActor def gen_actors(id_): diff --git a/smarts/diagnostic/10_agents_with_replay/1_replay/scenario.py b/smarts/diagnostic/10_agents_with_replay/1_replay/scenario.py index 94bedd66a6..3a42d9b89b 100644 --- a/smarts/diagnostic/10_agents_with_replay/1_replay/scenario.py +++ b/smarts/diagnostic/10_agents_with_replay/1_replay/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import Mission, RandomRoute, Scenario, SocialAgentActor def gen_actors(id_): diff --git a/smarts/diagnostic/10_agents_with_replay/20_replays/scenario.py b/smarts/diagnostic/10_agents_with_replay/20_replays/scenario.py index b8faebf2a3..b4a2267654 100644 --- a/smarts/diagnostic/10_agents_with_replay/20_replays/scenario.py +++ b/smarts/diagnostic/10_agents_with_replay/20_replays/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import Mission, RandomRoute, Scenario, SocialAgentActor def gen_actors(id_): diff --git a/smarts/diagnostic/10_agents_with_replay/50_replays/scenario.py b/smarts/diagnostic/10_agents_with_replay/50_replays/scenario.py index b8faebf2a3..b4a2267654 100644 --- a/smarts/diagnostic/10_agents_with_replay/50_replays/scenario.py +++ b/smarts/diagnostic/10_agents_with_replay/50_replays/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import Mission, RandomRoute, Scenario, SocialAgentActor def gen_actors(id_): diff --git a/smarts/diagnostic/n_agents/10_agents/scenario.py b/smarts/diagnostic/n_agents/10_agents/scenario.py index 2898c251e2..3b3c3bd2bb 100644 --- a/smarts/diagnostic/n_agents/10_agents/scenario.py +++ b/smarts/diagnostic/n_agents/10_agents/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import Mission, RandomRoute, Scenario, SocialAgentActor def gen_actors(id_): diff --git a/smarts/diagnostic/n_agents/1_agents/scenario.py b/smarts/diagnostic/n_agents/1_agents/scenario.py index 905ecf5121..740fbb9562 100644 --- a/smarts/diagnostic/n_agents/1_agents/scenario.py +++ b/smarts/diagnostic/n_agents/1_agents/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import Mission, RandomRoute, Scenario, SocialAgentActor def gen_actors(id_): diff --git a/smarts/diagnostic/n_agents/20_agents/scenario.py b/smarts/diagnostic/n_agents/20_agents/scenario.py index 868373c44e..38faf99eec 100644 --- a/smarts/diagnostic/n_agents/20_agents/scenario.py +++ b/smarts/diagnostic/n_agents/20_agents/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import Mission, RandomRoute, Scenario, SocialAgentActor def gen_actors(id_): diff --git a/smarts/diagnostic/n_agents/50_agents/scenario.py b/smarts/diagnostic/n_agents/50_agents/scenario.py index 68095e6115..dca556b851 100644 --- a/smarts/diagnostic/n_agents/50_agents/scenario.py +++ b/smarts/diagnostic/n_agents/50_agents/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio.types import Mission, RandomRoute, Scenario, SocialAgentActor +from smarts.sstudio.sstypes import Mission, RandomRoute, Scenario, SocialAgentActor def gen_actors(id_): diff --git a/smarts/diagnostic/n_local_actors/10_actors/scenario.py b/smarts/diagnostic/n_local_actors/10_actors/scenario.py index 1113ac241a..d5414c7f67 100644 --- a/smarts/diagnostic/n_local_actors/10_actors/scenario.py +++ b/smarts/diagnostic/n_local_actors/10_actors/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t traffic = t.Traffic( engine="SMARTS", diff --git a/smarts/diagnostic/n_local_actors/1_actors/scenario.py b/smarts/diagnostic/n_local_actors/1_actors/scenario.py index 0e3cf93745..b59c29a0a2 100644 --- a/smarts/diagnostic/n_local_actors/1_actors/scenario.py +++ b/smarts/diagnostic/n_local_actors/1_actors/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t traffic = t.Traffic( engine="SMARTS", diff --git a/smarts/diagnostic/n_local_actors/200_actors/scenario.py b/smarts/diagnostic/n_local_actors/200_actors/scenario.py index 6b550806f9..9eaccbb7bf 100644 --- a/smarts/diagnostic/n_local_actors/200_actors/scenario.py +++ b/smarts/diagnostic/n_local_actors/200_actors/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t traffic = t.Traffic( engine="SMARTS", diff --git a/smarts/diagnostic/n_local_actors/20_actors/scenario.py b/smarts/diagnostic/n_local_actors/20_actors/scenario.py index c528f84d23..a05e32d060 100644 --- a/smarts/diagnostic/n_local_actors/20_actors/scenario.py +++ b/smarts/diagnostic/n_local_actors/20_actors/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t traffic = t.Traffic( flows=[ diff --git a/smarts/diagnostic/n_local_actors/50_actors/scenario.py b/smarts/diagnostic/n_local_actors/50_actors/scenario.py index 781ec5755c..b6a32fe5be 100644 --- a/smarts/diagnostic/n_local_actors/50_actors/scenario.py +++ b/smarts/diagnostic/n_local_actors/50_actors/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t traffic = t.Traffic( engine="SMARTS", diff --git a/smarts/diagnostic/n_sumo_actors/10_actors/scenario.py b/smarts/diagnostic/n_sumo_actors/10_actors/scenario.py index dd6fbe6dcc..6e9e012a73 100644 --- a/smarts/diagnostic/n_sumo_actors/10_actors/scenario.py +++ b/smarts/diagnostic/n_sumo_actors/10_actors/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t traffic = t.Traffic( flows=[ diff --git a/smarts/diagnostic/n_sumo_actors/1_actors/scenario.py b/smarts/diagnostic/n_sumo_actors/1_actors/scenario.py index e8a96840f2..268ef39af7 100644 --- a/smarts/diagnostic/n_sumo_actors/1_actors/scenario.py +++ b/smarts/diagnostic/n_sumo_actors/1_actors/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t traffic = t.Traffic( flows=[ diff --git a/smarts/diagnostic/n_sumo_actors/200_actors/scenario.py b/smarts/diagnostic/n_sumo_actors/200_actors/scenario.py index 95c4b664d3..a8beab0a02 100644 --- a/smarts/diagnostic/n_sumo_actors/200_actors/scenario.py +++ b/smarts/diagnostic/n_sumo_actors/200_actors/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t traffic = t.Traffic( flows=[ diff --git a/smarts/diagnostic/n_sumo_actors/20_actors/scenario.py b/smarts/diagnostic/n_sumo_actors/20_actors/scenario.py index c528f84d23..a05e32d060 100644 --- a/smarts/diagnostic/n_sumo_actors/20_actors/scenario.py +++ b/smarts/diagnostic/n_sumo_actors/20_actors/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t traffic = t.Traffic( flows=[ diff --git a/smarts/diagnostic/n_sumo_actors/50_actors/scenario.py b/smarts/diagnostic/n_sumo_actors/50_actors/scenario.py index caa514debc..1a5ef89ef1 100644 --- a/smarts/diagnostic/n_sumo_actors/50_actors/scenario.py +++ b/smarts/diagnostic/n_sumo_actors/50_actors/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_scenario -from smarts.sstudio import types as t +from smarts.sstudio import sstypes as t traffic = t.Traffic( flows=[ diff --git a/smarts/diagnostic/run.py b/smarts/diagnostic/run.py index cfbe8ee203..0dd7e61259 100644 --- a/smarts/diagnostic/run.py +++ b/smarts/diagnostic/run.py @@ -35,7 +35,7 @@ import smarts from smarts.core.scenario import Scenario -from smarts.core.utils.math import welford +from smarts.core.utils.core_math import welford from smarts.env.gymnasium.hiway_env_v1 import ScenarioOrder from smarts.sstudio.scenario_construction import build_scenarios diff --git a/smarts/env/custom_observations.py b/smarts/env/custom_observations.py index f22b95fe15..409b5c117d 100644 --- a/smarts/env/custom_observations.py +++ b/smarts/env/custom_observations.py @@ -26,7 +26,7 @@ from smarts.core.coordinates import Heading from smarts.core.observations import EgoVehicleObservation, Observation from smarts.core.road_map import Waypoint -from smarts.core.utils.math import squared_dist, vec_2d, vec_to_radians +from smarts.core.utils.core_math import squared_dist, vec_2d, vec_to_radians @dataclass diff --git a/smarts/env/gymnasium/hiway_env_v1.py b/smarts/env/gymnasium/hiway_env_v1.py index 8d557c9da6..0cebed3fc2 100644 --- a/smarts/env/gymnasium/hiway_env_v1.py +++ b/smarts/env/gymnasium/hiway_env_v1.py @@ -32,7 +32,7 @@ from gymnasium.core import ActType, ObsType from gymnasium.envs.registration import EnvSpec -from envision import types as envision_types +from envision import etypes as envision_types from envision.client import Client as Envision from envision.data_formatter import EnvisionDataFormatterArgs from smarts.core import current_seed @@ -329,7 +329,7 @@ def reset( Usually, you want to pass an integer *right after the environment has been initialized and then never again*. options (dict, optional): Additional information to specify how the environment is reset (optional, depending on the specific environment). Forwards to :meth:`~smarts.core.smarts.SMARTS.reset`. - - "scenario" (:class:`~smarts.sstudio.types.scenario.Scenario`): An explicit scenario to reset to. The default is a scenario from the scenario iter. + - "scenario" (:class:`~smarts.sstudio.sstypes.scenario.Scenario`): An explicit scenario to reset to. The default is a scenario from the scenario iter. - "start_time" (float): Forwards the start time of the current scenario. The default is 0. Returns: diff --git a/smarts/env/gymnasium/wrappers/metric/costs.py b/smarts/env/gymnasium/wrappers/metric/costs.py index 975ca76fd6..1048cb75ae 100644 --- a/smarts/env/gymnasium/wrappers/metric/costs.py +++ b/smarts/env/gymnasium/wrappers/metric/costs.py @@ -29,7 +29,7 @@ from smarts.core.observations import Observation from smarts.core.plan import Mission, Plan, PositionalGoal, Start from smarts.core.road_map import RoadMap -from smarts.core.utils.math import running_mean +from smarts.core.utils.core_math import running_mean from smarts.core.vehicle_index import VehicleIndex from smarts.env.gymnasium.wrappers.metric.params import Params from smarts.env.gymnasium.wrappers.metric.types import Costs diff --git a/smarts/env/rllib_hiway_env.py b/smarts/env/rllib_hiway_env.py index 20f886a7be..9b7d1bdcb4 100644 --- a/smarts/env/rllib_hiway_env.py +++ b/smarts/env/rllib_hiway_env.py @@ -25,7 +25,7 @@ from ray.rllib.env.multi_agent_env import MultiAgentEnv import smarts -from envision import types as envision_types +from envision import etypes as envision_types from envision.client import Client as Envision from smarts.core.local_traffic_provider import LocalTrafficProvider from smarts.core.scenario import Scenario diff --git a/smarts/env/tests/test_determinism.py b/smarts/env/tests/test_determinism.py index 9424149bf8..13a85e1e9b 100644 --- a/smarts/env/tests/test_determinism.py +++ b/smarts/env/tests/test_determinism.py @@ -30,8 +30,8 @@ from smarts.core.agent import Agent from smarts.core.agent_interface import AgentInterface from smarts.core.controllers import ActionSpaceType +from smarts.core.utils.core_logging import diff_unpackable from smarts.core.utils.episodes import episodes -from smarts.core.utils.logging import diff_unpackable from smarts.zoo.agent_spec import AgentSpec diff --git a/smarts/env/wrappers/utils/rendering.py b/smarts/env/wrappers/utils/rendering.py index 9926736301..eee7d519d9 100644 --- a/smarts/env/wrappers/utils/rendering.py +++ b/smarts/env/wrappers/utils/rendering.py @@ -28,7 +28,7 @@ import numpy as np from PIL import Image -from smarts.core.utils.logging import isnotebook +from smarts.core.utils.core_logging import isnotebook def flatten_obs(sim_obs): diff --git a/smarts/ray/sensors/ray_sensor_resolver.py b/smarts/ray/sensors/ray_sensor_resolver.py index cc672d4f98..333cc59198 100644 --- a/smarts/ray/sensors/ray_sensor_resolver.py +++ b/smarts/ray/sensors/ray_sensor_resolver.py @@ -32,8 +32,8 @@ from smarts.core.serialization.default import dumps, loads from smarts.core.simulation_frame import SimulationFrame from smarts.core.simulation_local_constants import SimulationLocalConstants +from smarts.core.utils.core_logging import timeit from smarts.core.utils.file import replace -from smarts.core.utils.logging import timeit logger = logging.getLogger(__name__) diff --git a/smarts/ray/sensors/tests/test_ray_sensor_resolver.py b/smarts/ray/sensors/tests/test_ray_sensor_resolver.py index ab9c4b2bad..9068e6d9bf 100644 --- a/smarts/ray/sensors/tests/test_ray_sensor_resolver.py +++ b/smarts/ray/sensors/tests/test_ray_sensor_resolver.py @@ -30,7 +30,7 @@ from smarts.core.simulation_local_constants import SimulationLocalConstants from smarts.core.smarts import SMARTS from smarts.core.sumo_traffic_simulation import SumoTrafficSimulation -from smarts.core.utils.logging import diff_unpackable +from smarts.core.utils.core_logging import diff_unpackable from smarts.ray.sensors.ray_sensor_resolver import RaySensorResolver AGENT_IDS = [f"agent-00{i}" for i in range(3)] diff --git a/smarts/ros/src/smarts_ros/scripts/ros_driver.py b/smarts/ros/src/smarts_ros/scripts/ros_driver.py index 5ab09ef319..062bd31443 100755 --- a/smarts/ros/src/smarts_ros/scripts/ros_driver.py +++ b/smarts/ros/src/smarts_ros/scripts/ros_driver.py @@ -53,10 +53,10 @@ ) from smarts.core.scenario import Scenario from smarts.core.smarts import SMARTS -from smarts.core.utils.math import fast_quaternion_from_angle, vec_to_radians +from smarts.core.utils.core_math import fast_quaternion_from_angle, vec_to_radians from smarts.core.vehicle import VehicleState from smarts.ros.logging import log_everything_to_ROS -from smarts.sstudio.types import MapSpec +from smarts.sstudio.sstypes import MapSpec from smarts.zoo import registry diff --git a/smarts/sstudio/__init__.py b/smarts/sstudio/__init__.py index 4b867d70dd..fd4e7560e4 100644 --- a/smarts/sstudio/__init__.py +++ b/smarts/sstudio/__init__.py @@ -19,6 +19,7 @@ # THE SOFTWARE. import os +import sys from .genscenario import gen_scenario @@ -34,3 +35,7 @@ logging.warning( "PYTHONHASHSEED is 'random'. Simulation and generation may be unpredictable." ) + +from . import sstypes as types + +sys.modules[f"{__name__}.{types=}".partition("=")[0]] = types diff --git a/smarts/sstudio/generators.py b/smarts/sstudio/generators.py index a90f36dfdf..8adbe21269 100644 --- a/smarts/sstudio/generators.py +++ b/smarts/sstudio/generators.py @@ -34,10 +34,10 @@ from yattag import Doc, indent from smarts.core.road_map import RoadMap +from smarts.core.utils.core_math import wrap_value from smarts.core.utils.file import make_dir_in_smarts_log_dir, replace -from smarts.core.utils.math import wrap_value -from . import types +from . import sstypes SECONDS_PER_HOUR_INV = 1 / 60 / 60 @@ -90,7 +90,7 @@ def random_lane_offset(road_id: str, lane_idx: int) -> float: end_lane_index = random_lane_index(end_road_id) end_lane_offset = random_lane_offset(end_road_id, end_lane_index) - return types.Route( + return sstypes.Route( begin=(start_road_id, start_lane_index, start_lane_offset), via=tuple(road.road_id for road in route.roads[1:-1]), end=(end_road_id, end_lane_index, end_lane_offset), @@ -108,7 +108,7 @@ class TrafficGenerator: def __init__( self, scenario_dir: str, - scenario_map_spec: Optional[types.MapSpec], + scenario_map_spec: Optional[sstypes.MapSpec], log_dir: Optional[str] = None, overwrite: bool = False, ): @@ -142,7 +142,7 @@ def __init__( def plan_and_save( self, - traffic: types.Traffic, + traffic: sstypes.Traffic, name: str, output_dir: Optional[str] = None, seed: int = 42, @@ -221,7 +221,7 @@ def plan_and_save( return route_path def _writexml( - self, traffic: types.Traffic, fill_in_route_gaps: bool, route_path: str + self, traffic: sstypes.Traffic, fill_in_route_gaps: bool, route_path: str ): """Writes a traffic spec into a route file. Typically this would be the source data to Sumo's DUAROUTER. @@ -355,7 +355,7 @@ def _cache_road_network(self): if not self._road_network: from smarts.core.sumo_road_network import SumoRoadNetwork - map_spec = types.MapSpec(self._road_network_path) + map_spec = sstypes.MapSpec(self._road_network_path) self._road_network = SumoRoadNetwork.from_spec(map_spec) def resolve_edge_length(self, edge_id, lane_idx): @@ -380,13 +380,13 @@ def _map_for_route(self, route) -> RoadMap: self._scenario_map_spec, lanepoint_spacing=lp_spacing ) else: - map_spec = types.MapSpec( + map_spec = sstypes.MapSpec( self._road_network_path, lanepoint_spacing=lp_spacing ) road_map, _ = map_spec.builder_fn(map_spec) return road_map - def _fill_in_gaps(self, route: types.Route) -> types.Route: + def _fill_in_gaps(self, route: sstypes.Route) -> sstypes.Route: # TODO: do this at runtime so each vehicle on the flow can take a different variation of the route ? # TODO: or do it like SUMO and generate a huge *.rou.xml file instead ? road_map = self._map_for_route(route) @@ -402,16 +402,16 @@ def _fill_in_gaps(self, route: types.Route) -> types.Route: route, via=tuple((road.road_id for road in routes[0].roads[1:-1])) ) - def resolve_route(self, route, fill_in_gaps: bool) -> types.Route: + def resolve_route(self, route, fill_in_gaps: bool) -> sstypes.Route: """Attempts to fill in the route between the beginning and end specified in the initial route. Args: route: An incomplete route. Returns: - smarts.sstudio.types.route.Route: A complete route listing all road segments it passes through. + smarts.sstudio.sstypes.route.Route: A complete route listing all road segments it passes through. """ - if not isinstance(route, types.RandomRoute): + if not isinstance(route, sstypes.RandomRoute): return self._fill_in_gaps(route) if fill_in_gaps else route if not self._random_route_generator: diff --git a/smarts/sstudio/genhistories.py b/smarts/sstudio/genhistories.py index 5def2bb5bc..53974432ee 100644 --- a/smarts/sstudio/genhistories.py +++ b/smarts/sstudio/genhistories.py @@ -34,14 +34,14 @@ from smarts.core.coordinates import BoundingBox, Point from smarts.core.signal_provider import SignalLightState -from smarts.core.utils.file import read_tfrecord_file -from smarts.core.utils.math import ( +from smarts.core.utils.core_math import ( circular_mean, constrain_angle, min_angles_difference_signed, vec_to_radians, ) -from smarts.sstudio import types +from smarts.core.utils.file import read_tfrecord_file +from smarts.sstudio import sstypes from smarts.waymo.exceptions import WaymoDatasetError METERS_PER_FOOT = 0.3048 @@ -1084,7 +1084,7 @@ def column_val_in_row(self, row, col_name: str) -> Any: def import_dataset( - dataset_spec: types.TrafficHistoryDataset, + dataset_spec: sstypes.TrafficHistoryDataset, output_path: str, map_bbox: Optional[BoundingBox] = None, ): diff --git a/smarts/sstudio/genscenario.py b/smarts/sstudio/genscenario.py index ea52cbeafc..523af61f2a 100644 --- a/smarts/sstudio/genscenario.py +++ b/smarts/sstudio/genscenario.py @@ -37,10 +37,10 @@ import smarts.core from smarts.core.default_map_builder import find_mapfile_in_dir +from smarts.core.utils.core_logging import timeit from smarts.core.utils.file import file_md5_hash, path2hash, pickle_hash -from smarts.core.utils.logging import timeit -from . import types +from . import sstypes from .generators import TrafficGenerator logging.basicConfig(level=logging.WARNING) @@ -52,10 +52,10 @@ class ActorAndMission: """Holds an Actor object and its associated Mission.""" - actor: types.Actor + actor: sstypes.Actor """Specification for traffic actor. """ - mission: Union[types.Mission, types.EndlessMission, types.LapMission] + mission: Union[sstypes.Mission, sstypes.EndlessMission, sstypes.LapMission] """Mission for traffic actor. """ @@ -72,7 +72,7 @@ def _check_if_called_externally(): ) -def _build_graph(scenario: types.Scenario, base_dir: str) -> Dict[str, Any]: +def _build_graph(scenario: sstypes.Scenario, base_dir: str) -> Dict[str, Any]: graph = collections.defaultdict(list) graph["map"] = [os.path.join(base_dir, "map", "map.glb")] @@ -102,7 +102,7 @@ def _build_graph(scenario: types.Scenario, base_dir: str) -> Dict[str, Any]: if scenario.traffic_histories: for dataset in scenario.traffic_histories: - assert isinstance(dataset, types.TrafficHistoryDataset) + assert isinstance(dataset, sstypes.TrafficHistoryDataset) artifact_path = os.path.join(base_dir, f"{dataset.name}.shf") graph["traffic_histories"].append(artifact_path) @@ -155,7 +155,7 @@ def _update_artifacts( def gen_scenario( - scenario: types.Scenario, + scenario: sstypes.Scenario, output_dir: Union[str, Path], seed: int = 42, ): @@ -198,7 +198,7 @@ def gen_scenario( if scenario.map_spec is not None: map_spec = scenario.map_spec else: - map_spec = types.MapSpec(source=scenario_dir) + map_spec = sstypes.MapSpec(source=scenario_dir) if map_spec.shift_to_origin and scenario.traffic_histories: logger.warning( @@ -265,7 +265,7 @@ def gen_scenario( with timeit("ego_missions", logger.info): missions = [] for mission in scenario.ego_missions: - if isinstance(mission, types.GroupedLapMission): + if isinstance(mission, sstypes.GroupedLapMission): gen_group_laps( scenario=output_dir, begin=mission.route.begin, @@ -362,7 +362,7 @@ def gen_scenario( ) -def gen_map(scenario: str, map_spec: types.MapSpec, output_dir: Optional[str] = None): +def gen_map(scenario: str, map_spec: sstypes.MapSpec, output_dir: Optional[str] = None): """Saves a map spec to file.""" _check_if_called_externally() build_dir = os.path.join(scenario, "build") @@ -378,11 +378,11 @@ def gen_map(scenario: str, map_spec: types.MapSpec, output_dir: Optional[str] = def gen_traffic( scenario: str, - traffic: types.Traffic, + traffic: sstypes.Traffic, name: str, output_dir: Optional[str] = None, seed: int = 42, - map_spec: Optional[types.MapSpec] = None, + map_spec: Optional[sstypes.MapSpec] = None, ): """Generates the traffic routes for the given scenario. If the output directory is not provided, the scenario directory is used.""" @@ -402,10 +402,12 @@ def gen_traffic( def gen_social_agent_missions( scenario: str, - missions: Sequence[types.Mission], - social_agent_actor: Union[types.SocialAgentActor, Sequence[types.SocialAgentActor]], + missions: Sequence[sstypes.Mission], + social_agent_actor: Union[ + sstypes.SocialAgentActor, Sequence[sstypes.SocialAgentActor] + ], name: str, - map_spec: Optional[types.MapSpec] = None, + map_spec: Optional[sstypes.MapSpec] = None, ): """Generates the social agent missions for the given scenario. @@ -430,7 +432,7 @@ def gen_social_agent_missions( actors = [actors] # This doesn't support BoidAgentActor. Here we make that explicit - if any(isinstance(actor, types.BoidAgentActor) for actor in actors): + if any(isinstance(actor, sstypes.BoidAgentActor) for actor in actors): raise ValueError( "gen_social_agent_missions(...) can't be called with BoidAgentActor, got:" f"{actors}" @@ -457,7 +459,7 @@ def gen_social_agent_missions( def gen_agent_missions( scenario: str, missions: Sequence, - map_spec: Optional[types.MapSpec] = None, + map_spec: Optional[sstypes.MapSpec] = None, ): """Generates a route file to represent missions (a route per mission). Will create the output_dir if it doesn't exist already. The output file will be named `missions`. @@ -476,7 +478,7 @@ def gen_agent_missions( saved = gen_missions( scenario=scenario, missions=missions, - actors=[types.TrafficActor(name="car")], + actors=[sstypes.TrafficActor(name="car")], name="missions", output_dir=output_dir, map_spec=map_spec, @@ -493,9 +495,9 @@ def gen_group_laps( grid_offset: int, used_lanes: int, vehicle_count: int, - entry_tactic: Optional[types.EntryTactic], + entry_tactic: Optional[sstypes.EntryTactic], num_laps: int = 3, - map_spec: Optional[types.MapSpec] = None, + map_spec: Optional[sstypes.MapSpec] = None, ): """Generates missions that start with a grid offset at the start-line and do a number of laps until finishing. @@ -525,8 +527,8 @@ def gen_group_laps( for i in range(vehicle_count): s_lane = (start_lane + i) % used_lanes missions.append( - types.LapMission( - types.Route( + sstypes.LapMission( + sstypes.Route( begin=( start_road_id, s_lane, @@ -550,7 +552,7 @@ def gen_group_laps( logger.debug(f"Generated grouped lap missions for scenario={scenario}") -def gen_bubbles(scenario: str, bubbles: Sequence[types.Bubble]): +def gen_bubbles(scenario: str, bubbles: Sequence[sstypes.Bubble]): """Generates 'bubbles' in the scenario that capture vehicles for actors. Args: scenario: @@ -564,7 +566,9 @@ def gen_bubbles(scenario: str, bubbles: Sequence[types.Bubble]): pickle.dump(bubbles, f) -def gen_friction_map(scenario: str, surface_patches: Sequence[types.RoadSurfacePatch]): +def gen_friction_map( + scenario: str, surface_patches: Sequence[sstypes.RoadSurfacePatch] +): """Generates friction map file according to the surface patches defined in scenario file. """ @@ -576,11 +580,11 @@ def gen_friction_map(scenario: str, surface_patches: Sequence[types.RoadSurfaceP def gen_missions( scenario: str, - missions: Sequence[types.Mission], - actors: Sequence[types.Actor], + missions: Sequence[sstypes.Mission], + actors: Sequence[sstypes.Actor], name: str, output_dir: str, - map_spec: Optional[types.MapSpec] = None, + map_spec: Optional[sstypes.MapSpec] = None, ): """Generates a route file to represent missions (a route per mission). Will create the output_dir if it doesn't exist already. @@ -618,11 +622,11 @@ def resolve_mission(mission): return True -def _resolve_vias(via: Tuple[types.Via], generator): +def _resolve_vias(via: Tuple[sstypes.Via], generator): vias = [*via] for i in range(len(vias)): v = vias[i] - if isinstance(v.road_id, types.JunctionEdgeIDResolver): + if isinstance(v.road_id, sstypes.JunctionEdgeIDResolver): vias[i] = replace(v, road_id=v.road_id.to_edge(generator.road_network)) return tuple(vias) @@ -636,20 +640,20 @@ def _validate_entry_tactic(mission): if not mission.entry_tactic: return - if isinstance(mission.entry_tactic, types.TrapEntryTactic): + if isinstance(mission.entry_tactic, sstypes.TrapEntryTactic): if not mission.entry_tactic.zone and not isinstance( - mission.entry_tactic.zone, types.MapZone + mission.entry_tactic.zone, sstypes.MapZone ): return z_edge, _, _ = mission.entry_tactic.zone.start - if isinstance(mission, types.EndlessMission): + if isinstance(mission, sstypes.EndlessMission): edge, _, _ = mission.start assert ( edge == z_edge ), f"Zone edge `{z_edge}` is not the same edge as `types.EndlessMission` start edge `{edge}`" - elif isinstance(mission, (types.Mission, types.LapMission)): + elif isinstance(mission, (sstypes.Mission, sstypes.LapMission)): edge, _, _ = mission.route.begin assert ( edge == z_edge @@ -658,8 +662,8 @@ def _validate_entry_tactic(mission): def gen_traffic_histories( scenario: str, - histories_datasets: Sequence[Union[types.TrafficHistoryDataset, str]], - map_spec: Optional[types.MapSpec] = None, + histories_datasets: Sequence[Union[sstypes.TrafficHistoryDataset, str]], + map_spec: Optional[sstypes.MapSpec] = None, ): """Converts traffic history to a format that SMARTS can use. Args: @@ -673,7 +677,7 @@ def gen_traffic_histories( _check_if_called_externally() road_map = None # shared across all history_datasets in scenario for hdsr in histories_datasets: - assert isinstance(hdsr, types.TrafficHistoryDataset) + assert isinstance(hdsr, sstypes.TrafficHistoryDataset) if not hdsr.input_path: print(f"skipping placeholder dataset spec '{hdsr.name}'.") continue @@ -695,12 +699,12 @@ def gen_traffic_histories( genhistories.import_dataset(hdsr, output_dir, map_bbox) -def gen_metadata(scenario: str, scenario_metadata: types.StandardMetadata): +def gen_metadata(scenario: str, scenario_metadata: sstypes.StandardMetadata): """Generate the metadata for the scenario Args: scenario (str):The scenario directory - scenario_metadata (smarts.sstudio.types.standard_metadata.StandardMetadata): Scenario metadata information. + scenario_metadata (smarts.sstudio.sstypes.standard_metadata.StandardMetadata): Scenario metadata information. """ _check_if_called_externally() output_path = os.path.join(scenario, "build", "scenario_metadata.yaml") diff --git a/smarts/sstudio/od2mesh.py b/smarts/sstudio/od2mesh.py index 0de54e9ba5..85cf0453d1 100644 --- a/smarts/sstudio/od2mesh.py +++ b/smarts/sstudio/od2mesh.py @@ -20,7 +20,7 @@ import argparse from smarts.core.opendrive_road_network import OpenDriveRoadNetwork -from smarts.sstudio.types import MapSpec +from smarts.sstudio.sstypes import MapSpec def generate_glb_from_opendrive_file(od_xodr_file: str, out_glb_dir: str): diff --git a/smarts/sstudio/scenario_construction.py b/smarts/sstudio/scenario_construction.py index e5aef61cd8..e6586a506f 100644 --- a/smarts/sstudio/scenario_construction.py +++ b/smarts/sstudio/scenario_construction.py @@ -124,7 +124,7 @@ def _is_scenario_folder_to_build(path: str) -> bool: return False if os.path.exists(os.path.join(path, "scenario.py")): return True - from smarts.sstudio.types import MapSpec + from smarts.sstudio.sstypes import MapSpec map_spec = MapSpec(path) road_map, _ = map_spec.builder_fn(map_spec) diff --git a/smarts/sstudio/types/__init__.py b/smarts/sstudio/sstypes/__init__.py similarity index 57% rename from smarts/sstudio/types/__init__.py rename to smarts/sstudio/sstypes/__init__.py index c706e64cf7..6cb2efceb8 100644 --- a/smarts/sstudio/types/__init__.py +++ b/smarts/sstudio/sstypes/__init__.py @@ -17,20 +17,20 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from smarts.sstudio.types.actor.social_agent_actor import * -from smarts.sstudio.types.actor.traffic_actor import * -from smarts.sstudio.types.actor.traffic_engine_actor import * -from smarts.sstudio.types.bubble import * -from smarts.sstudio.types.bubble_limits import * -from smarts.sstudio.types.condition import * -from smarts.sstudio.types.constants import * -from smarts.sstudio.types.dataset import * -from smarts.sstudio.types.distribution import * -from smarts.sstudio.types.entry_tactic import * -from smarts.sstudio.types.map_spec import * -from smarts.sstudio.types.mission import * -from smarts.sstudio.types.route import * -from smarts.sstudio.types.scenario import * -from smarts.sstudio.types.traffic import * -from smarts.sstudio.types.traffic_model import * -from smarts.sstudio.types.zone import * +from smarts.sstudio.sstypes.actor.social_agent_actor import * +from smarts.sstudio.sstypes.actor.traffic_actor import * +from smarts.sstudio.sstypes.actor.traffic_engine_actor import * +from smarts.sstudio.sstypes.bubble import * +from smarts.sstudio.sstypes.bubble_limits import * +from smarts.sstudio.sstypes.condition import * +from smarts.sstudio.sstypes.constants import * +from smarts.sstudio.sstypes.dataset import * +from smarts.sstudio.sstypes.distribution import * +from smarts.sstudio.sstypes.entry_tactic import * +from smarts.sstudio.sstypes.map_spec import * +from smarts.sstudio.sstypes.mission import * +from smarts.sstudio.sstypes.route import * +from smarts.sstudio.sstypes.scenario import * +from smarts.sstudio.sstypes.traffic import * +from smarts.sstudio.sstypes.traffic_model import * +from smarts.sstudio.sstypes.zone import * diff --git a/smarts/sstudio/types/actor/__init__.py b/smarts/sstudio/sstypes/actor/__init__.py similarity index 100% rename from smarts/sstudio/types/actor/__init__.py rename to smarts/sstudio/sstypes/actor/__init__.py diff --git a/smarts/sstudio/types/actor/social_agent_actor.py b/smarts/sstudio/sstypes/actor/social_agent_actor.py similarity index 96% rename from smarts/sstudio/types/actor/social_agent_actor.py rename to smarts/sstudio/sstypes/actor/social_agent_actor.py index 3c176c0145..21507d0c77 100644 --- a/smarts/sstudio/types/actor/social_agent_actor.py +++ b/smarts/sstudio/sstypes/actor/social_agent_actor.py @@ -25,8 +25,8 @@ from typing import Any, Dict, Optional from smarts.core import gen_id -from smarts.sstudio.types.actor import Actor -from smarts.sstudio.types.bubble_limits import BubbleLimits +from smarts.sstudio.sstypes.actor import Actor +from smarts.sstudio.sstypes.bubble_limits import BubbleLimits @dataclass(frozen=True) diff --git a/smarts/sstudio/types/actor/traffic_actor.py b/smarts/sstudio/sstypes/actor/traffic_actor.py similarity index 94% rename from smarts/sstudio/types/actor/traffic_actor.py rename to smarts/sstudio/sstypes/actor/traffic_actor.py index a65daecdd5..3033f5510f 100644 --- a/smarts/sstudio/types/actor/traffic_actor.py +++ b/smarts/sstudio/sstypes/actor/traffic_actor.py @@ -25,9 +25,9 @@ from typing import Union from smarts.core.utils.file import pickle_hash_int -from smarts.sstudio.types.actor import Actor -from smarts.sstudio.types.distribution import Distribution -from smarts.sstudio.types.traffic_model import JunctionModel, LaneChangingModel +from smarts.sstudio.sstypes.actor import Actor +from smarts.sstudio.sstypes.distribution import Distribution +from smarts.sstudio.sstypes.traffic_model import JunctionModel, LaneChangingModel @dataclass(frozen=True) diff --git a/smarts/sstudio/types/actor/traffic_engine_actor.py b/smarts/sstudio/sstypes/actor/traffic_engine_actor.py similarity index 95% rename from smarts/sstudio/types/actor/traffic_engine_actor.py rename to smarts/sstudio/sstypes/actor/traffic_engine_actor.py index 4df472e19c..4ba4bcaf6c 100644 --- a/smarts/sstudio/types/actor/traffic_engine_actor.py +++ b/smarts/sstudio/sstypes/actor/traffic_engine_actor.py @@ -21,7 +21,7 @@ # THE SOFTWARE. from dataclasses import dataclass -from smarts.sstudio.types.actor.traffic_actor import TrafficActor +from smarts.sstudio.sstypes.actor.traffic_actor import TrafficActor @dataclass(frozen=True) diff --git a/smarts/sstudio/types/bubble.py b/smarts/sstudio/sstypes/bubble.py similarity index 95% rename from smarts/sstudio/types/bubble.py rename to smarts/sstudio/sstypes/bubble.py index 82e73f7288..4ba6e58800 100644 --- a/smarts/sstudio/types/bubble.py +++ b/smarts/sstudio/sstypes/bubble.py @@ -27,18 +27,18 @@ from smarts.core import gen_id from smarts.core.condition_state import ConditionState from smarts.core.utils.id import SocialAgentId -from smarts.sstudio.types.actor.social_agent_actor import ( +from smarts.sstudio.sstypes.actor.social_agent_actor import ( BoidAgentActor, SocialAgentActor, ) -from smarts.sstudio.types.actor.traffic_engine_actor import TrafficEngineActor -from smarts.sstudio.types.bubble_limits import BubbleLimits -from smarts.sstudio.types.condition import ( +from smarts.sstudio.sstypes.actor.traffic_engine_actor import TrafficEngineActor +from smarts.sstudio.sstypes.bubble_limits import BubbleLimits +from smarts.sstudio.sstypes.condition import ( Condition, ConditionRequires, LiteralCondition, ) -from smarts.sstudio.types.zone import MapZone, Zone +from smarts.sstudio.sstypes.zone import MapZone, Zone @dataclass(frozen=True) diff --git a/smarts/sstudio/types/bubble_limits.py b/smarts/sstudio/sstypes/bubble_limits.py similarity index 97% rename from smarts/sstudio/types/bubble_limits.py rename to smarts/sstudio/sstypes/bubble_limits.py index a4255bff2a..066d26d108 100644 --- a/smarts/sstudio/types/bubble_limits.py +++ b/smarts/sstudio/sstypes/bubble_limits.py @@ -23,7 +23,7 @@ from dataclasses import dataclass -from smarts.sstudio.types.constants import MAX +from smarts.sstudio.sstypes.constants import MAX @dataclass(frozen=True) diff --git a/smarts/sstudio/types/condition.py b/smarts/sstudio/sstypes/condition.py similarity index 100% rename from smarts/sstudio/types/condition.py rename to smarts/sstudio/sstypes/condition.py diff --git a/smarts/sstudio/types/constants.py b/smarts/sstudio/sstypes/constants.py similarity index 100% rename from smarts/sstudio/types/constants.py rename to smarts/sstudio/sstypes/constants.py diff --git a/smarts/sstudio/types/dataset.py b/smarts/sstudio/sstypes/dataset.py similarity index 100% rename from smarts/sstudio/types/dataset.py rename to smarts/sstudio/sstypes/dataset.py diff --git a/smarts/sstudio/types/distribution.py b/smarts/sstudio/sstypes/distribution.py similarity index 100% rename from smarts/sstudio/types/distribution.py rename to smarts/sstudio/sstypes/distribution.py diff --git a/smarts/sstudio/types/entry_tactic.py b/smarts/sstudio/sstypes/entry_tactic.py similarity index 97% rename from smarts/sstudio/types/entry_tactic.py rename to smarts/sstudio/sstypes/entry_tactic.py index 33e19b449f..a560849f72 100644 --- a/smarts/sstudio/types/entry_tactic.py +++ b/smarts/sstudio/sstypes/entry_tactic.py @@ -25,12 +25,12 @@ from typing import Optional, Tuple from smarts.core.condition_state import ConditionState -from smarts.sstudio.types.condition import ( +from smarts.sstudio.sstypes.condition import ( Condition, ConditionRequires, LiteralCondition, ) -from smarts.sstudio.types.zone import MapZone +from smarts.sstudio.sstypes.zone import MapZone @dataclass(frozen=True) diff --git a/smarts/sstudio/types/map_spec.py b/smarts/sstudio/sstypes/map_spec.py similarity index 100% rename from smarts/sstudio/types/map_spec.py rename to smarts/sstudio/sstypes/map_spec.py diff --git a/smarts/sstudio/types/mission.py b/smarts/sstudio/sstypes/mission.py similarity index 96% rename from smarts/sstudio/types/mission.py rename to smarts/sstudio/sstypes/mission.py index d65450b643..937e9a70ea 100644 --- a/smarts/sstudio/types/mission.py +++ b/smarts/sstudio/sstypes/mission.py @@ -24,9 +24,9 @@ from dataclasses import dataclass from typing import Optional, Tuple, Union -from smarts.sstudio.types.constants import MISSING -from smarts.sstudio.types.entry_tactic import EntryTactic -from smarts.sstudio.types.route import JunctionEdgeIDResolver, RandomRoute, Route +from smarts.sstudio.sstypes.constants import MISSING +from smarts.sstudio.sstypes.entry_tactic import EntryTactic +from smarts.sstudio.sstypes.route import JunctionEdgeIDResolver, RandomRoute, Route @dataclass(frozen=True) diff --git a/smarts/sstudio/types/route.py b/smarts/sstudio/sstypes/route.py similarity index 98% rename from smarts/sstudio/types/route.py rename to smarts/sstudio/sstypes/route.py index 300f565401..7d32f32841 100644 --- a/smarts/sstudio/types/route.py +++ b/smarts/sstudio/sstypes/route.py @@ -26,7 +26,7 @@ from smarts.core import gen_id from smarts.core.utils.file import pickle_hash_int -from smarts.sstudio.types.map_spec import MapSpec +from smarts.sstudio.sstypes.map_spec import MapSpec @dataclass(frozen=True) diff --git a/smarts/sstudio/types/scenario.py b/smarts/sstudio/sstypes/scenario.py similarity index 92% rename from smarts/sstudio/types/scenario.py rename to smarts/sstudio/sstypes/scenario.py index eb0b0d5557..5b69934e3a 100644 --- a/smarts/sstudio/types/scenario.py +++ b/smarts/sstudio/sstypes/scenario.py @@ -27,14 +27,14 @@ from typing import Any, Dict, Optional, Sequence, Tuple, Union from smarts.core.colors import Colors -from smarts.sstudio.types.actor.social_agent_actor import SocialAgentActor -from smarts.sstudio.types.bubble import Bubble -from smarts.sstudio.types.dataset import TrafficHistoryDataset -from smarts.sstudio.types.map_spec import MapSpec -from smarts.sstudio.types.mission import EndlessMission, Mission -from smarts.sstudio.types.standard_metadata import StandardMetadata -from smarts.sstudio.types.traffic import Traffic -from smarts.sstudio.types.zone import RoadSurfacePatch +from smarts.sstudio.sstypes.actor.social_agent_actor import SocialAgentActor +from smarts.sstudio.sstypes.bubble import Bubble +from smarts.sstudio.sstypes.dataset import TrafficHistoryDataset +from smarts.sstudio.sstypes.map_spec import MapSpec +from smarts.sstudio.sstypes.mission import EndlessMission, Mission +from smarts.sstudio.sstypes.standard_metadata import StandardMetadata +from smarts.sstudio.sstypes.traffic import Traffic +from smarts.sstudio.sstypes.zone import RoadSurfacePatch class ScenarioMetadataFields(IntEnum): diff --git a/smarts/sstudio/types/standard_metadata.py b/smarts/sstudio/sstypes/standard_metadata.py similarity index 100% rename from smarts/sstudio/types/standard_metadata.py rename to smarts/sstudio/sstypes/standard_metadata.py diff --git a/smarts/sstudio/types/traffic.py b/smarts/sstudio/sstypes/traffic.py similarity index 97% rename from smarts/sstudio/types/traffic.py rename to smarts/sstudio/sstypes/traffic.py index ae28ae7307..782c99c585 100644 --- a/smarts/sstudio/types/traffic.py +++ b/smarts/sstudio/sstypes/traffic.py @@ -24,8 +24,8 @@ from typing import Dict, Optional, Sequence, Union from smarts.core.utils.file import pickle_hash_int -from smarts.sstudio.types.actor.traffic_actor import TrafficActor -from smarts.sstudio.types.route import RandomRoute, Route +from smarts.sstudio.sstypes.actor.traffic_actor import TrafficActor +from smarts.sstudio.sstypes.route import RandomRoute, Route @dataclass(frozen=True) diff --git a/smarts/sstudio/types/traffic_model.py b/smarts/sstudio/sstypes/traffic_model.py similarity index 100% rename from smarts/sstudio/types/traffic_model.py rename to smarts/sstudio/sstypes/traffic_model.py diff --git a/smarts/sstudio/types/zone.py b/smarts/sstudio/sstypes/zone.py similarity index 99% rename from smarts/sstudio/types/zone.py rename to smarts/sstudio/sstypes/zone.py index 58bf164cf3..86fd43c12e 100644 --- a/smarts/sstudio/types/zone.py +++ b/smarts/sstudio/sstypes/zone.py @@ -39,7 +39,7 @@ from smarts.core.coordinates import RefLinePoint from smarts.core.road_map import RoadMap -from smarts.core.utils.math import rotate_cw_around_point +from smarts.core.utils.core_math import rotate_cw_around_point @dataclass(frozen=True) diff --git a/smarts/sstudio/sumo2mesh.py b/smarts/sstudio/sumo2mesh.py index 3e92d2ace9..a0c59d02ef 100644 --- a/smarts/sstudio/sumo2mesh.py +++ b/smarts/sstudio/sumo2mesh.py @@ -20,7 +20,7 @@ import argparse from smarts.core.sumo_road_network import SumoRoadNetwork -from smarts.sstudio.types import MapSpec +from smarts.sstudio.sstypes import MapSpec def generate_glb_from_sumo_file(sumo_net_file: str, out_glb_dir: str): diff --git a/smarts/sstudio/tests/baseline.rou.xml b/smarts/sstudio/tests/baseline.rou.xml index 5baa590cc5..316ba21c09 100644 --- a/smarts/sstudio/tests/baseline.rou.xml +++ b/smarts/sstudio/tests/baseline.rou.xml @@ -1,15 +1,15 @@ - - - + + - - + + - + - + diff --git a/smarts/sstudio/tests/test_conditions.py b/smarts/sstudio/tests/test_conditions.py index 0d6fe118b0..c19a7df9d4 100644 --- a/smarts/sstudio/tests/test_conditions.py +++ b/smarts/sstudio/tests/test_conditions.py @@ -23,7 +23,7 @@ import pytest -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( CompoundCondition, Condition, ConditionOperator, diff --git a/smarts/sstudio/tests/test_generate.py b/smarts/sstudio/tests/test_generate.py index c49990d7dc..07b1b4b217 100644 --- a/smarts/sstudio/tests/test_generate.py +++ b/smarts/sstudio/tests/test_generate.py @@ -28,7 +28,7 @@ from smarts.core.scenario import Scenario from smarts.sstudio.genscenario import gen_map, gen_traffic -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, JunctionModel, @@ -95,10 +95,10 @@ def test_generate_traffic(traffic: Traffic): def _compare_files(file1, file2): - with open(file1) as f: + with open(file1, encoding="UTF-8") as f: items = [x.items() for x in ElementTree(file=f).iter()] - with open(file2) as f: + with open(file2, encoding="UTF-8") as f: generated_items = [x.items() for x in ElementTree(file=f).iter()] sorted_items = sorted(items) diff --git a/zoo/evaluation/run_evaluation.py b/zoo/evaluation/run_evaluation.py index 8be3e97f68..2361108b00 100644 --- a/zoo/evaluation/run_evaluation.py +++ b/zoo/evaluation/run_evaluation.py @@ -12,7 +12,7 @@ import yaml from rich.console import Console -from smarts.sstudio.types import SocialAgentActor +from smarts.sstudio.sstypes import SocialAgentActor console = Console() @@ -47,7 +47,7 @@ def python(command): stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) - except Exception as e: + except subprocess.CalledProcessError as e: console.print(e.output.decode("utf-8")) exit(e.returncode) @@ -110,7 +110,7 @@ def build_scenario(agent_name, actor, scenario_path): except OSError as e: console.print(e) exit(1) - except Exception as e: + except subprocess.CalledProcessError as e: console.print(e.output.decode("utf-8")) exit(e.returncode) diff --git a/zoo/evaluation/scenarios/straight_turn-left_1/scenario.py b/zoo/evaluation/scenarios/straight_turn-left_1/scenario.py index 62f372188f..62b2098902 100755 --- a/zoo/evaluation/scenarios/straight_turn-left_1/scenario.py +++ b/zoo/evaluation/scenarios/straight_turn-left_1/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_missions -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Route, Mission, ) diff --git a/zoo/evaluation/scenarios/straight_turn-left_2/scenario.py b/zoo/evaluation/scenarios/straight_turn-left_2/scenario.py index 62f372188f..62b2098902 100755 --- a/zoo/evaluation/scenarios/straight_turn-left_2/scenario.py +++ b/zoo/evaluation/scenarios/straight_turn-left_2/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_missions -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Route, Mission, ) diff --git a/zoo/evaluation/scenarios/turn-left_turn-left_1/scenario.py b/zoo/evaluation/scenarios/turn-left_turn-left_1/scenario.py index 4dc4ebdd72..e8651cd7de 100755 --- a/zoo/evaluation/scenarios/turn-left_turn-left_1/scenario.py +++ b/zoo/evaluation/scenarios/turn-left_turn-left_1/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_missions -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Route, Mission, ) diff --git a/zoo/evaluation/scenarios/turn-left_turn-left_2/scenario.py b/zoo/evaluation/scenarios/turn-left_turn-left_2/scenario.py index 4dc4ebdd72..e8651cd7de 100755 --- a/zoo/evaluation/scenarios/turn-left_turn-left_2/scenario.py +++ b/zoo/evaluation/scenarios/turn-left_turn-left_2/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_missions -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Route, Mission, ) diff --git a/zoo/evaluation/scenarios/turn-right_turn-left_1/scenario.py b/zoo/evaluation/scenarios/turn-right_turn-left_1/scenario.py index a49fbbb689..f7ca10d2a3 100755 --- a/zoo/evaluation/scenarios/turn-right_turn-left_1/scenario.py +++ b/zoo/evaluation/scenarios/turn-right_turn-left_1/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_missions -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Route, Mission, ) diff --git a/zoo/evaluation/scenarios/turn-right_turn-left_2/scenario.py b/zoo/evaluation/scenarios/turn-right_turn-left_2/scenario.py index a49fbbb689..f7ca10d2a3 100755 --- a/zoo/evaluation/scenarios/turn-right_turn-left_2/scenario.py +++ b/zoo/evaluation/scenarios/turn-right_turn-left_2/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio import gen_missions -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Route, Mission, ) diff --git a/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_left_turn/scenario.py b/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_left_turn/scenario.py index 2ba387e17e..52dc9381e0 100644 --- a/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_left_turn/scenario.py +++ b/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_left_turn/scenario.py @@ -21,7 +21,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, LaneChangingModel, diff --git a/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_right_turn/scenario.py b/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_right_turn/scenario.py index c2401b2cf7..c0c667204a 100644 --- a/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_right_turn/scenario.py +++ b/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_right_turn/scenario.py @@ -22,7 +22,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, LaneChangingModel, diff --git a/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_straight/scenario.py b/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_straight/scenario.py index 1fa8f64509..955fa3ef2d 100644 --- a/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_straight/scenario.py +++ b/zoo/policies/cross-rl-agent/cross_rl_agent/train/scenarios/4lane_straight/scenario.py @@ -22,7 +22,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, JunctionModel, diff --git a/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_left_turn/scenario.py b/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_left_turn/scenario.py index efea52d912..96f18ab370 100644 --- a/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_left_turn/scenario.py +++ b/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_left_turn/scenario.py @@ -22,7 +22,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, LaneChangingModel, diff --git a/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_right_turn/scenario.py b/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_right_turn/scenario.py index c2401b2cf7..c0c667204a 100644 --- a/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_right_turn/scenario.py +++ b/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_right_turn/scenario.py @@ -22,7 +22,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, LaneChangingModel, diff --git a/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_straight/scenario.py b/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_straight/scenario.py index 1fa8f64509..955fa3ef2d 100644 --- a/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_straight/scenario.py +++ b/zoo/policies/cross-rl-agent/cross_rl_agent/train/trained_model_and_scenarios/good_scenarios/scenarios/4lane_straight/scenario.py @@ -22,7 +22,7 @@ from pathlib import Path from smarts.sstudio.genscenario import gen_scenario -from smarts.sstudio.types import ( +from smarts.sstudio.sstypes import ( Distribution, Flow, JunctionModel,