From b8289c72fa42038e2094ad18b6aa53f7ccb9aea6 Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Fri, 19 May 2023 20:34:04 +0000 Subject: [PATCH 1/9] Add sphinx spelling check. --- docs/conf.py | 7 ++++ docs/spelling_wordlist.txt | 77 ++++++++++++++++++++++++++++++++++++++ setup.cfg | 1 + 3 files changed, 85 insertions(+) create mode 100644 docs/spelling_wordlist.txt diff --git a/docs/conf.py b/docs/conf.py index 9aa26cc457..6a229ecc59 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -43,6 +43,7 @@ "sphinx_rtd_theme", # Read The Docs theme "sphinx_click", # extract documentation from a `click` application "sphinxcontrib.apidoc", + "sphinxcontrib.spelling", ] extlinks = { @@ -106,6 +107,12 @@ # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] +# -- Options for spelling ---------------------------------------------------- +spelling_exclude_patterns = ["ignored_*", "**/*_pb2*"] +spelling_ignore_pypi_package_names = True +spelling_show_suggestions = True +spelling_suggestion_limit = 2 +spelling_word_list_filename = ["spelling_wordlist.txt"] # -- Options for HTML output ------------------------------------------------- diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt new file mode 100644 index 0000000000..8bca9c9799 --- /dev/null +++ b/docs/spelling_wordlist.txt @@ -0,0 +1,77 @@ +π +Δx +Δy +Δheading +ΔTime +accelerometer +Ackermann +acyclic +acyclical +Argoverse +args +bezier +boid +boids +centric +coord +coords +dataset +datasets +deserialize +deserializes +deserialized +deserializable +deterministically +dir +disjunction +drivable +dt +dtype +egoless +Env +fallbacks +frenet +indexable +infos +instantiating +instantiation +instantiations +iterable +lanepoint +laner +lidar +lookahead +natively +np +numpy +ndarray +param +pre +quaternion +quaternions +quickstart +rebase +renderer +renderers +repurposes +rtype +scalable +scalability +serialize +serializes +serialized +serializable +str +timestep +Todo +travelled +unassociated +unformatted +unmanaged +untriggered +Vandenberghe +vectorized +waypoint +waypoints +Waymo +Welford \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index dd319fc498..e013c79fc7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -77,6 +77,7 @@ doc = myst-parser>=0.18.1 sphinx>=5.3.0 sphinxcontrib-apidoc>=0.3.0 + sphinxcontrib-spelling>=8.0.0 sphinx-click>=4.4.0 sphinx-rtd-theme>=1.1.1 envision = From 8d59e000735f478a4a53e59da2dd457fc915b0c0 Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Fri, 19 May 2023 20:34:28 +0000 Subject: [PATCH 2/9] Fix spelling. --- cli/benchmark.py | 2 +- cli/zoo.py | 2 +- docs/benchmarks/agent_zoo.rst | 6 +- docs/benchmarks/benchmark.rst | 4 +- docs/benchmarks/driving_smarts_2022.rst | 6 +- docs/benchmarks/driving_smarts_2023_1.rst | 16 ++-- docs/benchmarks/driving_smarts_2023_3.rst | 14 ++-- docs/ecosystem/ngsim.rst | 4 +- docs/ecosystem/rllib.rst | 17 ++-- docs/resources/containers.rst | 4 +- docs/resources/contributing.rst | 6 +- docs/setup.rst | 4 +- docs/sim/agent.rst | 4 +- docs/sim/bubbles.rst | 4 +- docs/sim/cli.rst | 4 + docs/sim/configuration.rst | 2 +- docs/sim/env.rst | 14 ++-- docs/sim/obs_action_reward.rst | 6 +- docs/sim/scenario_studio.rst | 10 +-- docs/sim/simulator.rst | 2 +- docs/sim/visualization.rst | 10 +-- envision/client.py | 4 +- envision/data_formatter.py | 7 +- envision/server.py | 20 ++--- envision/types.py | 2 +- .../dynamic_history_vehicles_replacement.py | 2 +- .../inference/contrib_policy/frame_stack.py | 2 +- .../inference/contrib_policy/frame_stack.py | 2 +- examples/rl/racing/README.md | 4 +- .../pybullet_sumo_orientation_example.py | 8 +- scenarios/sumo/minicity/scenario.py | 4 +- smarts/benchmark/__init__.py | 2 +- smarts/benchmark/driving_smarts/__init__.py | 2 +- .../entrypoints/benchmark_runner_v0.py | 6 +- smarts/core/__init__.py | 12 +-- smarts/core/agent.py | 2 +- smarts/core/agent_interface.py | 18 ++--- smarts/core/agent_manager.py | 8 +- smarts/core/argoverse_map.py | 24 +++--- smarts/core/bubble_manager.py | 30 +++---- smarts/core/chassis.py | 2 +- smarts/core/controllers/action_space_type.py | 6 +- .../trajectory_interpolation_controller.py | 2 +- smarts/core/coordinates.py | 28 ++++--- smarts/core/lanepoints.py | 78 +++++++++---------- smarts/core/local_traffic_provider.py | 12 +-- smarts/core/observations.py | 22 +++--- smarts/core/opendrive_road_network.py | 2 +- smarts/core/plan.py | 2 +- smarts/core/provider.py | 10 +-- smarts/core/remote_agent_buffer.py | 18 +++-- smarts/core/renderer_base.py | 2 +- smarts/core/road_map.py | 24 +++--- smarts/core/route_cache.py | 8 +- smarts/core/scenario.py | 28 +++---- smarts/core/sensor.py | 2 +- smarts/core/sensor_manager.py | 6 +- .../core/sensors/parallel_sensor_resolver.py | 6 +- smarts/core/signals.py | 2 +- smarts/core/smarts.py | 10 +-- smarts/core/sumo_road_network.py | 4 +- smarts/core/sumo_traffic_simulation.py | 6 +- smarts/core/tests/test_bubble_manager.py | 2 +- smarts/core/tests/test_coordinates.py | 2 +- smarts/core/tire_models.py | 2 +- smarts/core/traffic_history.py | 2 +- smarts/core/utils/bullet.py | 2 +- smarts/core/utils/custom_exceptions.py | 2 +- smarts/core/utils/episodes.py | 4 +- smarts/core/utils/file.py | 2 +- smarts/core/utils/frame_monitor.py | 4 +- smarts/core/utils/kinematics.py | 4 +- smarts/core/utils/logging.py | 18 +++-- smarts/core/utils/math.py | 27 ++++--- smarts/core/vehicle.py | 2 +- smarts/core/vehicle_index.py | 10 ++- smarts/core/vehicle_state.py | 2 +- smarts/core/waymo_map.py | 2 +- smarts/env/custom_observations.py | 2 +- .../env/gymnasium/driving_smarts_2022_env.py | 2 +- smarts/env/gymnasium/hiway_env_v1.py | 36 ++++----- .../env/gymnasium/wrappers/metric/metrics.py | 10 +-- .../env/gymnasium/wrappers/metric/params.py | 24 +++--- smarts/env/gymnasium/wrappers/metric/utils.py | 14 ++-- smarts/env/hiway_env.py | 4 +- smarts/env/rllib_hiway_env.py | 4 +- smarts/env/utils/action_conversion.py | 2 +- smarts/env/utils/observation_conversion.py | 8 +- smarts/env/wrappers/frame_stack.py | 8 +- smarts/env/wrappers/gif_recorder.py | 4 +- smarts/env/wrappers/record_video.py | 8 +- smarts/env/wrappers/rgb_image.py | 8 +- smarts/p3d/renderer.py | 2 +- smarts/sstudio/generators.py | 16 +++- smarts/sstudio/genscenario.py | 4 +- smarts/sstudio/tests/test_conditions.py | 8 +- .../sstudio/types/actor/social_agent_actor.py | 2 +- smarts/sstudio/types/bubble.py | 10 +-- smarts/sstudio/types/condition.py | 28 ++++--- smarts/sstudio/types/mission.py | 2 +- smarts/sstudio/types/route.py | 6 +- smarts/sstudio/types/scenario.py | 2 +- smarts/sstudio/types/traffic_model.py | 6 +- smarts/sstudio/types/zone.py | 2 +- smarts/waymo/waymo_utils.py | 2 +- smarts/zoo/manager_servicer.py | 2 +- smarts/zoo/worker.py | 8 +- smarts/zoo/worker_servicer.py | 3 +- zoo/evaluation/metrics/diversity/utils.py | 2 +- zoo/policies/replay_agent.py | 2 +- zoo/policies/rl-agent/rl_agent/lane_space.py | 10 +-- 111 files changed, 485 insertions(+), 433 deletions(-) diff --git a/cli/benchmark.py b/cli/benchmark.py index d444de6c38..d1019320dc 100644 --- a/cli/benchmark.py +++ b/cli/benchmark.py @@ -41,7 +41,7 @@ def benchmark_cli(): "--debug-log", is_flag=True, default=False, - help="Log the benchmark in stdout.", + help="Log the benchmark in ``stdout``.", ) @click.option( "--benchmark-listing", diff --git a/cli/zoo.py b/cli/zoo.py index e01f2dfd5a..1abfd1f28e 100644 --- a/cli/zoo.py +++ b/cli/zoo.py @@ -77,7 +77,7 @@ def manager(port): @zoo_cli.command( name="install", - help="Attempt to install the specified agents from the given paths/url", + help="Attempt to install the specified agents from the given URI path.", ) @click.argument( "agent_paths", diff --git a/docs/benchmarks/agent_zoo.rst b/docs/benchmarks/agent_zoo.rst index 76a5e80048..e8246506aa 100644 --- a/docs/benchmarks/agent_zoo.rst +++ b/docs/benchmarks/agent_zoo.rst @@ -3,7 +3,7 @@ Agent Zoo ========= -Numerous prebuilt and trained agents are hosted at `zoo/policies `_ . +Numerous pre-built and trained agents are hosted at `zoo/policies `_ . These agents should be installed prior to being used in SMARTS environments or benchmarks. .. code-block:: bash @@ -31,7 +31,7 @@ Contribute agents First, add the new agent to `zoo/policies `_. It should contain * package setup file, -* inference code with prebuilt model, and +* inference code with pre-built model, and * algorithm explanation. Then, register the newly added zoo agent in `zoo/policies/__init__.py `_. @@ -44,7 +44,7 @@ Available zoo agents :header-rows: 1 * - Agent locator and path - - Benchmark or Env + - Benchmark or Environment - Action space - Source - Remarks diff --git a/docs/benchmarks/benchmark.rst b/docs/benchmarks/benchmark.rst index 09db1c5ec6..77769035bb 100644 --- a/docs/benchmarks/benchmark.rst +++ b/docs/benchmarks/benchmark.rst @@ -6,7 +6,7 @@ Instructions A benchmark is a standard set of rigorous environments which can be used to assess and compare the performance of agents built by various researchers. -:doc:`Agent Zoo ` contains prebuilt and trained agents +:doc:`Agent Zoo ` contains pre-built and trained agents which could be deployed as reference ego agent in the benchmarks. Feel free to mix and match compatible agents and benchmarks. @@ -89,7 +89,7 @@ The list of benchmarks from the custom benchmark listing file can be examined as Benchmark listing file ---------------------- -The benchmark listing file is organised as below. +The benchmark listing file is organized as below. .. code:: yaml diff --git a/docs/benchmarks/driving_smarts_2022.rst b/docs/benchmarks/driving_smarts_2022.rst index 152e7c9daa..ee56a3c081 100644 --- a/docs/benchmarks/driving_smarts_2022.rst +++ b/docs/benchmarks/driving_smarts_2022.rst @@ -14,16 +14,16 @@ Refer to :func:`~smarts.env.gymnasium.driving_smarts_2022_env.driving_smarts_202 In each driving scenario, the ego-agents must drive towards their respective mission goal locations. Each agent's mission goal is given in the observation returned by the environment at each time step. The mission goal could be accessed as ``observation.ego_vehicle_state.mission.goal.position`` which gives an ``(x, y, z)`` map coordinate of the goal location. -Any method such as reinforcement learning, offline reinforcement learning, behaviour cloning, generative models, predictive models, etc, may be used to develop the policy. +Any method such as reinforcement learning, offline reinforcement learning, behavior cloning, generative models, predictive models, etc, may be used to develop the policy. The scenario names and their missions are as follows. The desired task execution is illustrated by a trained baseline agent, which uses PPO algorithm from `Stable Baselines3 `_ reinforcement learning library. + 1_to_2lane_left_turn_c - A single ego agent must make a left turn at an uprotected cross-junction. + A single ego agent must make a left turn at an unprotected cross-junction. .. image:: /_static/driving_smarts_2022/intersection-c.gif + 1_to_2lane_left_turn_t - A single ego agent must make a left turn at an uprotected T-junction. + A single ego agent must make a left turn at an unprotected T-junction. .. image:: /_static/driving_smarts_2022/intersection-t.gif + 3lane_merge_multi_agent diff --git a/docs/benchmarks/driving_smarts_2023_1.rst b/docs/benchmarks/driving_smarts_2023_1.rst index 8e58929eb4..b0f2dd03fb 100644 --- a/docs/benchmarks/driving_smarts_2023_1.rst +++ b/docs/benchmarks/driving_smarts_2023_1.rst @@ -42,7 +42,7 @@ below. Here, egos are in red colour, and background traffic is in silver colour. -Any method such as reinforcement learning, offline reinforcement learning, behaviour cloning, generative models, +Any method such as reinforcement learning, offline reinforcement learning, behavior cloning, generative models, predictive models, etc, may be used to develop the policy. Several scenarios are provided for training. Their names and tasks are as follows. @@ -50,7 +50,7 @@ The desired task execution is illustrated in a gif by a trained baseline agent. .. todo:: - Provide sample training scenarios and corresponding gifs showing a baseline model traversing the map. + Provide sample training scenarios and corresponding ``.gif`` images showing a baseline model traversing the map. Observation space ----------------- @@ -92,14 +92,14 @@ the user. ├── setup.cfg └── setup.py -1. inference/contrib_policy/__init__.py +1. ``inference/contrib_policy/__init__.py`` + Keep this file unchanged. + It is an empty file. -2. inference/contrib_policy/policy.py +2. ``inference/contrib_policy/policy.py`` + Must contain a ``class Policy(Agent)`` class which inherits from :class:`~smarts.core.agent.Agent`. -3. inference/__init__.py +3. ``inference/__init__.py`` + Must contain the following template code. + The template code registers the user's policy in SMARTS agent zoo. @@ -147,10 +147,10 @@ the user. + :attr:`~smarts.core.agent_interface.AgentInterface.neighborhood_vehicle_states`, and + :attr:`~smarts.core.agent_interface.AgentInterface.waypoint_paths`. -4. inference/MANIFEST.in +4. ``inference/MANIFEST.in`` + Contains any file paths to be included in the package. -5. inference/setup.cfg +5. ``inference/setup.cfg`` + Must contain the following template code. + The template code helps build the user policy into a Python package. @@ -182,7 +182,7 @@ the user. + Do **not** add SMARTS package as a dependency in the ``install_requires`` section. + Dependencies in the ``install_requires`` section **must** have an exact package version specified using ``==``. -6. inference/setup.py +6. ``inference/setup.py`` + Keep this file and its default contents unchanged. + Its default contents are shown below. diff --git a/docs/benchmarks/driving_smarts_2023_3.rst b/docs/benchmarks/driving_smarts_2023_3.rst index 7b35ebbeaa..20902af2af 100644 --- a/docs/benchmarks/driving_smarts_2023_3.rst +++ b/docs/benchmarks/driving_smarts_2023_3.rst @@ -31,7 +31,7 @@ The episode ends when the leader reaches its destination. Ego agents do not have destination. Additionally, the ego terminates whenever it collides, drives off road, or exceeds maximum number of steps per episode. -Any method such as reinforcement learning, offline reinforcement learning, behaviour cloning, generative models, +Any method such as reinforcement learning, offline reinforcement learning, behavior cloning, generative models, predictive models, etc, may be used to develop the policy. Several scenarios are provided for training. Their names and tasks are as follows. @@ -82,14 +82,14 @@ the user. ├── setup.cfg └── setup.py -1. inference/contrib_policy/__init__.py +1. ``inference/contrib_policy/__init__.py`` + Keep this file unchanged. + It is an empty file. -2. inference/contrib_policy/policy.py +2. ``inference/contrib_policy/policy.py`` + Must contain a ``class Policy(Agent)`` class which inherits from :class:`~smarts.core.agent.Agent`. -3. inference/__init__.py +3. ``inference/__init__.py`` + Must contain the following template code. + The template code registers the user's policy in SMARTS agent zoo. @@ -137,10 +137,10 @@ the user. + :attr:`~smarts.core.agent_interface.AgentInterface.neighborhood_vehicle_states`, and + :attr:`~smarts.core.agent_interface.AgentInterface.waypoint_paths`. -4. inference/MANIFEST.in +4. ``inference/MANIFEST.in`` + Contains any file paths to be included in the package. -5. inference/setup.cfg +5. ``inference/setup.cfg`` + Must contain the following template code. + The template code helps build the user policy into a Python package. @@ -172,7 +172,7 @@ the user. + Do **not** add SMARTS package as a dependency in the ``install_requires`` section. + Dependencies in the ``install_requires`` section **must** have an exact package version specified using ``==``. -6. inference/setup.py +6. ``inference/setup.py`` + Keep this file and its default contents unchanged. + Its default contents are shown below. diff --git a/docs/ecosystem/ngsim.rst b/docs/ecosystem/ngsim.rst index 0562f90abb..4f947b61da 100644 --- a/docs/ecosystem/ngsim.rst +++ b/docs/ecosystem/ngsim.rst @@ -3,7 +3,7 @@ NGSIM ===== -**NGSIM** is the Next Generation Simulation dataset, a free to use dataset created +``NGSIM`` is the Next Generation Simulation dataset, a free to use dataset created by the US Department of Transportation (DOT) and described `here `__. @@ -19,7 +19,7 @@ Its import scripts were tested on and work with the data downloaded from `here < which is the same as was used by this `PPUU project `_. After the dataset has been downloaded, you will need to update each ``scenario.py`` -in the ngsim scenario directories (e.g., :scenarios:`NGSIM/i80/scenario.py`, :scenarios:`NGSIM/us101/scenario.py`, and/or :scenarios:`NGSIM/peachtree/scenario.py`) to point the `input_path` field +in the ``NGSIM`` scenario directories (e.g., :scenarios:`NGSIM/i80/scenario.py`, :scenarios:`NGSIM/us101/scenario.py`, and/or :scenarios:`NGSIM/peachtree/scenario.py`) to point the `input_path` field to the dataset location on your filesystem. Once that is done, you should be able to build your scenarios in the normal way, for example: ``scl scenario build-all --clean scenarios/NGSIM`` diff --git a/docs/ecosystem/rllib.rst b/docs/ecosystem/rllib.rst index 4fd7058bca..969bbc6901 100644 --- a/docs/ecosystem/rllib.rst +++ b/docs/ecosystem/rllib.rst @@ -1,27 +1,28 @@ .. _rllib: -RLlib -===== + +``RLlib`` +====================== **RLlib** is an open-source library for reinforcement learning that offers both high scalability and a unified API for a variety -of applications. RLlib natively supports TensorFlow, TensorFlow Eager, and PyTorch. Most of its internals are agnostic to such +of applications. ``RLlib`` natively supports ``TensorFlow``, ``TensorFlow Eager``, and ``PyTorch``. Most of its internals are agnostic to such deep learning frameworks. Recommended reads ----------------- -RLlib is implemented on top of Ray. Ray is a distributed computing framework specifically designed with RL in mind. There are -many docs about Ray and RLlib. We recommend to read the following pages first, +``RLlib`` is implemented on top of ``Ray``. ``Ray`` is a distributed computing framework specifically designed with RL in mind. There are +many docs about ``Ray`` and ``RLlib``. We recommend to read the following pages first, -- `RLlib in 60 seconds `_: Getting started with RLlib. +- `RLlib in 60 seconds `_: Getting started with ``RLlib``. - `Common Parameters `_: Common `tune` configs. - `Basic Python API `_: Basic `tune.run` function. - `Callbacks and Custom Metrics `_: About callbacks and metrics. - `Visualizing Custom Metrics `_: How to use TensorBoard to visualize metrics. - `Built-in Models and Preprocessors `_: Built-in preprocessor, including how to deal with different observation spaces. -- `Proximal Policy Optimization (PPO) `_: RLlib PPO implementation and PPO parameters. +- `Proximal Policy Optimization (PPO) `_: ``RLlib`` PPO implementation and PPO parameters. - `PopulationBasedTraining `_: Population Based Training algorithm and examples. -- `RLlib Examples `_: Get to know RLlib quickly through examples. +- `RLlib Examples `_: Get to know ``RLlib`` quickly through examples. Resume training diff --git a/docs/resources/containers.rst b/docs/resources/containers.rst index 40c2d5f329..a4151732cb 100644 --- a/docs/resources/containers.rst +++ b/docs/resources/containers.rst @@ -27,8 +27,8 @@ SMARTS docker images are hosted at `dockerhub `_ container. diff --git a/docs/resources/contributing.rst b/docs/resources/contributing.rst index 7e909882ed..791d356132 100644 --- a/docs/resources/contributing.rst +++ b/docs/resources/contributing.rst @@ -23,8 +23,8 @@ We encourage all forms of contributions to SMARTS, not limited to: + Patches + Test cases -Setting up your dev environment -------------------------------- +Setting up your development environment +--------------------------------------- In addition to following the :ref:`setup` steps, you will need to install the ``[dev]`` dependencies. @@ -88,7 +88,7 @@ Documentation All project code API, features, examples, etc, should be documented using `reStructuredText `_ at ``SMARTS/docs``. The docs are generated by Sphinx and hosted at `https://smarts.readthedocs.io/ `_. -All public python code interface should have `Google `_ styled comments and docstrings. Sphinx provides an `example `_ Google style Python docstrings. +All public python code interface should have `Google `_ styled comments and ``"docstrings"``. Sphinx provides an `example `_ Google style Python ``"docstrings"``. Execute the following to build the docs locally. diff --git a/docs/setup.rst b/docs/setup.rst index 46b3fabd4f..457578a70c 100644 --- a/docs/setup.rst +++ b/docs/setup.rst @@ -6,8 +6,8 @@ Setup Prerequisites ------------- -+ python3 (3.8 or 3.9) -+ ubuntu (>=16.04) ++ ``python3 (3.8 or 3.9)`` ++ ``ubuntu (>=16.04)`` Installation ------------ diff --git a/docs/sim/agent.rst b/docs/sim/agent.rst index c76c2db10f..ecc5b86823 100644 --- a/docs/sim/agent.rst +++ b/docs/sim/agent.rst @@ -282,7 +282,7 @@ Here, ``max_episode_steps`` controls the max steps allowed for the agent in an e .. note:: - While using RLlib, the ``max_episode_steps`` control authority may be ceded to RLlib through their config option ``horizon``, but doing so + While using ``RLlib``, the ``max_episode_steps`` control authority may be ceded to ``RLlib`` through their config option ``horizon``, but doing so removes the ability to customize different max episode steps for each agent. A pre-configured `interface` can be extended by supplying extra `kwargs`. For example the following extends `AgentType.Standard` pre-configured interface to include lidar observation. @@ -344,7 +344,7 @@ Spaces Spaces provide samples for variation. For reference on spaces, see `gymnasium `_ . SMARTS environments contains (i) ``observation_space`` and (ii) ``action_space`` attributes, which are dictionaries mapping agent ids to their corresponding observation or action spaces, respectively. -Consider a SMARTS env with an agent named `Agent_001`. If `Agent_001`'s `interface` is customised, then the agent's corresponding observation space (i.e., ``env.observation_space["Agent_001"]``) and action space (i.e., ``env.action_space["Agent_001"]``) from the environment would be changed accordingly. +Consider a SMARTS env with an agent named `Agent_001`. If `Agent_001`'s `interface` is customized, then the agent's corresponding observation space (i.e., ``env.observation_space["Agent_001"]``) and action space (i.e., ``env.action_space["Agent_001"]``) from the environment would be changed accordingly. Policy ------ diff --git a/docs/sim/bubbles.rst b/docs/sim/bubbles.rst index 53250c8368..6ef0d273bb 100644 --- a/docs/sim/bubbles.rst +++ b/docs/sim/bubbles.rst @@ -7,8 +7,8 @@ SMARTS provides the concept of a spatial-temporal bubble which allows for focuse A bubble covers an area and filters traffic vehicles that pass through that zone. A vehicle entering the bubble will first pass into an ``airlock`` buffer area of ``shadowing`` where an agent may begin observing from the vehicle. The agent may then fully take over control of that vehicle when it enters the bubble proper. SMARTS will replace control of the traffic vehicles with the agents specified by the bubble definition. The bubble agent will relinquish its control to a suitable traffic provider when its controlled vehicle exits the bubble and airlock regions. -Limtations ----------- +Limitations +----------- If a vehicle whose trajectory is being provided from a traffic history dataset is taken over by an agent within a bubble, the vehicle generally cannot be returned to the trajectory specified in the history dataset upon bubble exit without a "jump" or "glitch" due to the plurality of situations where there is a divergence of vehicle states from the history within the bubble. So instead, the simple SMARTS traffic provider assumes control of it at this point and will attempt to navigate it to its original destination, avoiding collisions along the way. diff --git a/docs/sim/cli.rst b/docs/sim/cli.rst index 8010def955..996bce9a72 100644 --- a/docs/sim/cli.rst +++ b/docs/sim/cli.rst @@ -1,5 +1,9 @@ .. _cli: +.. spelling:word-list:: + + scl + Command Line Interface ====================== diff --git a/docs/sim/configuration.rst b/docs/sim/configuration.rst index 1cb718117d..34692021d0 100644 --- a/docs/sim/configuration.rst +++ b/docs/sim/configuration.rst @@ -8,7 +8,7 @@ You can change the behavior of the underlying SMARTS engine. Configuration of the engine can come from several sources. These locations take precedence as noted: 1. Individual ``SMARTS_`` prefixed environment variables (e.g. ``SMARTS_SENSOR_WORKER_COUNT``) -2. Local directory engine configuration (./smarts_engine.ini ) +2. Local directory engine configuration (``./smarts_engine.ini``) 3. Local user engine configuration, ``~/.smarts/engine.ini``, if local directory configuration is not found. 4. Global engine configuration, ``/etc/smarts/engine.ini``, if local configuration is not found. 5. Package default configuration, ``$PYTHON_PATH/smarts/engine.ini``, if global configuration is not found. diff --git a/docs/sim/env.rst b/docs/sim/env.rst index 981dd576a9..5d6571830a 100644 --- a/docs/sim/env.rst +++ b/docs/sim/env.rst @@ -9,7 +9,7 @@ Base environments SMARTS environment module is defined in :mod:`~smarts.env` package. Currently SMARTS provides two kinds of training environments, namely: -+ ``HiWayEnv`` utilising ``gym.env`` style interface ++ ``HiWayEnv`` utilizing ``gym.env`` style interface + ``RLlibHiwayEnv`` customized for `RLlib `_ training .. image:: ../_static/env.png @@ -91,7 +91,7 @@ This can be done with :class:`~smarts.env.gymnasium.wrappers.api_reversion.Api02 RLlibHiwayEnv ^^^^^^^^^^^^^ -``RLlibHiwayEnv`` inherits class ``MultiAgentEnv``, which is defined in RLlib. It also supports common env APIs like ``reset``, +``RLlibHiwayEnv`` inherits class ``MultiAgentEnv``, which is defined in `RLlib `_. It also supports common env APIs like ``reset``, ``step``, ``close``. An usage example is shown below. Refer to :class:`~smarts.env.rllib_hiway_env.RLlibHiWayEnv` for more details. .. code-block:: python @@ -133,11 +133,11 @@ SMARTS environments support the following types of vehicles: Refer to :ref:`scenario_studio` for designing scenarios, traffic vehicles, social agents, ego agents, and maps. -Multiagent Scenario -^^^^^^^^^^^^^^^^^^^ +Multi-agent Scenario +^^^^^^^^^^^^^^^^^^^^ -In multiagent scenarios, the agents may start and end at different time points -in the simulation. Consider the following multiagent scenario with 3 agents, +In multi-agent scenarios, the agents may start and end at different time points +in the simulation. Consider the following multi-agent scenario with 3 agents, namely ``Agent_0``, ``Agent_1``, and ``Agent_2``. .. list-table:: @@ -186,7 +186,7 @@ Moreover, if there are **n** routes file in ``scenario1/build/traffic`` dir, the ... } -In contrast to the above case, we can also use multiple maps for *different workers* in RLlib as follows. +In contrast to the above case, we can also use multiple maps for *different workers* in `RLlib `_ as follows. .. code-block:: python diff --git a/docs/sim/obs_action_reward.rst b/docs/sim/obs_action_reward.rst index 0a7227c0db..156f3b2a87 100644 --- a/docs/sim/obs_action_reward.rst +++ b/docs/sim/obs_action_reward.rst @@ -1,5 +1,9 @@ .. _obs_action_reward: +.. spelling:word-list:: + + rgb + Observation, Action, and Reward =============================== @@ -41,7 +45,7 @@ The complete set of possible :class:`~smarts.core.observations.Observation` retu +------------------------------+------------------------------------------------------------------------+------------------------------------------------------------------------------------+ | road_waypoints | Optional[:class:`~smarts.core.observations.RoadWaypoints`] | Per-road waypoints information. | +------------------------------+------------------------------------------------------------------------+------------------------------------------------------------------------------------+ -| via_data | :class:`~smarts.core.observations.Vias` | Listing of nearby collectable ViaPoints and ViaPoints collected in the last step. | +| via_data | :class:`~smarts.core.observations.Vias` | Listing of nearby collectible ViaPoints and ViaPoints collected in the last step. | +------------------------------+------------------------------------------------------------------------+------------------------------------------------------------------------------------+ | signals | Optional[List[:class:`~smarts.core.observations.SignalObservation`]] | List of nearby traffic signal (light) states on this timestep. | +------------------------------+------------------------------------------------------------------------+------------------------------------------------------------------------------------+ diff --git a/docs/sim/scenario_studio.rst b/docs/sim/scenario_studio.rst index 85c1af501e..9c53091176 100644 --- a/docs/sim/scenario_studio.rst +++ b/docs/sim/scenario_studio.rst @@ -11,7 +11,7 @@ The Scenario Studio ``sstudio`` of SMARTS is a stand alone package :mod:`~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`. -SMARTS interacts with road maps abstractly (polymorphically) 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. +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. SMARTS ships with a variety of pre-configured scenarios, which can be found in ``SMARTS/scenarios`` and ``SMARTS/smarts/scenarios`` directories. @@ -61,7 +61,7 @@ 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 behaviour, can be configured here. +: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. 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. @@ -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.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. .. code-block:: python @@ -236,9 +236,9 @@ Click on any edge to inspect detail and modify properties. .. image:: ../_static/map_lane.png -The selected block is an edge with id "gneE72". It contains 3 lanes with lane index 0, 1, 2. +The selected block is an edge with id ``"gneE72"``. It contains 3 lanes with lane index 0, 1, 2. -To modify the properties, for example change the number of lanes to 2 lanes by changing 3 to 2 on the "numLanes" field, and press "enter" to make the change. Then press "ctrl+s" to save. Finally, make sure to rebuild the scenario. +To modify the properties, for example change the number of lanes to 2 lanes by changing 3 to 2 on the `"numLanes"` field, and press "enter" to make the change. Then press ``"ctrl+s"`` to save. Finally, make sure to rebuild the scenario. .. code-block:: bash diff --git a/docs/sim/simulator.rst b/docs/sim/simulator.rst index fc8e87cde1..5427cc5396 100644 --- a/docs/sim/simulator.rst +++ b/docs/sim/simulator.rst @@ -32,7 +32,7 @@ The step interface is similar to gym but with a few notable differences mainly d ) -The SMARTS simulator has the explict requirement to call ``destroy()`` before deleting the instance. +The SMARTS simulator has the explicit requirement to call ``destroy()`` before deleting the instance. .. code-block:: python diff --git a/docs/sim/visualization.rst b/docs/sim/visualization.rst index e9834bb78d..242eae1b38 100644 --- a/docs/sim/visualization.rst +++ b/docs/sim/visualization.rst @@ -25,7 +25,7 @@ An example is shown below to run SMARTS with Envision. # Run the chase_via_points.py example with the loop scenario $ scl run --envision examples/control/chase_via_points.py scenarios/sumo/loop -``--envision`` flag is added to ``scl run`` to enable the Envision server. Visit `http://localhost:8081/ `_ in your browser to see the environment visualization. Select the simulator instance in the top left dropdown. If you are using SMARTS on a remote machine you will need to forward port 8081. +``--envision`` flag is added to ``scl run`` to enable the Envision server. Visit `http://localhost:8081/ `_ in your browser to see the environment visualization. Select the simulator instance in the top left drop-down. If you are using SMARTS on a remote machine you will need to forward port 8081. Data Recording and Replay ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -87,10 +87,10 @@ Save an updated distribution if any changes were made to the Envision web applic # Saves to envision/web/dist $ npm run build -Visdom ------- +``Visdom`` +---------- -Use the `Visdom `_ integration to easily see the image-based observation outputs in real-time. +Use the `visdom `_ integration to easily see the image-based observation outputs in real-time. Start the visdom server before running the scenario and open the server URL in your browser `http://localhost:8097 `_. .. code-block:: bash @@ -98,7 +98,7 @@ Start the visdom server before running the scenario and open the server URL in y # Install visdom $ pip install smarts[visdom] -Enable Visdom in the SMARTS environment by setting ``SMARTS_VISDOM_ENABLED``. For example: +Enable ``visdom`` in the SMARTS environment by setting ``SMARTS_VISDOM_ENABLED``. For example: .. code-block:: ini diff --git a/envision/client.py b/envision/client.py index 6c4a79c8ab..0a250c7058 100644 --- a/envision/client.py +++ b/envision/client.py @@ -50,7 +50,7 @@ class JSONEncodingState: class CustomJSONEncoder(json.JSONEncoder): """This custom encoder is to support serializing more complex data from SMARTS - including numpy arrays, NaNs, and Infinity which don't have standarized handling + including numpy arrays, NaNs, and Infinity which don't have standardized handling according to the JSON spec. """ @@ -191,7 +191,7 @@ def read_and_send( fixed_timestep_sec: float = 0.1, wait_between_retries: float = 0.5, ): - """Send a pre-recorded envision simulation to the envision server.""" + """Send recorded envision simulation data to the envision server.""" client = Client( endpoint=endpoint, diff --git a/envision/data_formatter.py b/envision/data_formatter.py index 66019b4d49..1a0dae4e36 100644 --- a/envision/data_formatter.py +++ b/envision/data_formatter.py @@ -63,7 +63,10 @@ class Operation(IntEnum): REDUCE = 1 """Send value only if it has changed.""" FLATTEN = 4 - """Convert value from list or dataclass to higher hierachy.""" + """Convert value from a sequential container or `dataclass` to a flat hierarchy. + + e.g. [(1, 2), (13,)] -> [1, 2, 13] + """ _formatter_map: Dict[Type, Callable[[Any, "EnvisionDataFormatter"], None]] = {} @@ -94,7 +97,7 @@ def reset(self): @property def enabled(self): - """If this reduction context is enabled(else it is passthrough.)""" + """If this reduction context is enabled(else it is pass-through.)""" return self._enabled @property diff --git a/envision/server.py b/envision/server.py index 13e81f30e3..8069a6177f 100644 --- a/envision/server.py +++ b/envision/server.py @@ -64,13 +64,13 @@ class AllowCORSMixin: - """A mixin that adds CORS headers to the page.""" + """A mix-in that adds CORS headers to the page.""" _HAS_DYNAMIC_ATTRIBUTES = True def set_default_headers(self): """Setup the default headers. - In this case they are the minimum required CORS releated headers. + In this case they are the minimum required CORS related headers. """ self.set_header("Access-Control-Allow-Origin", "*") self.set_header("Access-Control-Allow-Headers", "x-requested-with") @@ -117,7 +117,7 @@ def size(self): class Frames: """A managed collection of simulation frames. This collection uses a random discard of simulation frames to stay under capacity. - Random discard favours preserving newer frames over time. + Random discard favors preserving newer frames over time. """ def __init__(self, max_capacity_mb=500): @@ -206,7 +206,7 @@ def __init__( self._thread: Optional[threading.Thread] = None def seek(self, offset_seconds): - """Indicate to the webclient that it should progress to the nearest frame to the given time.""" + """Indicate to the web-client that it should progress to the nearest frame to the given time.""" self._seek = offset_seconds def stop(self): @@ -298,7 +298,7 @@ def _calculate_frame_delay(self, frame_ptr): class BroadcastWebSocket(tornado.websocket.WebSocketHandler): """This websocket receives the SMARTS state (the other end of the open websocket is held by the Envision Client (SMARTS)) and broadcasts it to all web clients - that have open websockets via the `StateWebSocket` handler. + that have open web-sockets via the `StateWebSocket` handler. """ def initialize(self, max_capacity_mb): @@ -347,7 +347,7 @@ async def on_message(self, message): class StateWebSocket(tornado.websocket.WebSocketHandler): """This websocket sits on the other side of the web client. It handles playback and playback - control messages from the webclient. + control messages from the web-client. """ def initialize(self): @@ -363,7 +363,7 @@ def get_compression_options(self): return {"compression_level": 6, "mem_level": 5} async def open(self, simulation_id): - """Open this socket to listen for webclient playback requests.""" + """Open this socket to listen for web-client playback requests.""" if simulation_id not in WEB_CLIENT_RUN_LOOPS: raise tornado.web.HTTPError(404, f"Simulation `{simulation_id}` not found.") @@ -391,14 +391,14 @@ def on_close(self): run_loop.remove(self._run_loop) async def on_message(self, message): - """Asynchonously handle playback requests.""" + """Asynchronously handle playback requests.""" message = json.loads(message) if "seek" in message: self._run_loop.seek(message["seek"]) class FileHandler(AllowCORSMixin, tornado.web.RequestHandler): - """This handler serves files to the given requestee.""" + """This handler serves files to the given requester.""" def initialize(self, path_map: Dict[str, Union[str, Path]] = {}): """FileHandler that serves file for a given ID.""" @@ -560,7 +560,7 @@ def run( def main(): - """Main function for when using this file as an entrypoint.""" + """Main function for when using this file as an entry-point.""" parser = argparse.ArgumentParser( prog="Envision Server", description="The Envision server broadcasts SMARTS state to Envision web " diff --git a/envision/types.py b/envision/types.py index dc8299765d..acdfe2c501 100644 --- a/envision/types.py +++ b/envision/types.py @@ -96,7 +96,7 @@ class State(NamedTuple): class Preamble(NamedTuple): - """Information for startup and synchronisation between client and server.""" + """Information for startup and synchronization between client and server.""" scenarios: Sequence[str] """Directories of simulated scenarios.""" diff --git a/examples/dynamic_history_vehicles_replacement.py b/examples/dynamic_history_vehicles_replacement.py index 470810935b..0d6c86b572 100644 --- a/examples/dynamic_history_vehicles_replacement.py +++ b/examples/dynamic_history_vehicles_replacement.py @@ -210,7 +210,7 @@ def on_trigger(ctx: Dict[str, Any]): parser.add_argument( "--positional_radius", "-r", - help="The maximum radial distance (in metres) from the end position for which the PositionalGoal mission will end.", + help="The maximum radial distance (in meters) from the end position for which the PositionalGoal mission will end.", type=int, default=3, ) diff --git a/examples/rl/drive/inference/contrib_policy/frame_stack.py b/examples/rl/drive/inference/contrib_policy/frame_stack.py index f992dd26d3..9da17cd193 100644 --- a/examples/rl/drive/inference/contrib_policy/frame_stack.py +++ b/examples/rl/drive/inference/contrib_policy/frame_stack.py @@ -10,7 +10,7 @@ class FrameStack: fashion, and returns the stacked_frames. Note: - Wrapper returns a deepcopy of the stacked frames, which may be expensive + Wrapper returns a deep-copy of the stacked frames, which may be expensive for large frames and large num_stack values. """ diff --git a/examples/rl/platoon/inference/contrib_policy/frame_stack.py b/examples/rl/platoon/inference/contrib_policy/frame_stack.py index f992dd26d3..9da17cd193 100644 --- a/examples/rl/platoon/inference/contrib_policy/frame_stack.py +++ b/examples/rl/platoon/inference/contrib_policy/frame_stack.py @@ -10,7 +10,7 @@ class FrameStack: fashion, and returns the stacked_frames. Note: - Wrapper returns a deepcopy of the stacked frames, which may be expensive + Wrapper returns a deep-copy of the stacked frames, which may be expensive for large frames and large num_stack values. """ diff --git a/examples/rl/racing/README.md b/examples/rl/racing/README.md index 440332f043..ca19d47606 100644 --- a/examples/rl/racing/README.md +++ b/examples/rl/racing/README.md @@ -1,13 +1,13 @@ # Racing This example illustrates the training of an ego agent to drive, as fast and as far as possible, in traffic using the [DreamerV2](https://github.com/danijar/dreamerv2) reinforcement-learning algorithm. -The ego agent earns reward for the distance travelled per-step and is penalised for colliding with other vehicles and for going off-road. +The ego agent earns reward for the distance travelled per-step and is penalized for colliding with other vehicles and for going off-road. ## Trained agent racing in traffic ![](./docs/_static/racing.gif) ## Observation space -+ Topdown RGB image ++ Top-down RGB image + size (width x height): 64 pixels x 64 pixels + resolution: 1 meter/pixel ``` diff --git a/examples/tools/pybullet_sumo_orientation_example.py b/examples/tools/pybullet_sumo_orientation_example.py index b22f9e7611..0c3ebd8750 100644 --- a/examples/tools/pybullet_sumo_orientation_example.py +++ b/examples/tools/pybullet_sumo_orientation_example.py @@ -44,13 +44,13 @@ def social_spin_on_bumper_cw(step, front_bumper_position, length): ) -def social_spin_on_centre_ccw(step, position): +def social_spin_on_center_ccw(step, position): return Pose.from_center(np.array(position), Heading.from_panda3d(step)) -def social_spin_on_axle_cw(step, base_position, offset_from_centre): +def social_spin_on_axle_cw(step, base_position, offset_from_center): return Pose.from_explicit_offset( - offset_from_centre, + offset_from_center, np.array(base_position), Heading.from_sumo(step), local_heading=Heading(0), @@ -83,7 +83,7 @@ def run( injected_poses = [ social_spin_on_bumper_cw(step * 0.1, [8, 6, 0], passenger_dimen.length), - # social_spin_on_centre_ccw(step * 0.1, [8, 0, passenger_dimen[2] / 2]), + # social_spin_on_center_ccw(step * 0.1, [8, 0, passenger_dimen[2] / 2]), # social_spin_on_axle_cw( # step * 0.1, [0, 0, 0], [2 * passenger_dimen[0], 0, 0] # ), diff --git a/scenarios/sumo/minicity/scenario.py b/scenarios/sumo/minicity/scenario.py index 318fb6104b..339e2e8ec0 100644 --- a/scenarios/sumo/minicity/scenario.py +++ b/scenarios/sumo/minicity/scenario.py @@ -38,7 +38,7 @@ agent_locator="zoo.policies:keep-lane-agent-v0", ) -travelling_bubbles = [ +traveling_bubbles = [ t.Bubble( zone=t.PositionalZone(pos=(50, 0), size=(10, 50)), margin=5, @@ -69,7 +69,7 @@ social_agent_missions={ "all": ([laner_actor], [t.Mission(route=t.RandomRoute())]) }, - bubbles=[*travelling_bubbles, *static_bubbles], + bubbles=[*traveling_bubbles, *static_bubbles], ), output_dir=Path(__file__).parent, ) diff --git a/smarts/benchmark/__init__.py b/smarts/benchmark/__init__.py index c9c64c168d..2199c5311a 100644 --- a/smarts/benchmark/__init__.py +++ b/smarts/benchmark/__init__.py @@ -84,7 +84,7 @@ def run_benchmark( agent_locator(str): Locator string for the registered agent. benchmark_listing(Path): A configuration file that lists benchmark metadata and must list the target benchmark. - debug_log: Debug to stdout. + debug_log: Debug to `stdout`. """ from smarts.core.utils.resources import load_yaml_config_with_substitution diff --git a/smarts/benchmark/driving_smarts/__init__.py b/smarts/benchmark/driving_smarts/__init__.py index 0df1109f62..05018c04c9 100644 --- a/smarts/benchmark/driving_smarts/__init__.py +++ b/smarts/benchmark/driving_smarts/__init__.py @@ -26,7 +26,7 @@ def load_config(path: Path) -> Optional[Dict[str, Any]]: - """Load in a benchmark config.""" + """Load in a benchmark configuration.""" if isinstance(path, (str,)): path = Path(path) return _load_config(path) diff --git a/smarts/benchmark/entrypoints/benchmark_runner_v0.py b/smarts/benchmark/entrypoints/benchmark_runner_v0.py index 6cf55a1919..538275c910 100644 --- a/smarts/benchmark/entrypoints/benchmark_runner_v0.py +++ b/smarts/benchmark/entrypoints/benchmark_runner_v0.py @@ -137,8 +137,8 @@ def benchmark(benchmark_args, agent_locator, log_workers=False): """Runs the benchmark using the following: Args: benchmark_args(dict): Arguments configuring the benchmark. - agent_loctor(str): Locator string for the registered agent. - debug_log(bool): Whether the benchmark should log to stdout. + agent_locator(str): Locator string for the registered agent. + debug_log(bool): Whether the benchmark should log to `stdout`. """ print(f"\n\n<-- Starting `{benchmark_args['name']}` benchmark -->\n") message = benchmark_args.get("message") @@ -214,7 +214,7 @@ def benchmark_from_configs(benchmark_config, agent_locator, debug_log=False): Args: benchmark_config(file path): The file path to the benchmark configuration. agent_locator(str): Locator string for the registered agent. - debug_log(bool): Whether the benchmark should log to stdout. + debug_log(bool): Whether the benchmark should log to `stdout`. """ benchmark_args = load_config(benchmark_config) diff --git a/smarts/core/__init__.py b/smarts/core/__init__.py index 272df8ca7e..f8899750e2 100644 --- a/smarts/core/__init__.py +++ b/smarts/core/__init__.py @@ -56,18 +56,18 @@ def gen_id(): @lru_cache(maxsize=1) def config(default: str = "./smarts_engine.ini") -> Config: - """Get the SMARTS environment config for the smarts engine. + """Get the SMARTS environment configuration for the smarts engine. .. note:: This searches the following locations and loads the first one it finds: - ./smarts_engine.ini - ~/.smarts/engine.ini - /etc/smarts/engine.ini - $PYTHON_PATH/smarts/engine.ini + `./smarts_engine.ini` + `~/.smarts/engine.ini` + `/etc/smarts/engine.ini` + `$PYTHON_PATH/smarts/engine.ini` Args: - default (str, optional): The default configurable location. Defaults to "./smarts_engine.ini". + default (str, optional): The default configurable location. Defaults to `./smarts_engine.ini`. Returns: Config: A configuration utility that allows resolving environment and `engine.ini` configuration. diff --git a/smarts/core/agent.py b/smarts/core/agent.py index 1331b4e417..1e84a7306a 100644 --- a/smarts/core/agent.py +++ b/smarts/core/agent.py @@ -52,7 +52,7 @@ def act(self, obs): def act(self, obs: Observation, **configs): """The agent action. See documentation on observations, `AgentSpec`, and `AgentInterface`. - Expects an adapted observation and returns an unadapted action. + Expects an adapted observation and returns a raw action. """ raise NotImplementedError diff --git a/smarts/core/agent_interface.py b/smarts/core/agent_interface.py index 1ae2e95435..50cd6f1a89 100644 --- a/smarts/core/agent_interface.py +++ b/smarts/core/agent_interface.py @@ -44,8 +44,8 @@ class DrivableAreaGridMap: @dataclass class OGM: """The width and height are in "pixels" and the resolution is the "size of a - pixel". E.g. if you wanted 100m x 100m OGM but a 64x64 image representation - you would do OGM(width=64, height=64, resolution=100/64) + pixel". E.g. if you wanted 100m x 100m `OGM` but a 64x64 image representation + you would do `OGM(width=64, height=64, resolution=100/64)` """ width: int = 256 @@ -56,8 +56,8 @@ class OGM: @dataclass class RGB: """The width and height are in "pixels" and the resolution is the "size of a - pixel". E.g. if you wanted 100m x 100m RGB but a 256x256 image representation - you would do RGB(width=256, height=256, resolution=100/256) + pixel". E.g. if you wanted 100m x 100m `RGB` but a 256x256 image representation + you would do `RGB(width=256, height=256, resolution=100/256)` """ width: int = 256 @@ -125,7 +125,7 @@ class Signals: class AgentType(IntEnum): - """Used to select preconfigured agent interfaces.""" + """Used to select a standard configured agent interface.""" Buddha = 0 """Agent sees nothing and does nothing.""" @@ -228,7 +228,7 @@ class EventConfiguration: @dataclass(frozen=True) class DoneCriteria: - """Toggleable conditions on which cause removal of an agent from the current episode.""" + """Toggle conditions on which cause removal of an agent from the current episode.""" collision: bool = True """End the episode when the agent collides with another vehicle.""" @@ -299,13 +299,13 @@ class AgentInterface: occupancy_grid_map: Union[OGM, bool] = False """ - Enable the OGM (Occupancy Grid Map) sensor, a grid is provided where each cell signals whether + Enable the `OGM` (Occupancy Grid Map) sensor, a grid is provided where each cell signals whether that area in space is occupied. """ top_down_rgb: Union[RGB, bool] = False """ - Enable the RGB camera sensor, a top down color image is provided. + Enable the `RGB` camera sensor, a top down color image is provided. """ lidar_point_cloud: Union[Lidar, bool] = False @@ -373,7 +373,7 @@ def from_type(requested_type: AgentType, **kwargs): Args: requested_type: - Select a premade AgentInterface from an AgentType + Select a prefabricated AgentInterface from an AgentType max_episode_steps: The total number of steps this interface will observe before expiring """ diff --git a/smarts/core/agent_manager.py b/smarts/core/agent_manager.py index e8b42ec8b1..f1af56a330 100644 --- a/smarts/core/agent_manager.py +++ b/smarts/core/agent_manager.py @@ -356,7 +356,7 @@ def filter_response_for_ego( ) -> Tuple[ Dict[str, Observation], Dict[str, float], Dict[str, float], Dict[str, bool] ]: - """Filter all (observations, rewards, dones, infos) down to those related to ego agents.""" + """Filter all `observations`, `rewards`, `dones`, and `infos` down to those related to ego agents.""" return tuple(map(self._filter_for_active_ego, response_tuple)) def fetch_agent_actions(self, ego_agent_actions: Dict[str, Any]) -> Dict[str, Any]: @@ -433,7 +433,7 @@ def _filter_social_agent_actions_for_controlled_vehicles( def add_social_agent_observations_callback( self, callback: Callable[[Any], None], callback_id: str ): - """Suscribe to observe social agents.""" + """Subscribe a callback to observe social agents.""" self._social_agent_observation_callbacks[callback_id] = callback def remove_social_agent_observations_callback(self, callback_id: str): @@ -662,7 +662,7 @@ def start_social_agent(self, agent_id, social_agent, agent_model): def teardown_ego_agents(self, filter_ids: Optional[Set] = None): """Tears down all given ego agents passed through the filter. Args: - filter_ids (Optional[Set[str]]): The whitelist of agent ids. If `None`, all ids are whitelisted. + filter_ids (Optional[Set[str]], optional): The whitelist of agent ids. If `None`, all ids are whitelisted. """ ids_ = self._teardown_agents_by_ids(self._ego_agent_ids, filter_ids) self._ego_agent_ids -= ids_ @@ -671,7 +671,7 @@ def teardown_ego_agents(self, filter_ids: Optional[Set] = None): def teardown_social_agents(self, filter_ids: Optional[Set] = None): """Tears down all given social agents passed through the filter. Args: - filter_ids (Optional[Set[str]]): The whitelist of agent ids. If `None`, all ids are whitelisted. + filter_ids (Optional[Set[str]], optional): The whitelist of agent ids. If `None`, all ids are whitelisted. """ ids_ = self._teardown_agents_by_ids(self._social_agent_ids, filter_ids) diff --git a/smarts/core/argoverse_map.py b/smarts/core/argoverse_map.py index 7424be453b..226156128f 100644 --- a/smarts/core/argoverse_map.py +++ b/smarts/core/argoverse_map.py @@ -54,7 +54,7 @@ class ArgoverseMap(RoadMapWithCaches): - """A road map for an Argoverse 2 scenario.""" + """A road map for an `Argoverse 2` scenario.""" DEFAULT_LANE_SPEED = 16.67 # m/s @@ -186,9 +186,9 @@ def _load_map_data(self): all_ids = set(self._avm.get_scenario_lane_segment_ids()) processed_ids = set() for lane_seg in self._avm.get_scenario_lane_segments(): - # If this is a rightmost lane, create a road with its neighbours + # If this is a rightmost lane, create a road with its neighbors if lane_seg.right_neighbor_id is None: - neighbours: List[int] = [] + neighbors: List[int] = [] cur_seg = lane_seg while True: left_mark = cur_seg.left_lane_marking.mark_type @@ -201,19 +201,19 @@ def _load_map_data(self): # There is a valid lane to the left, so add it and continue left_seg = self._avm.vector_lane_segments[left_id] - # Edge case: sometimes there can be a cycle (2 lanes can have each other as their left neighbour) + # Edge case: sometimes there can be a cycle (2 lanes can have each other as their left neighbor) if left_seg.left_neighbor_id == cur_seg.id: break cur_seg = left_seg - neighbours.append(left_id) + neighbors.append(left_id) else: break # This is the leftmost lane in the road, so stop # Create the lane objects road_id = "road" lanes = [] - for index, seg_id in enumerate([lane_seg.id] + neighbours): + for index, seg_id in enumerate([lane_seg.id] + neighbors): road_id += f"-{seg_id}" lane_id = f"lane-{seg_id}" seg = self._avm.vector_lane_segments[seg_id] @@ -357,7 +357,7 @@ def to_glb(self, glb_dir): lane_lines_glb.write_glb(Path(glb_dir) / "lane_lines.glb") class Surface(RoadMapWithCaches.Surface): - """Surface representation for Argoverse maps.""" + """Surface representation for `Argoverse` maps.""" def __init__(self, surface_id: str, road_map): self._surface_id = surface_id @@ -374,7 +374,7 @@ def surface_by_id(self, surface_id: str) -> Optional[RoadMap.Surface]: return self._surfaces.get(surface_id) class Lane(RoadMapWithCaches.Lane, Surface): - """Lane representation for Argoverse maps.""" + """Lane representation for `Argoverse` maps.""" def __init__( self, map: "ArgoverseMap", lane_id: str, lane_seg: LaneSegment, index: int @@ -644,7 +644,7 @@ def road_with_point(self, point: Point) -> Optional[RoadMap.Road]: return None class Road(RoadMapWithCaches.Road, Surface): - """Road representation for Argoverse maps.""" + """Road representation for `Argoverse` maps.""" def __init__(self, road_id: str, lanes: List[RoadMap.Lane]): super().__init__(road_id, None) @@ -763,11 +763,13 @@ def shape( def road_by_id(self, road_id: str) -> RoadMap.Road: road = self._roads.get(road_id) - assert road, f"ArgoverseMap got request for unknown road_id: '{road_id}'" + assert ( + road + ), f"{ArgoverseMap.__name__} got request for unknown road_id: '{road_id}'" return road class Route(RouteWithCache): - """Describes a route between Argoverse roads.""" + """Describes a route between `Argoverse` roads.""" def __init__(self, road_map): super().__init__(road_map) diff --git a/smarts/core/bubble_manager.py b/smarts/core/bubble_manager.py index 455fcaba20..1da83428ac 100644 --- a/smarts/core/bubble_manager.py +++ b/smarts/core/bubble_manager.py @@ -161,7 +161,7 @@ def keep_alive(self): """ return self._bubble.keep_alive - # XXX: In the case of travelling bubbles, the geometry and zone are moving + # XXX: In the case of traveling bubbles, the geometry and zone are moving # according to the follow vehicle. @property def geometry(self) -> Polygon: @@ -181,7 +181,7 @@ def admissibility( running_cursors: Set["Cursor"], ): """The vehicle_id we are querying for and the `other_vehicle_ids` _presently in - this `sstudio.types.Bubble`. + this :class:`~smarts.sstudio.types.bubble.Bubble`. """ for prefix in self.exclusion_prefixes: if vehicle_id.startswith(prefix): @@ -238,7 +238,7 @@ def in_bubble_or_airlock(self, position: Point): return in_bubble, in_airlock and not in_bubble @property - def is_travelling(self): + def is_traveling(self): """If the bubble is following an actor.""" return ( self._bubble.follow_actor_id is not None @@ -281,7 +281,7 @@ def _transform(geom): def __repr__(self): return f"""Bubble( id={self.id}, - travelling={self.is_travelling}, + traveling={self.is_traveling}, actor={self.actor}, follow_actor_id={self.follow_actor_id}, limit={self.limit}, @@ -339,7 +339,7 @@ def for_removed( @staticmethod def from_pos( - pos: Point, + position: Point, vehicle_id: str, bubble: Bubble, index: VehicleIndex, @@ -348,7 +348,7 @@ def from_pos( ) -> "Cursor": """Generate a cursor. Args: - pos (Point): + position (Point): The shapely position of the vehicle. vehicle (Vehicle): The vehicle that is to be tracked. @@ -361,7 +361,7 @@ def from_pos( running_cursors (Set["Cursor"]): A set of existing cursors. """ - in_bubble_zone, in_airlock_zone = bubble.in_bubble_or_airlock(pos) + in_bubble_zone, in_airlock_zone = bubble.in_bubble_or_airlock(position) is_social = vehicle_id in index.social_vehicle_ids() is_hijacked, is_shadowed = index.vehicle_is_hijacked_or_shadowed(vehicle_id) is_hijack_admissible, is_airlock_admissible = bubble.admissibility( @@ -369,7 +369,7 @@ def from_pos( ) was_in_this_bubble = vehicle_id in vehicle_ids_per_bubble[bubble] - # XXX: When a travelling bubble disappears and an agent is airlocked or + # XXX: When a traveling bubble disappears and an agent is airlocked or # hijacked. It remains in that state. # TODO: Depending on step size, we could potentially skip transitions (e.g. # go straight to relinquish w/o hijacking first). This may be solved by @@ -433,9 +433,9 @@ def bubbles(self) -> Sequence[Bubble]: return active_bubbles def _bubble_groups(self) -> Tuple[List[Bubble], List[Bubble]]: - # Filter out travelling bubbles that are missing their follow vehicle + # Filter out traveling bubbles that are missing their follow vehicle def is_active(bubble): - if not bubble.is_travelling: + if not bubble.is_traveling: return True vehicles = [] @@ -500,7 +500,7 @@ def agent_ids_for_bubble(self, bubble: Bubble, sim) -> Set[str]: def step(self, sim): """Update the associations between bubbles, actors, and agents""" - self._move_travelling_bubbles(sim) + self._move_traveling_bubbles(sim) self._cursors = self._sync_cursors(self._last_vehicle_index, sim.vehicle_index) self._handle_transitions(sim, self._cursors) self._last_vehicle_index = deepcopy(sim.vehicle_index) @@ -561,7 +561,7 @@ def _sync_cursors(self, last_vehicle_index, vehicle_index): v_radius + bubble.radius + bubble._bubble.margin, 2 ): cursor = Cursor.from_pos( - pos=point.as_shapely, + position=point.as_shapely, vehicle_id=vehicle.id, bubble=bubble, index=persisted_vehicle_index, @@ -594,10 +594,10 @@ def _handle_transitions(self, sim, cursors: Set[Cursor]): agent_id = BubbleManager._get_agent_id_from_cursor(cursor) sim.vehicle_exited_bubble(cursor.vehicle_id, agent_id, teardown) - def _move_travelling_bubbles(self, sim): + def _move_traveling_bubbles(self, sim): active_bubbles, inactive_bubbles = self._bubble_groups() for bubble in [*active_bubbles, *inactive_bubbles]: - if not bubble.is_travelling: + if not bubble.is_traveling: continue vehicles = [] @@ -615,7 +615,7 @@ def _move_travelling_bubbles(self, sim): vehicles += [vehicle] assert ( len(vehicles) <= 1 - ), "Travelling bubbles only support pinning to a single vehicle" + ), "Traveling bubbles only support pinning to a single vehicle" if len(vehicles) == 1: bubble.move_to_follow_vehicle(vehicles[0]) diff --git a/smarts/core/chassis.py b/smarts/core/chassis.py index 2b86d84830..da292d7447 100644 --- a/smarts/core/chassis.py +++ b/smarts/core/chassis.py @@ -682,7 +682,7 @@ def teardown(self): def control(self, throttle=0, brake=0, steering=0): """Apply throttle [0, 1], brake [0, 1], and steering [-1, 1] values for this - timestep. + time-step. """ self._last_control = (throttle, brake, steering) diff --git a/smarts/core/controllers/action_space_type.py b/smarts/core/controllers/action_space_type.py index e59f29079a..82879f806d 100644 --- a/smarts/core/controllers/action_space_type.py +++ b/smarts/core/controllers/action_space_type.py @@ -67,13 +67,13 @@ class ActionSpaceType(Enum): """ TargetPose = 4 """ - Action=(x_coord, y_coord, heading, time_delta). Type= ``Sequence[float, + Action=`(x_coord, y_coord, heading, time_delta)`. Type= ``Sequence[float, float, float, float]``. Continuous action space of vehicle's next x coordinate, y coordinate, heading, and time delta to reach the given pose. """ Trajectory = 5 """ - Action=([x_coord],[y_coord],[heading],[speed]). Type= ``(Sequence[float], + Action=`(x_coords, y_coords, headings, speeds)`. Type= ``(Sequence[float], Sequence[float], Sequence[float], Sequence[float])``. Continuous action space using trajectory comprising of x coordinates, y coordinates, headings, and speeds, to directly move a vehicle. @@ -85,7 +85,7 @@ class ActionSpaceType(Enum): """ MPC = 7 """ - Action=([x_coord],[y_coord],[heading],[speed]). Type= ``(Sequence[float], + Action=`(x_coords, y_coords, headings, speeds)`. Type= ``(Sequence[float], Sequence[float], Sequence[float], Sequence[float])``. Adaptive control performed on the vehicle model to match the given trajectory comprising of vehicle's x coordinates, y coordinates, headings, and speeds. diff --git a/smarts/core/controllers/trajectory_interpolation_controller.py b/smarts/core/controllers/trajectory_interpolation_controller.py index 84a77c256d..4046767fd5 100644 --- a/smarts/core/controllers/trajectory_interpolation_controller.py +++ b/smarts/core/controllers/trajectory_interpolation_controller.py @@ -98,7 +98,7 @@ def perform_action(cls, dt: float, vehicle, trajectory: np.ndarray): """Move vehicle by trajectory interpolation. If you want vehicle stop at a specific pose, - trajectory[TrajectoryField.TIME_INDEX][0] should be set as numpy.inf. + trajectory[:attr:`TrajectoryField.TIME_INDEX`][0] should be set as `numpy.inf`. Args: dt (float): the amount of time that is expected to pass between actions diff --git a/smarts/core/coordinates.py b/smarts/core/coordinates.py index 73eaee7a3a..a18bf84aa8 100644 --- a/smarts/core/coordinates.py +++ b/smarts/core/coordinates.py @@ -188,7 +188,13 @@ def as_dimensions(self) -> Dimensions: return Dimensions(length=self.length, width=self.width, height=self.height) def contains(self, pt: Point) -> bool: - """returnx True iff pt is fully within the bounding box. If any bbox coordinates are None, it's considered unbounded on that dimension/axis.""" + """Determines if the given point is within this bounding box. If any bounding box + coordinates are None, it is considered unbounded on that dimension/axis. + + Args: + pt (Point): The point to test against. + Returns: + True if pt is fully within the bounding box.""" return ( self.min_pt is None or (self.min_pt.x is None or self.min_pt.x < pt.x) @@ -344,7 +350,7 @@ def from_front_bumper(cls, front_bumper_position, heading, length) -> "Pose": """Convert from front bumper location to a Pose with center of vehicle. Args: - front_bumper_position: The (x, y) position of the centre front of the front bumper + front_bumper_position: The (x, y) position of the center front of the front bumper heading: The heading of the pose length: The length dimension of the object's physical bounds """ @@ -362,7 +368,7 @@ def from_front_bumper(cls, front_bumper_position, heading, length) -> "Pose": @classmethod def from_center(cls, base_position, heading: Heading): - """Convert from centred location + """Convert from centered location Args: base_position: The center of the object's bounds @@ -382,7 +388,7 @@ def from_center(cls, base_position, heading: Heading): @classmethod def from_explicit_offset( cls, - offset_from_centre, + offset_from_center, base_position: np.ndarray, heading: Heading, local_heading: Heading, @@ -390,7 +396,7 @@ def from_explicit_offset( """Convert from an explicit offset Args: - offset_from_centre: The offset away from the centre of the object's bounds + offset_from_center: The offset away from the center of the object's bounds heading: The heading of the pose base_position: The base position without offset local_heading: An additional orientation that re-faces the center offset @@ -403,11 +409,11 @@ def from_explicit_offset( # Calculate rotation on xy-plane only, given that fast_quaternion_from_angle is also on xy-plane vprime = np.array( [ - offset_from_centre[0] * np.cos(oprime) - - offset_from_centre[1] * np.sin(oprime), - offset_from_centre[0] * np.sin(oprime) - + offset_from_centre[1] * np.cos(oprime), - offset_from_centre[2], + offset_from_center[0] * np.cos(oprime) + - offset_from_center[1] * np.sin(oprime), + offset_from_center[0] * np.sin(oprime) + + offset_from_center[1] * np.cos(oprime), + offset_from_center[2], ] ) position = base_position + vprime @@ -451,7 +457,7 @@ def as_position2d(self) -> np.ndarray: return self.position[:2] def as_panda3d(self): - """Convert to panda3D (object bounds centre position, heading)""" + """Convert to panda3D (object bounds center position, heading)""" return (self.position, self.heading.as_panda3d) @classmethod diff --git a/smarts/core/lanepoints.py b/smarts/core/lanepoints.py index 35e6bd1f87..588266dfcb 100644 --- a/smarts/core/lanepoints.py +++ b/smarts/core/lanepoints.py @@ -72,7 +72,7 @@ class LanePoints: def __init__(self, shape_lps: List[LinkedLanePoint], spacing: float): # XXX: for a big map, may not want to cache ALL of the potential LanePoints # nor waste time here finding all of them. - # Lanepoints might be generated on demand based upon edges and lookahead. + # Lanepoints might be generated on demand based upon edges and look-ahead. self._linked_lanepoints = LanePoints._interpolate_shape_lanepoints( shape_lps, spacing ) @@ -101,9 +101,9 @@ def from_sumo( sumo_road_network, spacing, ): - """Computes the lane shape (start/shape/end) lanepoints for all lanes in + """Computes the lane shape (start/shape/end) lane-points for all lanes in the network, the result of this function can be used to interpolate - lanepoints along lanes to the desired granularity. + lane-points along lanes to the desired granularity. """ from smarts.core.utils.sumo import sumolib # isort:skip from sumolib.net.edge import Edge # isort:skip @@ -174,7 +174,7 @@ def _shape_lanepoints_along_lane( curr_lanepoint.nexts.append(linked_lanepoint) curr_lanepoint = linked_lanepoint - # Add a lanepoint for the last point of the current lane + # Add a lane-point for the last point of the current lane lane_width, _ = curr_lanepoint.lp.lane.width_at_offset(0) last_linked_lanepoint = LinkedLanePoint( lp=LanePoint( @@ -226,9 +226,9 @@ def from_opendrive( od_road_network, spacing, ): - """Computes the lane shape (start/shape/end) lanepoints for all lanes in + """Computes the lane shape (start/shape/end) lane-points for all lanes in the network, the result of this function can be used to interpolate - lanepoints along lanes to the desired granularity. + lane-points along lanes to the desired granularity. """ from .opendrive_road_network import OpenDriveRoadNetwork @@ -305,7 +305,7 @@ def _shape_lanepoints_along_lane( curr_lanepoint.nexts.append(linked_lanepoint) curr_lanepoint = linked_lanepoint - # Add a lanepoint for the last point of the current lane + # Add a lane-point for the last point of the current lane last_lane_coord = curr_lanepoint.lp.lane.to_lane_coord( Point(x=lane_shape[-1][0], y=lane_shape[-1][1], z=0.0) ) @@ -352,9 +352,9 @@ def _shape_lanepoints_along_lane( for road_id in roads: road = roads[road_id] - # go ahead and add lanepoints for composite lanes, + # go ahead and add lane-points for composite lanes, # even though we don't on other map formats, - # and then filter these out on lanepoint queries. + # and then filter these out on lane-point queries. # (not an issue right now for OpenDrive since we don't # find composite lanes, but it may be in the future.) for lane in road.lanes: @@ -373,9 +373,9 @@ def from_waymo( waymo_road_network, spacing, ): - """Computes the lane shape (start/shape/end) lanepoints for all lanes in + """Computes the lane shape (start/shape/end) lane-points for all lanes in the network, the result of this function can be used to interpolate - lanepoints along lanes to the desired granularity. + lane-points along lanes to the desired granularity. """ from .waymo_map import WaymoMap @@ -478,9 +478,9 @@ def _shape_lanepoints_along_lane( for road_id in roads: road = roads[road_id] - # go ahead and add lanepoints for composite lanes, + # go ahead and add lane-points for composite lanes, # even though we don't on other map formats, - # and then filter these out on lanepoint queries. + # and then filter these out on lane-point queries. for lane in road.lanes: # Ignore non drivable lanes in Waymo if lane.is_drivable: @@ -497,9 +497,9 @@ def from_argoverse( argoverse_map, spacing, ): - """Computes the lane shape (start/shape/end) lanepoints for all lanes in + """Computes the lane shape (start/shape/end) lane-points for all lanes in the network, the result of this function can be used to interpolate - lanepoints along lanes to the desired granularity. + lane-points along lanes to the desired granularity. """ from .argoverse_map import ArgoverseMap @@ -621,7 +621,7 @@ def _build_kd_tree(linked_lps: Sequence[LinkedLanePoint]) -> KDTree: def _interpolate_shape_lanepoints( shape_lanepoints: Sequence[LinkedLanePoint], spacing: float ) -> List[LinkedLanePoint]: - # memoize interpolated lanepoints on the shape lanepoint at start of + # memoize interpolated lane-points on the shape lane-point at start of # the line we are interpolating interp_memo = {} @@ -652,7 +652,7 @@ def _interpolate_from_shape_lp( continue first_linked_lanepoint = LinkedLanePoint( - lp=shape_lp.lp, # lanepoints are frozen, so no need to copy lp here + lp=shape_lp.lp, # lane-points are frozen, so no need to copy lp here nexts=[], is_inferred=False, ) @@ -702,19 +702,19 @@ def _process_interp_for_lane_lp( lane_seg_len = np.linalg.norm(lane_seg_vec) # We set the initial distance into the lane at `spacing` because - # we already have a lanepoint along this segment (curr_lanepoint) + # we already have a lane-point along this segment (curr_lanepoint) dist_into_lane_seg = spacing while dist_into_lane_seg < lane_seg_len: p = dist_into_lane_seg / lane_seg_len pos = shape_lp.lp.pose.as_position2d() + lane_seg_vec * p - # The thresholds for calculating last lanepoint. If the - # midpoint between the current lanepoint and the next shape - # lanepoint is less than the minimum distance then the last - # lanepoint position will be that midpoint. If the midpoint + # The thresholds for calculating last lane-point. If the + # midpoint between the current lane-point and the next shape + # lane-point is less than the minimum distance then the last + # lane-point position will be that midpoint. If the midpoint # is closer than last spacing threshold to the next shape - # lanepoint, then the last lanepoint will be the current - # lanepoint. + # lane-point, then the last lane-point will be the current + # lane-point. # XXX: the map scale should be taken into account here. last_spacing_threshold_dist = 0.8 * spacing minimum_dist_next_shape_lp = 1.4 @@ -781,7 +781,7 @@ def _closest_linked_lp_in_kd_tree_batched( ] if result: return result - # if filtering, only return lanepoints in composite lanes if we didn't hit any in simple lanes... + # if filtering, only return lane-points in composite lanes if we didn't hit any in simple lanes... return [[linked_lps[idx] for idx in idxs] for idxs in closest_indices] @staticmethod @@ -862,14 +862,14 @@ def closest_lanepoints( within_radius: float = 10, maximum_count: int = 10, ) -> List[LanePoint]: - """Get the lanepoints closest to the given pose. + """Get the lane-points closest to the given pose. Args: pose: - The pose to look around for lanepoints. + The pose to look around for lane-points. within_radius: - The radius which lanepoints can be found from the given pose. + The radius which lane-points can be found from the given pose. maximum_count: - The maximum lanepoints found. + The maximum number of lane-points that should be found. """ lanepoints = self._linked_lanepoints kd_tree = self._lanepoints_kd_tree @@ -884,13 +884,13 @@ def closest_lanepoints( return [l_lps.lp for l_lps in linked_lanepoints[0]] def closest_lanepoint_on_lane_to_point(self, point, lane_id: str) -> LanePoint: - """Returns the closest lanepoint on the given lane to the given world coordinate.""" + """Returns the closest lane-point on the given lane to the given world coordinate.""" return self.closest_linked_lanepoint_on_lane_to_point(point, lane_id).lp def closest_linked_lanepoint_on_lane_to_point( self, point: Point, lane_id: str ) -> LinkedLanePoint: - """Returns the closest linked lanepoint on the given lane.""" + """Returns the closest linked lane-point on the given lane.""" lane_kd_tree = self._lanepoints_kd_tree_by_lane_id[lane_id] return LanePoints._closest_linked_lp_in_kd_tree_batched( [point], self._lanepoints_by_lane_id[lane_id], lane_kd_tree, k=1 @@ -899,7 +899,7 @@ def closest_linked_lanepoint_on_lane_to_point( def closest_linked_lanepoint_on_road( self, point: Point, road_id: str ) -> LinkedLanePoint: - """Returns the closest linked lanepoint on the given road.""" + """Returns the closest linked lane-point on the given road.""" return LanePoints._closest_linked_lp_in_kd_tree_batched( [point], self._lanepoints_by_edge_id[road_id], @@ -910,16 +910,16 @@ def closest_linked_lanepoint_on_road( def paths_starting_at_lanepoint( self, lanepoint: LinkedLanePoint, lookahead: int, filter_edge_ids: tuple ) -> List[List[LinkedLanePoint]]: - """Returns all full branches from the given lanepoint up to the length of the lookahead. + """Returns all full branches from the given lane-point up to the length of the look-ahead. Args: - lanepoint: - The starting lanepoint. - lookahead: - The maximum lanepoints in a branch. - filter_edge_ids: + lanepoint (LinkedLanePoint): + The starting lane-point. + lookahead (int): + The maximum lane-points in a branch. + filter_edge_ids (Tuple[str]): Whitelisted edge ids. Returns: - All branches(as lists) stemming from the lanepoint. + All branches(as lists) stemming from the input lane-point. """ lanepoint_paths = [[lanepoint]] for _ in range(lookahead): diff --git a/smarts/core/local_traffic_provider.py b/smarts/core/local_traffic_provider.py index bd65a6a280..a06b60f1a5 100644 --- a/smarts/core/local_traffic_provider.py +++ b/smarts/core/local_traffic_provider.py @@ -709,22 +709,22 @@ def stay_put(self): @property def finished_route(self) -> bool: - """Returns True iff this vehicle has reached the end of its route.""" + """Returns True if this vehicle has reached the end of its route.""" return self._done_with_route @property def off_route(self) -> bool: - """Returns True iff this vehicle has left its route before it got to the end.""" + """Returns True if this vehicle has left its route before it got to the end.""" return self._off_route @property def wrong_way(self) -> bool: - """Returns True iff this vehicle is currently going the wrong way in its lane.""" + """Returns True if this vehicle is currently going the wrong way in its lane.""" return self._wrong_way @property def teleporting(self) -> bool: - """Returns True iff this vehicle is teleporting back to the beginning of its route on this step.""" + """Returns True if this vehicle is teleporting back to the beginning of its route on this step.""" return self._teleporting @property @@ -1146,10 +1146,10 @@ def _pick_lane(self, dt: float): if not can_cross: continue min_time_cush = float(self._vtype.get("tau", 1.0)) - neighbour_lane_bias = ( + neighbor_lane_bias = ( 0.1 * change_time * (1 if abs(self._lane.index - idx) == 1 else 0) ) - will_rearend = lw.ttc + neighbour_lane_bias < min_time_cush + will_rearend = lw.ttc + neighbor_lane_bias < min_time_cush # if my route destination is available, prefer that if ( lw.lane == self._dest_lane diff --git a/smarts/core/observations.py b/smarts/core/observations.py index 8c5eb7dd28..bf38326327 100644 --- a/smarts/core/observations.py +++ b/smarts/core/observations.py @@ -63,7 +63,7 @@ class EgoVehicleObservation(NamedTuple): id: str """Vehicle identifier.""" position: np.ndarray - """Center coordinate of the vehicle bounding box's bottom plane. shape=(3,). dtype=np.float64.""" + """Center coordinate of the vehicle bounding box's bottom plane. `shape=(3,)`. `dtype=np.float64`.""" bounding_box: Dimensions """Bounding box describing the length, width, and height, of the vehicle.""" heading: Heading @@ -151,20 +151,20 @@ class DrivableAreaGridMap(NamedTuple): class ViaPoint(NamedTuple): - """'Collectables' that can be placed within the simulation.""" + """'Collectibles' that can be placed within the simulation.""" position: Tuple[float, float] - """Location (x,y) of this collectable.""" + """Location (x,y) of this collectible.""" lane_index: float - """Lane index on the road this collectable is associated with.""" + """Lane index on the road this collectible is associated with.""" road_id: str - """Road id this collectable is associated with.""" + """Road id this collectible is associated with.""" required_speed: float - """Approximate speed required to collect this collectable.""" + """Approximate speed required to collect this collectible.""" class Vias(NamedTuple): - """Listing of nearby collectable ViaPoints and ViaPoints collected in the last step.""" + """Listing of nearby collectible ViaPoints and ViaPoints collected in the last step.""" near_via_points: List[ViaPoint] """Ordered list of nearby points that have not been hit.""" @@ -173,7 +173,7 @@ class Vias(NamedTuple): class SignalObservation(NamedTuple): - """Describes an observation of a traffic signal (light) on this timestep.""" + """Describes an observation of a traffic signal (light) on this time-step.""" state: SignalLightState """The state of the traffic signal.""" @@ -205,7 +205,7 @@ class Observation(NamedTuple): under_this_agent_control: bool """Whether this agent currently has control of the vehicle.""" neighborhood_vehicle_states: Optional[List[VehicleObservation]] - """List of neighbourhood vehicle states.""" + """List of neighborhood vehicle states.""" waypoint_paths: Optional[List[List[Waypoint]]] """Dynamic evenly-spaced points on the road ahead of the vehicle, showing potential routes ahead.""" distance_travelled: float @@ -213,7 +213,7 @@ class Observation(NamedTuple): road_waypoints: Optional[RoadWaypoints] """Per-road waypoints information.""" via_data: Vias - """Listing of nearby collectable ViaPoints and ViaPoints collected in the last step.""" + """Listing of nearby collectible ViaPoints and ViaPoints collected in the last step.""" # TODO: Convert to `NamedTuple` or only return point cloud. lidar_point_cloud: Optional[ Tuple[List[np.ndarray], List[bool], List[Tuple[np.ndarray, np.ndarray]]] @@ -227,4 +227,4 @@ class Observation(NamedTuple): top_down_rgb: Optional[TopDownRGB] = None """RGB camera observation.""" signals: Optional[List[SignalObservation]] = None - """List of nearby traffic signal (light) states on this timestep.""" + """List of nearby traffic signal (light) states on this time-step.""" diff --git a/smarts/core/opendrive_road_network.py b/smarts/core/opendrive_road_network.py index b590ba3e8a..953b1b0b09 100644 --- a/smarts/core/opendrive_road_network.py +++ b/smarts/core/opendrive_road_network.py @@ -689,7 +689,7 @@ def _compute_lane_intersections(self, od_element: OpenDriveElement): @property def source(self) -> str: - """This is the .xodr file of the OpenDRIVE map.""" + """This is the `.xodr` file of the OpenDRIVE map.""" return self._xodr_file def is_same_map(self, map_spec: MapSpec) -> bool: diff --git a/smarts/core/plan.py b/smarts/core/plan.py index 9718017eda..42a7e3a87f 100644 --- a/smarts/core/plan.py +++ b/smarts/core/plan.py @@ -180,7 +180,7 @@ def default_entry_tactic(default_entry_speed: Optional[float] = None) -> EntryTa @dataclass(frozen=True) class Via: - """Describes a collectable item that can be used to shape rewards.""" + """Describes a collectible item that can be used to shape rewards.""" lane_id: str road_id: str diff --git a/smarts/core/provider.py b/smarts/core/provider.py index 1680f3afa1..910559eb00 100644 --- a/smarts/core/provider.py +++ b/smarts/core/provider.py @@ -83,7 +83,7 @@ def filter(self, actor_ids): continue def intersects(self, actor_ids: Set[str]) -> bool: - """Returns True iff any of the actor_ids are contained in this ProviderState . + """Returns True if any of the actor_ids are contained in this ProviderState . Returns False for empty-set containment.""" provider_actor_ids = {a.actor_id for a in self.actors} intersection = actor_ids & provider_actor_ids @@ -151,7 +151,7 @@ def recovery_flags(self, flags: ProviderRecoveryFlags): raise NotImplementedError def set_manager(self, manager: ProviderManager): - """Indicate the manager that this provider should inform of all actor handoffs.""" + """Indicate the manager that this provider should inform of all actor hand-offs.""" raise NotImplementedError @property @@ -167,8 +167,8 @@ def step(self, actions, dt: float, elapsed_sim_time: float) -> ProviderState: """Progress the provider to generate new actor state. Args: actions: one or more valid actions from the supported action_spaces of this provider - dt: time (in seconds) to simulate during this simulation step - elapsed_sim_time: amount of time (in seconds) that's elapsed so far in the simulation + dt (float): time (in seconds) to simulate during this simulation step + elapsed_sim_time (float): amount of time (in seconds) that's elapsed so far in the simulation Returns: ProviderState representing the state of all actors this manages. """ @@ -243,7 +243,7 @@ def actor_ids(self) -> Iterable[str]: raise NotImplementedError def manages_actor(self, actor_id: str) -> bool: - """Returns True iff the actor referenced by actor_id is managed by this Provider.""" + """Returns True if the actor referenced by actor_id is managed by this Provider.""" raise NotImplementedError def stop_managing(self, actor_id: str): diff --git a/smarts/core/remote_agent_buffer.py b/smarts/core/remote_agent_buffer.py index 1fa7d4a990..96120ada6c 100644 --- a/smarts/core/remote_agent_buffer.py +++ b/smarts/core/remote_agent_buffer.py @@ -117,7 +117,7 @@ def _stop_servers(self, *args): sys.exit(0) def destroy(self): - """Teardown any remaining remote agents and the local zoo manager (if it exists.)""" + """Tear-down any remaining remote agents and the local zoo manager (if it exists.)""" for remote_agent_future in self._agent_buffer: try: remote_agent = remote_agent_future.result() @@ -245,18 +245,22 @@ def spawn_local_zoo_manager(port): def get_manager_channel_stub(addr: Tuple[str, int], timeout: float = 10): - """Connects to the gRPC server at `addr` and returns the channel and stub. + """Connects to the `gRPC` server at `addr` and returns the channel and stub. + + .. spelling:word-list:: + + grpc Args: - addr (Tuple[str,int]): gRPC server address. - timeout (float, optional): Time to wait for the gRPC server to be ready. Defaults to 10. + addr (Tuple[str,int]): `gRPC` server address. + timeout (float, optional): Time to wait for the `gRPC` server to be ready. Defaults to 10. Raises: - RemoteAgentException: If timeout occurs while connecting to the gRPC server. + RemoteAgentException: If timeout occurs while connecting to the `gRPC` server. Returns: - grpc.Channel: Channel to the gRPC server. - manager_pb2_grpc.ManagerStub : gRPC stub. + grpc.Channel: Channel to the `gRPC` server. + :spelling:ignore:`manager_pb2_grpc.ManagerStub`: `gRPC` stub. """ channel = grpc.insecure_channel(f"{addr[0]}:{addr[1]}") try: diff --git a/smarts/core/renderer_base.py b/smarts/core/renderer_base.py index 3f50b4ce68..a4aba458b5 100644 --- a/smarts/core/renderer_base.py +++ b/smarts/core/renderer_base.py @@ -172,5 +172,5 @@ def build_offscreen_camera( height: int, resolution: float, ) -> OffscreenCamera: - """Generates a new offscreen camera.""" + """Generates a new off-screen camera.""" raise NotImplementedError diff --git a/smarts/core/road_map.py b/smarts/core/road_map.py index 86fe07ce74..34acda68e5 100644 --- a/smarts/core/road_map.py +++ b/smarts/core/road_map.py @@ -85,7 +85,7 @@ def is_same_map(self, map_spec) -> bool: raise NotImplementedError def to_glb(self, glb_dir: str): - """Build a glb file for camera rendering and envision""" + """Build a `.glb` file for camera rendering and envision""" raise NotImplementedError() def surface_by_id(self, surface_id: str) -> Optional[RoadMap.Surface]: @@ -172,8 +172,8 @@ def random_route( :param max_route_len: The total number of roads in the route. :param starting_road: If specified, the route will start with this road. - :param only_drivable: If True, will restrict the route to only driveable roads; - otherwise can incl. non-drivable roads (such as bikelanes) too. + :param only_drivable: If True, will restrict the route to only drive-able roads; + otherwise can incl. non-drivable roads (such as bike lanes) too. :return: A randomly generated route. """ raise NotImplementedError() @@ -205,7 +205,7 @@ def waypoint_paths( route: RoadMap.Route = None, ) -> List[List[Waypoint]]: """Computes equally-spaced Waypoints for all lane paths - up to lookahead waypoints ahead, starting on the Road containing + up to `lookahead` waypoints ahead, starting on the Road containing the nearest Lane aligned with the vehicle's pose within within_radius meters. Constrains paths to the supplied route if specified.""" raise NotImplementedError() @@ -372,7 +372,7 @@ def waypoint_paths_for_pose( self, pose: Pose, lookahead: int, route: RoadMap.Route = None ) -> List[List[Waypoint]]: """Computes equally-spaced Waypoints for all lane paths - up to lookahead waypoints ahead, starting in this lane at pose. + up to `lookahead` waypoints ahead, starting in this lane at pose. Constrains paths to the supplied route if specified.""" raise NotImplementedError() @@ -380,7 +380,7 @@ def waypoint_paths_at_offset( self, offset: float, lookahead: int = 30, route: RoadMap.Route = None ) -> List[List[Waypoint]]: """Computes equally-spaced Waypoints for all lane paths - up to lookahead waypoints ahead, starting offset into this lane. + up to `lookahead` waypoints ahead, starting offset into this lane. Constrains paths to the supplied route if specified.""" raise NotImplementedError() @@ -467,7 +467,7 @@ def center_pose_at_point(self, point: Point) -> Pose: def curvature_radius_at_offset( self, offset: float, lookahead: int = 5 ) -> float: - """lookahead (in meters) is the size of the window to use + """`lookahead` (in meters) is the size of the window to use to compute the curvature, which must be at least 1 to make sense. This may return math.inf if the lane is straight.""" assert lookahead > 0 @@ -621,7 +621,7 @@ def geometry(self) -> List[Point]: @property def is_dynamic(self) -> bool: - """True iff this feature has dynamic state (such as a traffic light); False otherwise.""" + """True if this feature has dynamic state (such as a traffic light); False otherwise.""" # this may be overridden in the case of custom feature types return self.type == RoadMap.FeatureType.FIXED_LOC_SIGNAL @@ -631,7 +631,7 @@ def type_specific_info(self) -> Optional[Any]: return None def min_dist_from(self, point: Point) -> float: - """Returns the euclidian (as-the-crow-flies) distance + """Returns the euclidean (as-the-crow-flies) distance between point and the nearest part of this feature.""" raise NotImplementedError() @@ -745,7 +745,7 @@ class Waypoint: lane_index: int """Index of the lane under this waypoint. Right most lane has index 0 and index increases to the left.""" lane_offset: float - """Longitudinal distance along lane centerline of this waypoint.""" + """Longitudinal distance along lane center-line of this waypoint.""" def __eq__(self, other) -> bool: if not isinstance(other, Waypoint): @@ -822,11 +822,11 @@ def __init__(self, lane_id: str, road_map): @property def center_polyline(self) -> List[Point]: - """Should return a list of the points along the centerline + """Should return a list of the points along the center-line of the lane, in the order they will be encountered in the direction of travel. - Note: not all instantiations will be able to implement this method, + Note: not all map types will be able to implement this method, so use with care. This was added to support those that wish to make use of the SegmentCache class below.""" raise NotImplementedError() diff --git a/smarts/core/route_cache.py b/smarts/core/route_cache.py index 5e84c41d40..41093486eb 100644 --- a/smarts/core/route_cache.py +++ b/smarts/core/route_cache.py @@ -64,7 +64,9 @@ def _add_road(self, road: RoadMap.Road): @cached_property def road_ids(self) -> List[str]: - """Retruns a list of the road_ids for the Roads in this Route.""" + """Get the road IDs for this route. + Returns: + (List[str]): A list of the road IDs for the Roads in this Route.""" return [road.road_id for road in self.roads] @classmethod @@ -104,13 +106,13 @@ def is_cached(self) -> bool: return self._cache_key in _route_sub_lengths def remove_from_cache(self): - """Remove informationa about this Route from the cache.""" + """Remove information about this Route from the cache.""" if self.is_cached: del _route_sub_lengths[self._cache_key] # TAI: could pre-cache curvatures here too (like waypoints) ? def add_to_cache(self): - """Add informationa about this Route to the cache if not already there.""" + """Add information about this Route to the cache if not already there.""" if self.is_cached: return diff --git a/smarts/core/scenario.py b/smarts/core/scenario.py index faf77c99d5..dc3d9d6903 100644 --- a/smarts/core/scenario.py +++ b/smarts/core/scenario.py @@ -88,16 +88,16 @@ class Scenario: Args: scenario_root: - The scenario asset folder ie. './scenarios/trigger'. + The scenario asset folder (i.e. './scenarios/trigger'.) traffic_specs: The social vehicle traffic specs. missions: agent_id to mission mapping. map_spec: - If specified, allows specifying a MapSpec at run-time + If specified, allows specifying a :class:`~smarts.sstudio.types.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 sstudio.types.MapSpec definition. + Also see comments around the :class:`~smarts.sstudio.types.map_spec.MapSpec` definition. """ def __init__( @@ -180,7 +180,7 @@ def scenario_variations( """Generate a cycle of scenario configurations. Args: - scenarios_or_scenarios_dirs: + scenarios_or_scenarios_dirs (Sequence[str]): A sequence of either the scenario to run (see scenarios/ for some samples you can use) OR a directory of scenarios to sample from. agents_to_be_briefed: @@ -482,9 +482,9 @@ def discover_map( scenarios_root: A specific scenario to run (e.g. scenarios/sumo/loop) lanepoint_spacing: - The distance between lanepoints that represent a lane's geometry. + The distance between lane-points that represent a lane's geometry. default_lane_width: - The default width of a lane from its centre if it does not have a specific width. + The default width of a lane from its center if it does not have a specific width. shift_to_origin: Shifts the map location to near the simulation origin so that the map contains (0, 0). Returns: @@ -620,11 +620,11 @@ def discover_missions_of_traffic_histories(self) -> Dict[str, Mission]: return vehicle_missions def create_dynamic_traffic_history_mission( - self, veh_id: str, trigger_time: float, positional_radius: int + self, vehicle_id: str, trigger_time: float, positional_radius: int ) -> Tuple[Mission, Mission]: """Builds missions out of the given vehicle information. Args: - veh_id: + vehicle_id: The id of a vehicle in the traffic history dataset. trigger_time: The time that this mission should become active. @@ -635,8 +635,8 @@ def create_dynamic_traffic_history_mission( original vehicle's travel as well as a traverse style mission which is done when the vehicle leaves the map. """ - start, speed = self.get_vehicle_start_at_time(veh_id, trigger_time) - veh_goal = self.get_vehicle_goal(veh_id) + start, speed = self.get_vehicle_start_at_time(vehicle_id, trigger_time) + veh_goal = self.get_vehicle_goal(vehicle_id) entry_tactic = default_entry_tactic(speed) # create a positional mission and a traverse mission positional_mission = Mission( @@ -919,7 +919,7 @@ def plane_filepath(self) -> str: @property def vehicle_filepath(self) -> Optional[str]: - """The filepath of the vehicle's physics model.""" + """The file-path of the vehicle's physics model.""" if not os.path.isdir(self._root): return None for fname in os.listdir(self._root): @@ -967,7 +967,7 @@ def route_files_enabled(self): @property def route_filepath(self): - """The filepath to the traffic route file.""" + """The file-path to the traffic route file.""" warnings.warn( "Scenario route_filepath property has been deprecated in favor of traffic_specs. Please update your code.", category=DeprecationWarning, @@ -977,12 +977,12 @@ def route_filepath(self): @property def map_glb_filepath(self): - """The map geometry filepath.""" + """The map geometry file-path.""" return os.path.join(self._root, "build", "map", "map.glb") @property def map_glb_metadata(self): - """The metadata for the current map glb file.""" + """The metadata for the current map `.glb` file.""" metadata = self.map_glb_meta_for_file(self.map_glb_filepath) return metadata diff --git a/smarts/core/sensor.py b/smarts/core/sensor.py index 3e04bec9c7..d1e7070358 100644 --- a/smarts/core/sensor.py +++ b/smarts/core/sensor.py @@ -642,7 +642,7 @@ def mutable(self) -> bool: class ViaSensor(Sensor): - """Tracks collection of ViaPoint collectables""" + """Tracks collection of ViaPoint collectibles""" def __init__(self, lane_acquisition_range, speed_accuracy): self._consumed_via_points = set() diff --git a/smarts/core/sensor_manager.py b/smarts/core/sensor_manager.py index 817121be89..d8bd229d03 100644 --- a/smarts/core/sensor_manager.py +++ b/smarts/core/sensor_manager.py @@ -96,11 +96,11 @@ def observe( The current state from the simulation. sim_local_constants (SimulationLocalConstants): The values that should stay the same for a simulation over a reset. - agent_ids ({str, ...}): + agent_ids (Set[str]): The agent ids to process. - renderer_ref (Optional[RendererBase]): + renderer_ref (RendererBase): The renderer (if any) that should be used. - physics_ref (bc.BulletClient): + physics_ref: The physics client. """ observations, dones, updated_sensors = self._sensor_resolver.observe( diff --git a/smarts/core/sensors/parallel_sensor_resolver.py b/smarts/core/sensors/parallel_sensor_resolver.py index 1635118e99..04ba8c6069 100644 --- a/smarts/core/sensors/parallel_sensor_resolver.py +++ b/smarts/core/sensors/parallel_sensor_resolver.py @@ -67,7 +67,7 @@ def observe( The agent ids to process. renderer (Optional[Renderer]): The renderer (if any) that should be used. - bullet_client (bc.BulletClient): + bullet_client: The physics client. """ observations, dones, updated_sensors = {}, {}, defaultdict(dict) @@ -241,7 +241,7 @@ def deserialize(self): class ProcessWorker: - """A utility class that defines a persistant worker which will continue to operate in the background.""" + """A utility class that defines a persistent worker which will continue to operate in the background.""" class WorkerDone: """The done signal for a worker.""" @@ -270,7 +270,7 @@ def _do_work(cls, state): def _on_request(cls, state: Dict, request: Request) -> bool: """ Args: - state: The persistant state on the worker + state: The persistent state on the worker request: A request made to the worker. Returns: diff --git a/smarts/core/signals.py b/smarts/core/signals.py index e4e5354d6a..d0ac8bef0f 100644 --- a/smarts/core/signals.py +++ b/smarts/core/signals.py @@ -28,7 +28,7 @@ class SignalLightState(IntFlag): """States that a traffic signal light may take; - note that these may be combined into a bitmask.""" + note that these may be combined into a bit-mask.""" UNKNOWN = 0 OFF = 0 diff --git a/smarts/core/smarts.py b/smarts/core/smarts.py index b94666110b..e429e2e195 100644 --- a/smarts/core/smarts.py +++ b/smarts/core/smarts.py @@ -102,7 +102,7 @@ class SMARTS(ProviderManager): visdom (Union[bool, Any], optional): Deprecated. Use SMARTS_VISDOM_ENABLED. A visdom client for connecting to a visdom visualization server. fixed_timestep_sec (Optional[float], optional): The fixed timestep that will be default if time is not otherwise specified at step. Defaults to 0.1. reset_agents_only (bool, optional): When specified the simulation will continue use of the current scenario. Defaults to False. - zoo_addrs (Optional[Tuple[str, int]], optional): The (ip:port) values of remote agent workers for externally hosted agents. Defaults to None. + zoo_addrs (Optional[Tuple[str, int]], optional): The `{ip:port}` values of remote agent workers for externally hosted agents. Defaults to None. external_provider (bool, optional): Creates a special provider `SMARTS.external_provider` that allows for inserting state. Defaults to False. """ @@ -243,7 +243,7 @@ def step( Overrides the simulation step length. Progress simulation time by the given amount. Note the time_delta_since_last_step param is in (nominal) seconds. Returns: - observations, rewards, dones, infos + Tuple[observations, rewards, dones, infos]: The simulation step return. """ if not self._is_setup: raise SMARTSNotSetupError("Must call reset() or setup() before stepping.") @@ -1092,7 +1092,7 @@ def version(self) -> str: return VERSION def teardown_social_agents(self, agent_ids: Iterable[str]): - """Teardown agents in the given sequence. + """Tear-down agents in the given sequence. Args: agent_ids: A sequence of agent ids to terminate and release. @@ -1106,7 +1106,7 @@ def teardown_social_agents(self, agent_ids: Iterable[str]): self.agent_manager.teardown_social_agents(filter_ids=agents_to_teardown) def teardown_social_agents_without_actors(self, agent_ids: Iterable[str]): - """Teardown agents in the given list that have no actors registered as + """Tear-down agents in the given list that have no actors registered as controlled-by or shadowed-by (for each given agent.) Args: @@ -1400,7 +1400,7 @@ def timestep_sec(self) -> float: @property def fixed_timestep_sec(self) -> float: - """The simulation fixed timestep.""" + """The simulation fixed time-step.""" # May be None if time deltas are externally driven return self._fixed_timestep_sec diff --git a/smarts/core/sumo_road_network.py b/smarts/core/sumo_road_network.py index bbaf4dce52..cb800a8c78 100644 --- a/smarts/core/sumo_road_network.py +++ b/smarts/core/sumo_road_network.py @@ -49,7 +49,7 @@ class SumoRoadNetwork(RoadMap): DEFAULT_LANE_WIDTH = 3.2 """3.2 is the default Sumo road network lane width if it's not specified - explicitly in Sumo's NetEdit or the map.net.xml file. + explicitly in Sumo's NetEdit or the `map.net.xml` file. This corresponds on a 1:1 scale to lanes 3.2m wide, which is typical in North America (although US highway lanes are wider at ~3.7m).""" @@ -188,7 +188,7 @@ def _load_traffic_lights(self): @property def source(self) -> str: - """This is the net.xml file that corresponds with our possibly-offset coordinates.""" + """This is the `.net.xml` file that corresponds with our possibly-offset coordinates.""" return self._net_file @staticmethod diff --git a/smarts/core/sumo_traffic_simulation.py b/smarts/core/sumo_traffic_simulation.py index dfa536d1ef..abc7a00a5c 100644 --- a/smarts/core/sumo_traffic_simulation.py +++ b/smarts/core/sumo_traffic_simulation.py @@ -68,12 +68,12 @@ class SumoTrafficSimulation(TrafficProvider): The port that sumo will attempt to run on. auto_start: False to pause simulation when SMARTS runs, and wait for user to click - start on sumo-gui. + start on `sumo-gui`. allow_reload: Reset SUMO instead of restarting SUMO when the current map is the same as the previous. remove_agents_only_mode: Remove only agent vehicles used by SMARTS and not delete other SUMO - vehicles when the traffic simulation calls teardown + vehicles when the traffic simulation calls to tear-down """ _HAS_DYNAMIC_ATTRIBUTES = True @@ -656,7 +656,7 @@ def update_route_for_vehicle(self, vehicle_id: str, new_route: RoadMap.Route): Any sumo-special roads (e.g., junction) are removed from the new route before setting it because Sumo doesn't allow specifying these - in the call to its setRoute() and will raise an exception otherwise.""" + in the call to its `vehicle.setRoute()` and will raise an exception otherwise.""" if not self.connected: return old_route = self._route_for_vehicle(vehicle_id) diff --git a/smarts/core/tests/test_bubble_manager.py b/smarts/core/tests/test_bubble_manager.py index f0e81fbd6e..a3883c4f67 100644 --- a/smarts/core/tests/test_bubble_manager.py +++ b/smarts/core/tests/test_bubble_manager.py @@ -41,7 +41,7 @@ HEADING_CONSTANT = Heading(-math.pi / 2) -# TODO: Add test for travelling bubbles +# TODO: Add test for traveling bubbles @pytest.fixture diff --git a/smarts/core/tests/test_coordinates.py b/smarts/core/tests/test_coordinates.py index caf778b855..973dd7d10d 100644 --- a/smarts/core/tests/test_coordinates.py +++ b/smarts/core/tests/test_coordinates.py @@ -126,7 +126,7 @@ def test_conversion_bullet(original_pose): offset_to_center = np.array(offset_to_center) base_position = np.sum([position_offset, original_pose.position], axis=0) p_from_explicit_offset = Pose.from_explicit_offset( - offset_from_centre=offset_to_center, + offset_from_center=offset_to_center, base_position=base_position, heading=heading, local_heading=Heading(0), diff --git a/smarts/core/tire_models.py b/smarts/core/tire_models.py index 556996dd2b..91cb8606e5 100644 --- a/smarts/core/tire_models.py +++ b/smarts/core/tire_models.py @@ -172,7 +172,7 @@ def build_tire_model(stiffness, tire_model_type, road_friction): class LinearTireForces(TireForces): - """A linear forces implemention of a tire model.""" + """A linear forces implementation of a tire model.""" def _calculate_tire_forces(self, chassis, client, action): diff --git a/smarts/core/traffic_history.py b/smarts/core/traffic_history.py index 2ffd61ca58..afe7c021c1 100644 --- a/smarts/core/traffic_history.py +++ b/smarts/core/traffic_history.py @@ -61,7 +61,7 @@ def name(self) -> str: def connect_for_multiple_queries(self): """Optional optimization to avoid the overhead of parsing - the sqlite file header multiple times for clients that + the `sqlite` file header multiple times for clients that will be performing multiple queries. If used, then disconnect() should be called when finished.""" if not self._db_cnxn: diff --git a/smarts/core/utils/bullet.py b/smarts/core/utils/bullet.py index 10a495fab2..29cab194c4 100644 --- a/smarts/core/utils/bullet.py +++ b/smarts/core/utils/bullet.py @@ -29,7 +29,7 @@ class BulletClient: - """This wrapper class is a hack for macOS where running PyBullet in GUI mode, + """This wrapper class is a hack for `macOS` where running PyBullet in GUI mode, alongside Panda3D segfaults. It seems due to running two OpenGL applications in the same process. Here we spawn a process to run PyBullet and forward all calls to it over unix pipes. diff --git a/smarts/core/utils/custom_exceptions.py b/smarts/core/utils/custom_exceptions.py index 24f226a59c..1717350f72 100644 --- a/smarts/core/utils/custom_exceptions.py +++ b/smarts/core/utils/custom_exceptions.py @@ -44,7 +44,7 @@ def required_to(cls, thing): class OpenDriveException(Exception): - """An exception raised if opendrive utilities are required but not available.""" + """An exception raised if `opendrive` utilities are required but not available.""" @classmethod def required_to(cls, thing): diff --git a/smarts/core/utils/episodes.py b/smarts/core/utils/episodes.py index 338a1f9960..84bd511a42 100644 --- a/smarts/core/utils/episodes.py +++ b/smarts/core/utils/episodes.py @@ -119,12 +119,12 @@ def wall_time(self): @property def sim_time(self): - """An estimation of the total fixed-timestep simulation performed.""" + """An estimation of the total fixed-time-step simulation performed.""" return self.fixed_timestep_sec * self.steps @property def sim2wall_ratio(self): - """The ration of sim time to wall time. Above 1 is hyper-realtime.""" + """The ration of sim time to wall time. Above 1 is hyper-real-time.""" return self.sim_time / self.wall_time @property diff --git a/smarts/core/utils/file.py b/smarts/core/utils/file.py index 67cd03af5e..0841fcee5f 100644 --- a/smarts/core/utils/file.py +++ b/smarts/core/utils/file.py @@ -68,7 +68,7 @@ def replace(obj: Any, **kwargs): def isdataclass(x): - """Check if an object is a dataclass.""" + """Check if an object is a `dataclass`.""" return dataclasses.is_dataclass(x) diff --git a/smarts/core/utils/frame_monitor.py b/smarts/core/utils/frame_monitor.py index 80e462ca0b..3f48c0959c 100644 --- a/smarts/core/utils/frame_monitor.py +++ b/smarts/core/utils/frame_monitor.py @@ -31,12 +31,12 @@ def __str__(self): @classmethod def below_threshold(cls, desired_fps, delta): - """Generate a framerate exception. + """Generate a frame-rate exception. Args: desired_fps: The intended fps. delta: The frame time taken. Returns: - A new framerate exception. + A new frame-rate exception. """ return cls( f"The frame rate decreased, lower than the desired threshold, \ diff --git a/smarts/core/utils/kinematics.py b/smarts/core/utils/kinematics.py index 5546ce9d40..d18203fb03 100644 --- a/smarts/core/utils/kinematics.py +++ b/smarts/core/utils/kinematics.py @@ -23,7 +23,7 @@ def time_to_cover(dist: float, speed: float, acc: float = 0.0) -> float: """ - Returns the time for a moving object travelling at + Returns the time for a moving object traveling at speed and accelerating at acc to cover distance dist. Assumes that all units are consistent (for example, if distance is in meters, speed is in m/s). @@ -55,7 +55,7 @@ def time_to_cover(dist: float, speed: float, acc: float = 0.0) -> float: def distance_covered(time: float, speed: float, acc: float = 0.0) -> float: """ Returns the amount of distance covered by an object - moving at speed and acceerating with acc. + moving at speed and accelerating with acc. Assumes that all units are consistent (for example, if distance is in meters, speed is in m/s). """ diff --git a/smarts/core/utils/logging.py b/smarts/core/utils/logging.py index c46cc8d23c..5d6aca1c04 100644 --- a/smarts/core/utils/logging.py +++ b/smarts/core/utils/logging.py @@ -50,7 +50,7 @@ def timeit(name: str, log): def isnotebook(): - """Determines if executing in ipython (Jupyter Notebook)""" + """Determines if executing in ipython (`Jupyter` Notebook)""" try: shell = get_ipython().__class__.__name__ # pytype: disable=name-error if shell == "ZMQInteractiveShell" or "google.colab" in sys.modules: @@ -72,7 +72,7 @@ def isnotebook(): def try_fsync(fd): - """Attempts to see if fsync will work. Workaround for error on Github Actions.""" + """Attempts to see if `fsync` will work. Workaround for error on GitHub Actions.""" try: os.fsync(fd) except OSError: @@ -83,9 +83,15 @@ def try_fsync(fd): @contextmanager def suppress_output(stderr=True, stdout=True): """Attempts to suppress console print statements. + + .. spelling:word-list:: + + stderr + stdout + Args: - stderr: Suppress stderr. - stdout: Suppress stdout. + stderr: Suppress `stderr`. + stdout: Suppress `stdout`. """ cleanup_stderr = None cleanup_stdout = None @@ -169,8 +175,8 @@ def suppress_websocket(): def diff_unpackable(obj, other_obj): - """Do an asserted comparision of an object that is able to be unpacked. This works with nested collections: - dictionaries, namedtuples, tuples, lists, numpy arrays, and dataclasses. + """Do an asserted comparison of an object that is able to be unpacked. This works with nested collections: + dictionaries, named-tuples, tuples, lists, numpy arrays, and dataclasses. Raises: AssertionError: if objects do not match. diff --git a/smarts/core/utils/math.py b/smarts/core/utils/math.py index 6891399652..de2b339aee 100644 --- a/smarts/core/utils/math.py +++ b/smarts/core/utils/math.py @@ -67,8 +67,9 @@ def constrain_angle(angle: float) -> float: def batches(list_, n): """Split an indexable container into `n` batches. - :param list_: The iterable to split into parts - :param n: The number of batches + Args: + list: The iterable to split into parts + n: The number of batches """ for i in range(0, len(list_), n): yield list_[i : i + n] @@ -77,9 +78,9 @@ def batches(list_, n): def yaw_from_quaternion(quaternion) -> float: """Converts a quaternion to the yaw value. Args: - np.narray: np.array([x, y, z, w]) + quaternion (np.ndarray): np.array([x, y, z, w]) Returns: - A float angle in radians. + float: A angle in radians. """ assert len(quaternion) == 4, f"len({quaternion}) != 4" siny_cosp = 2 * (quaternion[0] * quaternion[1] + quaternion[3] * quaternion[2]) @@ -98,7 +99,7 @@ def fast_quaternion_from_angle(angle: float) -> np.ndarray: Args: angle: An angle in radians. Returns: - np.ndarray: np.array([x, y, z, w]) + (np.ndarray): np.array([x, y, z, w]) """ half_angle = angle * 0.5 @@ -151,7 +152,7 @@ def get_linear_segments_for_range( def squared_dist(a, b) -> float: """Computes the squared distance between a and b. Args: - a, b: same dimension numpy.array([..]) + a, b: same dimensions shaped `numpy` arrays. Returns: float: dist**2 """ @@ -290,17 +291,19 @@ def circular_mean(vectors: Sequence[np.ndarray]) -> float: ) -def is_close(a: float, b: float, rel_tol: float = 1e-09, abs_tol: float = 0.0) -> bool: +def is_close( + a: float, b: float, rel_tolerance: float = 1e-09, abs_tolerance: float = 0.0 +) -> bool: """Determines if two values are close as defined by the inputs. Args: a: The first value. b: The other value. - rel_tol: Difference required to be close relative to the magnitude - abs_tol: Absolute different allowed to be close. + rel_tolerance: Difference required to be close relative to the magnitude + abs_tolerance: Absolute different allowed to be close. Returns: If the two values are "close". """ - return abs(a - b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) + return abs(a - b) <= max(rel_tolerance * max(abs(a), abs(b)), abs_tolerance) def rotate_cw_around_point(point, radians, origin=(0, 0)) -> np.ndarray: @@ -518,7 +521,7 @@ def round_param_for_dt(dt: float) -> int: def rounder_for_dt(dt: float) -> Callable[[float], float]: - """Return a rounding function appropriate for timestepping.""" + """Return a rounding function appropriate for time-stepping.""" rp = round_param_for_dt(dt) return lambda f: round(f, rp) @@ -615,7 +618,7 @@ def combination_pairs_with_unique_indices( first_group, second_group, second_group_default=None ): """Generates sets of combinations that use up all of the first group and at least as many of - the second group. If len(first_group) > len(second_group) the second group is padded. Groups + the second group. If `len(first_group) > len(second_group)` the second group is padded. Groups are combined using only unique indices per result. The value at an index in one group is matched to the value at an index in from the second group. Duplicate results only appear when element values repeat one of the base groups. diff --git a/smarts/core/vehicle.py b/smarts/core/vehicle.py index 890f04014c..449ad9cdee 100644 --- a/smarts/core/vehicle.py +++ b/smarts/core/vehicle.py @@ -220,7 +220,7 @@ def bounding_box(self) -> List[np.ndarray]: """The minimum fitting heading aligned bounding box. Four 2D points representing the minimum fitting box.""" # XXX: this doesn't return a smarts.core.coordinates.BoundingBox! self._assert_initialized() - # Assuming the position is the centre, + # Assuming the position is the center, # calculate the corner coordinates of the bounding_box origin = self.position[:2] dimensions = np.array([self.width, self.length]) diff --git a/smarts/core/vehicle_index.py b/smarts/core/vehicle_index.py index fe1c1857b4..0ca5057b08 100644 --- a/smarts/core/vehicle_index.py +++ b/smarts/core/vehicle_index.py @@ -17,6 +17,12 @@ # 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. +""" +.. spelling:word-list:: + + shadower + shadowers +""" import logging from copy import copy, deepcopy from io import StringIO @@ -227,7 +233,7 @@ def owner_id_from_vehicle_id(self, vehicle_id) -> Optional[str]: @cache def shadower_id_from_vehicle_id(self, vehicle_id) -> Optional[str]: - """Find the first shadower watching a vehicle.""" + """Find the first shadowing entity watching a vehicle.""" vehicle_id = _2id(vehicle_id) shadower_ids = self._controlled_by[ @@ -241,7 +247,7 @@ def shadower_id_from_vehicle_id(self, vehicle_id) -> Optional[str]: @cache def shadower_ids(self) -> Set[str]: - """Get all current shadowers.""" + """Get all current shadowing entity IDs.""" return set( self._2id_to_id[sa_id] for sa_id in self._controlled_by["shadower_id"] diff --git a/smarts/core/vehicle_state.py b/smarts/core/vehicle_state.py index 9eb04a1859..f1c34fc4ef 100644 --- a/smarts/core/vehicle_state.py +++ b/smarts/core/vehicle_state.py @@ -139,7 +139,7 @@ def bounding_box_points( Tuple[float, float], ]: """The minimum fitting heading aligned bounding box. Four 2D points representing the minimum fitting box.""" - # Assuming the position is the centre, + # Assuming the position is the center, # calculate the corner coordinates of the bounding_box origin = self.pose.position[:2] dimensions = np.array([self.dimensions.width, self.dimensions.length]) diff --git a/smarts/core/waymo_map.py b/smarts/core/waymo_map.py index 39ba80536c..cc615cefc1 100644 --- a/smarts/core/waymo_map.py +++ b/smarts/core/waymo_map.py @@ -960,7 +960,7 @@ def scale_factor(self) -> float: return 1.0 # TODO def to_glb(self, glb_dir): - """Build a glb file for camera rendering and envision.""" + """Build a `.glb` file for camera rendering and envision.""" polygons = [] for lane_id, lane in self._lanes.items(): metadata = { diff --git a/smarts/env/custom_observations.py b/smarts/env/custom_observations.py index 1e3823e455..4c305925d9 100644 --- a/smarts/env/custom_observations.py +++ b/smarts/env/custom_observations.py @@ -159,7 +159,7 @@ def lane_ttc(obs: Observation) -> Dict[str, np.ndarray]: + angle_error: Ego heading relative to the closest waypoint. Shape=(1,). + speed: Ego speed. Shape=(1,). + steering: Ego steering. Shape=(1,). - + ego_ttc: Time to collision in each lane. Shape=(3,). + + :spelling:ignore:`ego_ttc`: Time to collision in each lane. Shape=(3,). + ego_lane_dist: Closest cars’ distance to ego in each lane. Shape=(3,). """ ego = obs.ego_vehicle_state diff --git a/smarts/env/gymnasium/driving_smarts_2022_env.py b/smarts/env/gymnasium/driving_smarts_2022_env.py index e3e15118cd..c47b4650d3 100644 --- a/smarts/env/gymnasium/driving_smarts_2022_env.py +++ b/smarts/env/gymnasium/driving_smarts_2022_env.py @@ -111,7 +111,7 @@ def driving_smarts_2022_env( Envision. Defaults to False. seed (int, optional): Random number generator seed. Defaults to 42. visdom (bool, optional): If True, enables visualization of observed - RGB images in Visdom. Defaults to False. + RGB images in `visdom`. Defaults to False. sumo_headless (bool, optional): If True, disables visualization in SUMO GUI. Defaults to True. envision_record_data_replay_path (Optional[str], optional): diff --git a/smarts/env/gymnasium/hiway_env_v1.py b/smarts/env/gymnasium/hiway_env_v1.py index 0e9df8ac6e..c90782691a 100644 --- a/smarts/env/gymnasium/hiway_env_v1.py +++ b/smarts/env/gymnasium/hiway_env_v1.py @@ -63,7 +63,7 @@ class ScenarioOrder(IntEnum): """Determines the order in which scenarios are served over successive resets.""" Sequential = 0 - """Scenarios are served in order intially provided.""" + """Scenarios are served in order initially provided.""" Scrambled = 1 """Scenarios are served in random order.""" @@ -114,7 +114,7 @@ class HiWayEnvV1(gym.Env): visualization_client_builder: A method that must must construct an object that follows the Envision interface. Allows tapping into a direct data stream from the simulation. - zoo_addrs (str, optional): List of (ip, port) tuples of + zoo_addrs (str, optional): List of (`ip`, `port`) tuples of zoo server, used to instantiate remote social agents. Defaults to None. observation_options (ObservationOptions, string): Defines the options @@ -235,7 +235,7 @@ def step( Dict[str, Any], ], ]: - """Run one timestep of the environment's dynamics using the agent actions. + """Run one time-step of the environment's dynamics using the agent actions. When the end of an episode is reached (``terminated or truncated``), it is necessary to call :meth:`reset` to reset this environment's state for the next episode. @@ -246,14 +246,14 @@ def step( Returns: observation (dict): An element of the environment's :attr:`observation_space` as the next observation due to the agent actions. This observation will change based on - the provided :attr:`agent_interfaces`. Check :attr:` observation_space after + the provided :attr:`agent_interfaces`. Check :attr:`observation_space` after initialization. reward (SupportsFloat): The reward as a result of taking the action. terminated (bool): Whether the agent reaches the terminal state (as defined under the MDP of the task) which can be positive or negative. An example is reaching the goal state. If true, the user needs to call :meth:`reset`. truncated (bool): Whether the truncation condition outside the scope of the MDP is satisfied. - Typically, this is a timelimit, but could also be used to indicate an agent physically going out of bounds. + Typically, this is a time-limit, but could also be used to indicate an agent physically going out of bounds. Can be used to end the episode prematurely before a terminal state is reached. If true, the user needs to call :meth:`reset`. info (dict): Contains auxiliary diagnostic information (helpful for debugging, learning, and logging). @@ -323,13 +323,13 @@ def reset( Args: seed (optional int): The seed that is used to initialize the environment's PRNG (`np_random`). If the environment does not already have a PRNG and ``seed=None`` (the default option) is passed, - a seed will be chosen from some source of entropy (e.g. timestamp or /dev/urandom). + a seed will be chosen from some source of entropy (e.g. timestamp or `/dev/urandom`). However, if the environment already has a PRNG and ``seed=None`` is passed, the PRNG will *not* be reset. If you pass an integer, the PRNG will be reset even if it already exists. Usually, you want to pass an integer *right after the environment has been initialized and then never again*. options (optional dict): Additional information to specify how the environment is reset (optional, depending on the specific environment). Forwards to :meth:`~smarts.core.smarts.SMARTS.reset`. - - "scenario" (smarts.sstudio.Scenario): An explicit scenario to reset to. The default is a scenario from the scenario iter. + - "scenario" (:class:`~smarts.sstudio.types.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: @@ -367,20 +367,20 @@ def render( Note: As the :attr:`render_mode` is known during ``__init__``, the objects used to render the environment state - should be initialised in ``__init__``. + should be initialized in ``__init__``. By convention, if the :attr:`render_mode` is: - None (default): no render is computed. - - "human": The environment is continuously rendered in the current display or terminal, + - `human`: The environment is continuously rendered in the current display or terminal, usually for human consumption. This rendering should occur during :meth:`step` and :meth:`render` doesn't need to be called. Returns ``None``. - - "rgb_array": Return a single frame representing the current state of the environment. + - `rgb_array`: Return a single frame representing the current state of the environment. A frame is a ``np.ndarray`` with shape ``(x, y, 3)`` representing RGB values for an x-by-y pixel image. - - "ansi": Return a strings (``str``) or ``StringIO.StringIO`` containing a + - `ansi`: Return a strings (``str``) or ``StringIO.StringIO`` containing a terminal-style text representation for each time step. The text can include newlines and ANSI escape sequences (e.g. for colors). - - "rgb_array_list" and "ansi_list": List based version of render modes are possible + - `rgb_array_list` and `ansi_list`: List based version of render modes are possible (except Human) through the wrapper, :py:class:`gymnasium.wrappers.RenderCollection` that is automatically applied during ``gymnasium.make(..., render_mode="rgb_array_list")``. The frames collected are popped after :meth:`render` is called or :meth:`reset`. @@ -408,13 +408,13 @@ def unwrapped(self) -> gym.Env[ObsType, ActType]: """Returns the base non-wrapped environment. Returns: - Env: The base non-wrapped :class:`gymnasium.Env` instance + gym.Env: The base non-wrapped :class:`gymnasium.Env` instance """ return self @property def np_random(self) -> np.random.Generator: - """Returns the environment's internal :attr:`_np_random` that if not set will initialise with a random seed. + """Returns the environment's internal :attr:`_np_random` that if not set will initialize with a random seed. Returns: Instances of `np.random.Generator`. @@ -472,10 +472,10 @@ def scenario_log(self) -> Dict[str, Union[float, str]]: Returns: (Dict[str, Union[float,str]]): A dictionary with the following keys. - fixed_timestep_sec - Simulation timestep. - scenario_map - Name of the current scenario. - scenario_traffic - Traffic spec(s) used. - mission_hash - Hash identifier for the current scenario. + `fixed_timestep_sec` - Simulation time-step. + `scenario_map` - Name of the current scenario. + `scenario_traffic` - Traffic spec(s) used. + `mission_hash` - Hash identifier for the current scenario. """ scenario = self._smarts.scenario diff --git a/smarts/env/gymnasium/wrappers/metric/metrics.py b/smarts/env/gymnasium/wrappers/metric/metrics.py index fcf524021f..0d7b9bba00 100644 --- a/smarts/env/gymnasium/wrappers/metric/metrics.py +++ b/smarts/env/gymnasium/wrappers/metric/metrics.py @@ -54,7 +54,7 @@ class MetricsError(Exception): - """Raised when Metrics env wrapper fails.""" + """Raised when the Metrics environment wrapper fails.""" pass @@ -100,7 +100,7 @@ def step(self, action: Dict[str, Any]): dones = {} if isinstance(terminated, dict): # Caters to environments which use (i) ObservationOptions.multi_agent, - # (ii) ObservationOptions.unformated, and (iii) ObservationOptions.default . + # (ii) ObservationOptions.unformatted, and (iii) ObservationOptions.default . dones = {k: v or truncated[k] for k, v in terminated.items()} elif isinstance(terminated, bool): # Caters to environments which use (i) ObservationOptions.full . @@ -117,7 +117,7 @@ def step(self, action: Dict[str, Any]): agent_id for agent_id, agent_obs in obs.items() if agent_obs["active"] ] else: - # Caters to environments which uses (i) ObservationOptions.unformated . + # Caters to environments which uses (i) ObservationOptions.unformatted . active_agents = list(obs.keys()) for agent_name in active_agents: @@ -429,14 +429,14 @@ class Metrics(gym.Wrapper): security of the metrics computed. Args: - env (gym.Env): A gym.Env to be wrapped. + env (gym.Env): The gym environment to be wrapped. Raises: AttributeError: Upon accessing (i) a protected attribute or (ii) an attribute beginning with an underscore. Returns: - gym.Env: A wrapped gym.Env which computes agents' performance metrics. + gym.Env: A wrapped gym environment which computes agents' performance metrics. """ def __init__(self, env: gym.Env, formula_path: Optional[Path] = None): diff --git a/smarts/env/gymnasium/wrappers/metric/params.py b/smarts/env/gymnasium/wrappers/metric/params.py index c628e77ce3..b43526f02e 100644 --- a/smarts/env/gymnasium/wrappers/metric/params.py +++ b/smarts/env/gymnasium/wrappers/metric/params.py @@ -29,7 +29,7 @@ class Collisions: """Parameters for collisions cost function.""" active: bool = False - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ @@ -39,7 +39,7 @@ class Comfort: """Parameters for comfort cost function.""" active: bool = False - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ @@ -49,7 +49,7 @@ class DistToDestination: """Parameters for distance to destination cost function.""" active: bool = True - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ @@ -59,11 +59,11 @@ class DistToObstacles: """Parameters for distance to obstacles cost function.""" active: bool = True - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ ignore: List[str] = field(default_factory=list) - """Vehicle id of neighbours to be excluded from being considered as an + """Vehicle id of neighbors to be excluded from being considered as an obstacle. """ @@ -73,7 +73,7 @@ class JerkLinear: """Parameters for jerk linear cost function.""" active: bool = True - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ @@ -83,7 +83,7 @@ class LaneCenterOffset: """Parameters for lane center offset cost function.""" active: bool = True - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ @@ -93,7 +93,7 @@ class OffRoad: """Parameters for off road cost function.""" active: bool = False - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ @@ -103,7 +103,7 @@ class SpeedLimit: """Parameters for speed limit cost function.""" active: bool = True - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ @@ -113,7 +113,7 @@ class Steps: """Parameters for steps cost function.""" active: bool = True - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ @@ -123,7 +123,7 @@ class VehicleGap: """Parameters for gap between vehicles cost function.""" active: bool = False - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ actor: str = "" @@ -135,7 +135,7 @@ class WrongWay: """Parameters for wrong way cost function.""" active: bool = True - """If True, enables computation of coresponding cost function. Else, + """If True, enables computation of corresponding cost function. Else, disabled. """ diff --git a/smarts/env/gymnasium/wrappers/metric/utils.py b/smarts/env/gymnasium/wrappers/metric/utils.py index 685e67bcd6..ccae7c3e9c 100644 --- a/smarts/env/gymnasium/wrappers/metric/utils.py +++ b/smarts/env/gymnasium/wrappers/metric/utils.py @@ -32,14 +32,14 @@ def add_dataclass(first: T, second: T) -> T: - """Sums the fields of two dataclass objects. + """Sums the fields of two `dataclass` objects. Args: - first (T): First dataclass object. - second (T): Second dataclass object. + first (T): First `dataclass` object. + second (T): Second `dataclass` object. Returns: - T: New summed dataclass object. + T: New summed `dataclass` object. """ assert type(first) is type(second) new = {} @@ -55,15 +55,15 @@ def op_dataclass( second: Union[int, float], op: Callable[[Union[int, float], Union[int, float]], float], ) -> T: - """Performs operation `op` on the fields of a dataclass object. + """Performs operation `op` on the fields of the source `dataclass` object. Args: - first (T): Dataclass object. + first (T): The source `dataclass` object. second (Union[int, float]): Value input for the operator. op (Callable[[Union[int, float], Union[int, float]], float]): Operation to be performed. Returns: - T: New dataclass object with operation performed on all of its fields. + T: A new `dataclass` object with operation performed on all of its fields. """ new = {} for field in fields(first): diff --git a/smarts/env/hiway_env.py b/smarts/env/hiway_env.py index 874910de8c..426e9ed888 100644 --- a/smarts/env/hiway_env.py +++ b/smarts/env/hiway_env.py @@ -223,7 +223,7 @@ def scenario_log(self) -> Dict[str, Union[float, str]]: Returns: Dict[str, Union[float,str]]: A dictionary with the following keys. - + fixed_timestep_sec: Simulation timestep. + + fixed_timestep_sec: Simulation time-step. + scenario_map: Name of the current scenario. + scenario_traffic: Traffic spec(s) used. + mission_hash: Hash identifier for the current scenario. @@ -270,7 +270,7 @@ def step( Returns: Tuple[ Dict[str, Observation], Dict[str, float], Dict[str, bool], Dict[str, Any] ]: - Observations, rewards, dones, and infos for active agents. + Observations, rewards, dones, and :spelling:ignore:`infos` for active agents. """ assert isinstance(agent_actions, dict) and all( isinstance(key, str) for key in agent_actions.keys() diff --git a/smarts/env/rllib_hiway_env.py b/smarts/env/rllib_hiway_env.py index 0ad91e2724..4520044244 100644 --- a/smarts/env/rllib_hiway_env.py +++ b/smarts/env/rllib_hiway_env.py @@ -51,13 +51,13 @@ class RLlibHiWayEnv(MultiAgentEnv): headless: True|False envision disabled|enabled. Defaults to True. - num_external_sumo_clients: Number of SUMO clients beyond SMARTS. Defaults to 0. + :spelling:ignore:`num_external_sumo_clients`: Number of SUMO clients beyond SMARTS. Defaults to 0. seed: Random number generation seed. Defaults to 42. sumo_auto_start: True|False sumo will start automatically. Defaults to False. - sumo_headless: True|False for sumo|sumo-gui. Defaults to False. + sumo_headless: True|False for `sumo`|`sumo-gui`. Defaults to False. sumo_port: Specifies sumo port. Defaults to None. diff --git a/smarts/env/utils/action_conversion.py b/smarts/env/utils/action_conversion.py index 0abd0b4d43..f6a5371d5c 100644 --- a/smarts/env/utils/action_conversion.py +++ b/smarts/env/utils/action_conversion.py @@ -146,7 +146,7 @@ def get_formats() -> Dict[ActionSpaceType, _FormattingGroup]: standard to SMARTS accepted observations. Returns: - Dict[ActionSpaceType, _FormattingGroup]: The currently available formatting groups. + Dict[ActionSpaceType, Any]: The currently available formatting groups. """ return { ActionSpaceType.ActuatorDynamic: _FormattingGroup( diff --git a/smarts/env/utils/observation_conversion.py b/smarts/env/utils/observation_conversion.py index 447519b1f9..f1a009b88f 100644 --- a/smarts/env/utils/observation_conversion.py +++ b/smarts/env/utils/observation_conversion.py @@ -297,7 +297,7 @@ def active(self, agent_interface: AgentInterface) -> bool: @property def name(self): - """The name that should represent this observation space in heirachy.""" + """The name that should represent this observation space in hierarchy.""" raise NotImplementedError() @property @@ -335,7 +335,7 @@ def active(self, agent_interface: AgentInterface) -> bool: @property def name(self): - """The name that should represent this observation space in heirachy.""" + """The name that should represent this observation space in hierarchy.""" return self._name @property @@ -375,7 +375,7 @@ def active(self, agent_interface: AgentInterface) -> bool: @property def name(self): - """The name that should represent this observation space in heirachy.""" + """The name that should represent this observation space in hierarchy.""" return self._name @property @@ -421,7 +421,7 @@ def active(self, agent_interface: AgentInterface) -> bool: @property def name(self): - """The name that should represent this observation space in heirachy.""" + """The name that should represent this observation space in hierarchy.""" return self._name @property diff --git a/smarts/env/wrappers/frame_stack.py b/smarts/env/wrappers/frame_stack.py index 30310bc1f8..b10a05768b 100644 --- a/smarts/env/wrappers/frame_stack.py +++ b/smarts/env/wrappers/frame_stack.py @@ -28,12 +28,12 @@ class FrameStack(gym.Wrapper): - """Wrapper stacks num_stack (default=3) consecutive frames, in a moving-window - fashion, and returns the stacked_frames. + """This wrapper stacks `num_stack` (default=3) consecutive frames, in a moving-window + fashion, and returns the `stacked_frames`. Note: - Wrapper returns a deepcopy of the stacked frames, which may be expensive - for large frames and large num_stack values. + This wrapper returns a deep-copy of the stacked frames, which may be expensive + for large frames and large `num_stack` values. """ def __init__(self, env: gym.Env, num_stack: int = 3): diff --git a/smarts/env/wrappers/gif_recorder.py b/smarts/env/wrappers/gif_recorder.py index a39e0b3c70..aac5ced746 100644 --- a/smarts/env/wrappers/gif_recorder.py +++ b/smarts/env/wrappers/gif_recorder.py @@ -42,7 +42,7 @@ class GifRecorder: """ - Use images(rgb_array) to create a gif file. + Uses images (such as from gym's ``"rgb_array"``) to create a gif file. """ def __init__(self, video_name_folder: str, env: gym.Env): @@ -63,7 +63,7 @@ def __init__(self, video_name_folder: str, env: gym.Env): def capture_frame(self, step_num: int, image: np.ndarray): """ - Create image according to the rgb_array and store it with step number in the destinated folder + Create image according to the ``"rgb_array"`` and store it with step number in the destination folder """ with ImageClip(image) as image_clip: image_clip.save_frame( diff --git a/smarts/env/wrappers/record_video.py b/smarts/env/wrappers/record_video.py index 7a5bfe23cd..74fdf234a1 100644 --- a/smarts/env/wrappers/record_video.py +++ b/smarts/env/wrappers/record_video.py @@ -39,12 +39,12 @@ from gym.wrappers.monitoring import video_recorder -def capped_cubic_video_schedule(episode_id): - """Util""" - if episode_id < 1000: +def capped_cubic_video_schedule(episode_id, cap=1000): + """A utility to schedule frequency fall-off.""" + if episode_id < cap: return int(round(episode_id ** (1.0 / 3))) ** 3 == episode_id else: - return episode_id % 1000 == 0 + return episode_id % cap == 0 class RecordVideo(gym.Wrapper): diff --git a/smarts/env/wrappers/rgb_image.py b/smarts/env/wrappers/rgb_image.py index 32b5e69f9a..47b5a2e782 100644 --- a/smarts/env/wrappers/rgb_image.py +++ b/smarts/env/wrappers/rgb_image.py @@ -21,7 +21,7 @@ # THE SOFTWARE. -from typing import Any, Dict, NamedTuple, Sequence +from typing import Any, Dict import gym import numpy as np @@ -35,7 +35,7 @@ class RGBImage(gym.ObservationWrapper): If the base env's observation space is frame stacked using the FrameStack wrapper, then the returned observation will be a numpy array of stacked - images with shape (image_width, image_height, 3*num_stack). Here, num_stack + images with shape (`image_width`, `image_height`, 3* `num_stack`). Here, `num_stack` refers to the number of frames stacked in the base env's observation. """ @@ -43,8 +43,8 @@ def __init__(self, env: gym.Env, num_stack: int): """ Args: env (gym.Env): SMARTS environment to be wrapped. - num_stack (int): Use 1 if base env's observation space is not stacked, - else use the number of stacked frames in base env's observation. + num_stack (int): Use 1 if base environment's observation space is not stacked, + else use the number of stacked frames in base environment's observation. """ super().__init__(env) agent_interfaces = env.agent_interfaces diff --git a/smarts/p3d/renderer.py b/smarts/p3d/renderer.py index 01dccf8f7d..8343f855c7 100644 --- a/smarts/p3d/renderer.py +++ b/smarts/p3d/renderer.py @@ -502,7 +502,7 @@ def build_offscreen_camera( height: int, resolution: float, ) -> P3dOffscreenCamera: - """Generates a new offscreen camera.""" + """Generates a new off-screen camera.""" # setup buffer win_props = WindowProperties.size(width, height) fb_props = FrameBufferProperties() diff --git a/smarts/sstudio/generators.py b/smarts/sstudio/generators.py index c18dc0c8f8..20ad95a60f 100644 --- a/smarts/sstudio/generators.py +++ b/smarts/sstudio/generators.py @@ -17,6 +17,12 @@ # 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. +""" +.. spelling:word-list:: + + idx + +""" import logging import os import random @@ -394,11 +400,13 @@ def _fill_in_gaps(self, route: types.Route) -> types.Route: ) def resolve_route(self, route, fill_in_gaps: bool) -> types.Route: - """Attempts to fill in the route between the begining and end specified in the initial - route. + """Attempts to fill in the route between the beginning and end specified in the initial + route. - :param route: An incomplete route. - :return: A complete route listing all road segments it passes through. + Args: + route: An incomplete route. + Returns: + types.Route: A complete route listing all road segments it passes through. """ if not isinstance(route, types.RandomRoute): return self._fill_in_gaps(route) if fill_in_gaps else route diff --git a/smarts/sstudio/genscenario.py b/smarts/sstudio/genscenario.py index 9bc97d1789..12bbdac304 100644 --- a/smarts/sstudio/genscenario.py +++ b/smarts/sstudio/genscenario.py @@ -18,7 +18,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. """This script provides a Python interface to generate scenario artifacts. This includes -route files (sumo \\*.rou.xml), missions, and bubbles. +route files `sumo `\\*.rou.xml`), missions, and bubbles. """ import collections @@ -492,7 +492,7 @@ def gen_group_laps( num_laps: int = 3, map_spec: Optional[types.MapSpec] = None, ): - """Generates missions that start with a grid offset at the startline and do a number + """Generates missions that start with a grid offset at the start-line and do a number of laps until finishing. Args: diff --git a/smarts/sstudio/tests/test_conditions.py b/smarts/sstudio/tests/test_conditions.py index f267122f82..0d6fe118b0 100644 --- a/smarts/sstudio/tests/test_conditions.py +++ b/smarts/sstudio/tests/test_conditions.py @@ -204,12 +204,12 @@ def test_condition_trigger(): long_delay = 10 first_time_window_true = 5 window_condition = TimeWindowCondition(4, 10) - delayed_condition = window_condition.trigger(long_delay, persistant=False) + delayed_condition = window_condition.trigger(long_delay, persistent=False) assert delayed_condition == ConditionTrigger( inner_condition=window_condition, delay_seconds=long_delay, - persistant=False, + persistent=False, ) # before @@ -241,8 +241,8 @@ def test_condition_trigger(): time = first_time_window_true + long_delay - 1 assert not delayed_condition.evaluate(time=time) - # Test persistant true - delayed_condition = window_condition.trigger(short_delay, persistant=True) + # Test persistent true + delayed_condition = window_condition.trigger(short_delay, persistent=True) time = first_time_window_true assert not delayed_condition.evaluate(time=time) time = first_time_window_true + short_delay diff --git a/smarts/sstudio/types/actor/social_agent_actor.py b/smarts/sstudio/types/actor/social_agent_actor.py index 23e8d665ae..28bcbe89b5 100644 --- a/smarts/sstudio/types/actor/social_agent_actor.py +++ b/smarts/sstudio/types/actor/social_agent_actor.py @@ -43,7 +43,7 @@ class SocialAgentActor(Actor): agent_locator: str """The locator reference to the zoo registration call. Expects a string in the format of 'path.to.file:locator-name' where the path to the registration call is in the form - {PYTHONPATH}[n]/path/to/file.py + `{PYTHONPATH}[n]/path/to/file.py` """ policy_kwargs: Dict[str, Any] = field(default_factory=dict) """Additional keyword arguments to be passed to the constructed class overriding the diff --git a/smarts/sstudio/types/bubble.py b/smarts/sstudio/types/bubble.py index be2f6e8115..87ccc8c3eb 100644 --- a/smarts/sstudio/types/bubble.py +++ b/smarts/sstudio/types/bubble.py @@ -43,7 +43,7 @@ class Bubble: actor: SocialAgentActor """The actor specification that this bubble works for.""" margin: float = 2 # Used for "airlocking"; must be > 0 - """The exterior buffer area for airlocking. Must be > 0.""" + """The exterior buffer area for air-locking. Must be > 0.""" # If limit != None it will only allow that specified number of vehicles to be # hijacked. N.B. when actor = BoidAgentActor the lesser of the actor capacity # and bubble limit will be used. @@ -53,12 +53,12 @@ class Bubble: """Used to exclude social actors from capture.""" id: str = field(default_factory=lambda: f"bubble-{gen_id()}") follow_actor_id: Optional[str] = None - """Actor ID of agent we want to pin to. Doing so makes this a "travelling bubble" + """Actor ID of agent we want to pin to. Doing so makes this a "traveling bubble" which means it moves to follow the `follow_actor_id`'s vehicle. Offset is from the vehicle's center position to the bubble's center position. """ follow_offset: Optional[Tuple[float, float]] = None - """Maintained offset to place the travelling bubble relative to the follow + """Maintained offset to place the traveling bubble relative to the follow vehicle if it were facing north. """ keep_alive: bool = False @@ -67,7 +67,7 @@ class Bubble: is over. """ follow_vehicle_id: Optional[str] = None - """Vehicle ID of a vehicle we want to pin to. Doing so makes this a "travelling bubble" + """Vehicle ID of a vehicle we want to pin to. Doing so makes this a "traveling bubble" which means it moves to follow the `follow_vehicle_id`'s vehicle. Offset is from the vehicle's center position to the bubble's center position. """ @@ -85,7 +85,7 @@ def __post_init__(self): self.follow_actor_id is not None or self.follow_vehicle_id is not None ) and self.follow_offset is None: raise ValueError( - "A follow offset must be set if this is a travelling bubble" + "A follow offset must be set if this is a traveling bubble" ) if self.keep_alive and not self.is_boid: diff --git a/smarts/sstudio/types/condition.py b/smarts/sstudio/types/condition.py index 92502adcf9..05cf0115d6 100644 --- a/smarts/sstudio/types/condition.py +++ b/smarts/sstudio/types/condition.py @@ -95,6 +95,10 @@ def requires(self) -> ConditionRequires: def negation(self) -> "NegatedCondition": """Negates this condition giving the opposite result on evaluation. + .. spelling:word-list:: + + ConditionState + >>> condition_true = LiteralCondition(ConditionState.TRUE) >>> condition_true.evaluate() @@ -116,10 +120,10 @@ def conjunction(self, other: "Condition") -> "CompoundCondition": """Resolve conditions as A AND B. The bit AND operator has been overloaded to call this method. - >>> dependee_condition = DependeeActorCondition("leader") - >>> dependee_condition.evaluate(actor_ids={"leader"}) + >>> condition = DependeeActorCondition("leader") + >>> condition.evaluate(actor_ids={"leader"}) - >>> conjunction = dependee_condition & LiteralCondition(ConditionState.FALSE) + >>> conjunction = condition & LiteralCondition(ConditionState.FALSE) >>> conjunction.evaluate(actor_ids={"leader"}) @@ -157,7 +161,7 @@ def implication(self, other: "Condition") -> "CompoundCondition": return CompoundCondition(self, other, operator=ConditionOperator.IMPLICATION) def trigger( - self, delay_seconds: float, persistant: bool = False + self, delay_seconds: float, persistent: bool = False ) -> "ConditionTrigger": """Converts the condition to a trigger which becomes permanently TRUE after the first time the inner condition becomes TRUE. @@ -184,13 +188,13 @@ def trigger( Args: delay_seconds (float): Applies the trigger after the delay has passed since the inner condition first TRUE. Defaults to False. - persistant (bool, optional): Mixes the inner result with the trigger result using an AND operation. + persistent (bool, optional): Mixes the inner result with the trigger result using an AND operation. Returns: ConditionTrigger: A resulting condition. """ return ConditionTrigger( - self, delay_seconds=delay_seconds, persistant=persistant + self, delay_seconds=delay_seconds, persistent=persistent ) def expire( @@ -384,7 +388,7 @@ def __post_init__(self): @dataclass(frozen=True) class ConditionTrigger(Condition): """This condition is a trigger that assumes an untriggered constant state and then turns to the other state permanently - on the inner condition becoming TRUE. There is also an option to delay repsonse to the the inner condition by a number + on the inner condition becoming TRUE. There is also an option to delay response to the the inner condition by a number of seconds. This will convey an EXPIRED value immediately because that state means the inner value will never be TRUE. This can be used to wait for some time after the inner condition has become TRUE to trigger. @@ -405,8 +409,8 @@ class ConditionTrigger(Condition): triggered_state: ConditionState = ConditionState.TRUE """The state after the inner trigger condition and delay is resolved.""" - persistant: bool = False - """If the inner condition state is used in conjuction with the triggered state. (inner_condition_state & triggered_state)""" + persistent: bool = False + """If the inner condition state is used in conjunction with the triggered state. (inner_condition_state & triggered_state)""" def evaluate(self, **kwargs) -> ConditionState: time = kwargs[ConditionRequires.time.name] @@ -423,7 +427,7 @@ def evaluate(self, **kwargs) -> ConditionState: time -= met_time if time >= self.delay_seconds: result = self.triggered_state - if self.persistant: + if self.persistent: result &= self.inner_condition.evaluate(**kwargs) return result @@ -572,8 +576,8 @@ def evaluate(self, **kwargs) -> ConditionState: return ConditionState.TRUE elif self.operator == ConditionOperator.CONJUNCTION: - conjuction = first_eval & second_eval - if ConditionState.TRUE in conjuction: + conjunction = first_eval & second_eval + if ConditionState.TRUE in conjunction: return ConditionState.TRUE # To priority of temporal versions of FALSE diff --git a/smarts/sstudio/types/mission.py b/smarts/sstudio/types/mission.py index a0986ce42f..d65450b643 100644 --- a/smarts/sstudio/types/mission.py +++ b/smarts/sstudio/types/mission.py @@ -83,7 +83,7 @@ class EndlessMission: lane_index: The lane index from the rightmost lane. offset: - The offset in metres into the lane. Also acceptable\\: 'max', 'random' + The offset in meters into the lane. Also acceptable\\: 'max', 'random' """ via: Tuple[Via, ...] = () """Points on a road that an actor must pass through""" diff --git a/smarts/sstudio/types/route.py b/smarts/sstudio/types/route.py index fafb201e4d..300f565401 100644 --- a/smarts/sstudio/types/route.py +++ b/smarts/sstudio/types/route.py @@ -66,7 +66,7 @@ class Route: lane_index: The lane index from the rightmost lane. offset: - The offset in metres into the lane. Also acceptable\\: "max", "random" + The offset in meters into the lane. Also acceptable\\: "max", "random" """ ## road, lane index, offset end: Tuple[str, int, Any] @@ -77,7 +77,7 @@ class Route: lane_index: The lane index from the rightmost lane. offset: - The offset in metres into the lane. Also acceptable\\: "max", "random" + The offset in meters into the lane. Also acceptable\\: "max", "random" """ # Roads we want to make sure this route includes @@ -111,7 +111,7 @@ def __eq__(self, other): @dataclass(frozen=True) class RandomRoute: - """An alternative to types.Route which specifies to sstudio to generate a random + """An alternative to types.Route which specifies to ``sstudio`` to generate a random route. """ diff --git a/smarts/sstudio/types/scenario.py b/smarts/sstudio/types/scenario.py index e49932eef4..667f0f0dcb 100644 --- a/smarts/sstudio/types/scenario.py +++ b/smarts/sstudio/types/scenario.py @@ -46,7 +46,7 @@ class ScenarioMetadata: @dataclass(frozen=True) class Scenario: - """The sstudio scenario representation.""" + """The Scenario Studio (`sstudio`) scenario representation.""" map_spec: Optional[MapSpec] = None """Specifies the road map.""" diff --git a/smarts/sstudio/types/traffic_model.py b/smarts/sstudio/types/traffic_model.py index 00fecf4e97..d28de95296 100644 --- a/smarts/sstudio/types/traffic_model.py +++ b/smarts/sstudio/types/traffic_model.py @@ -96,7 +96,7 @@ class SmartsLaneChangingModel(LaneChangingModel): Args: cutin_prob (float, optional): Float value [0, 1] that - determines the probabilty this vehicle will "arbitrarily" cut in + determines the probability this vehicle will "arbitrarily" cut in front of an adjacent agent vehicle when it has a chance, even if there would otherwise be no reason to change lanes at that point. Higher values risk a situation where this vehicle ends up in a lane @@ -108,7 +108,7 @@ class SmartsLaneChangingModel(LaneChangingModel): Attempts to match the semantics of the attribute in SUMO's default lane-changing model, see: ``https://sumo.dlr.de/docs/Definition_of_Vehicles%2C_Vehicle_Types%2C_and_Routes.html#lane-changing_models``. Range: positive reals. Defaults to 1.0. - dogmatic (bool, optional): If True, will cutin when a suitable + dogmatic (bool, optional): If True, will cut-in when a suitable opportunity presents itself based on the above parameters, even if it means the risk of not not completing the assigned route; otherwise, will forego the chance. Defaults to True. @@ -119,7 +119,7 @@ class SmartsLaneChangingModel(LaneChangingModel): slow_down_after (float, optional): Target speed during the hold_period will be scaled by this value. Must be non-negative. Defaults to 1.0. multi_lane_cutin (bool, optional): If True, this vehicle will consider - changing across multiple lanes at once in order to cutin upon an + changing across multiple lanes at once in order to cut-in upon an agent vehicle when there's an opportunity. Defaults to False. """ diff --git a/smarts/sstudio/types/zone.py b/smarts/sstudio/types/zone.py index bb83d1e868..e88acec0de 100644 --- a/smarts/sstudio/types/zone.py +++ b/smarts/sstudio/types/zone.py @@ -63,7 +63,7 @@ class MapZone(Zone): lane_index: The lane index from the rightmost lane. offset: - The offset in metres into the lane. Also acceptable\\: 'max', 'random' + The offset in meters into the lane. Also acceptable\\: 'max', 'random' """ length: float """The length of the geometry along the center of the lane. Also acceptable\\: 'max'""" diff --git a/smarts/waymo/waymo_utils.py b/smarts/waymo/waymo_utils.py index 673a9ca140..c30a6ae0c1 100644 --- a/smarts/waymo/waymo_utils.py +++ b/smarts/waymo/waymo_utils.py @@ -353,7 +353,7 @@ def update(i): def gen_smarts_scenario_code(dataset_path: str, scenario_id: str) -> str: - """Generate source code for the scenario.py of a SMARTS scenario for a Waymo scenario.""" + """Generate source code for the ``scenario.py`` of a SMARTS scenario for a Waymo scenario.""" return f"""from pathlib import Path from smarts.sstudio import gen_scenario from smarts.sstudio import types as t diff --git a/smarts/zoo/manager_servicer.py b/smarts/zoo/manager_servicer.py index b781b17695..7c10f717b9 100644 --- a/smarts/zoo/manager_servicer.py +++ b/smarts/zoo/manager_servicer.py @@ -36,7 +36,7 @@ class ManagerServicer(manager_pb2_grpc.ManagerServicer): - """Provides methods that implement functionality of Manager Servicer.""" + """Provides methods that implement functionality of ``ManagerServicer``.""" def __init__(self): self._workers = {} diff --git a/smarts/zoo/worker.py b/smarts/zoo/worker.py index 137c296eb6..4dd7bacadd 100755 --- a/smarts/zoo/worker.py +++ b/smarts/zoo/worker.py @@ -30,12 +30,12 @@ This script is called from within SMARTS to instantiate a remote agent. The protocol is as follows: -1. SMARTS calls: worker.py --port 5467 # sets a unique port per agent -2. worker.py will begin listening on port 5467. +1. SMARTS calls: ``worker.py`` --port 5467 # sets a unique port per agent +2. ``worker.py`` will begin listening on port 5467. 3. SMARTS connects to (ip, 5467) as a client. 4. SMARTS calls `build()` rpc with `AgentSpec` as input. -5. worker.py receives the `AgentSpec` instances and builds the Agent. -6. SMARTS calls `act()` rpc with observation as input and receives the actions as response from worker.py. +5. ``worker.py`` receives the `AgentSpec` instances and builds the Agent. +6. SMARTS calls `act()` rpc with observation as input and receives the actions as response from ``worker.py``. """ import argparse diff --git a/smarts/zoo/worker_servicer.py b/smarts/zoo/worker_servicer.py index c77c2d4475..7bbaa4065a 100644 --- a/smarts/zoo/worker_servicer.py +++ b/smarts/zoo/worker_servicer.py @@ -19,7 +19,6 @@ # 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 logging import os import time @@ -34,7 +33,7 @@ class WorkerServicer(worker_pb2_grpc.WorkerServicer): - """Provides methods that implement functionality of Worker Servicer.""" + """Provides methods that implement functionality of ``WorkerServicer``.""" def __init__(self): self._agent = None diff --git a/zoo/evaluation/metrics/diversity/utils.py b/zoo/evaluation/metrics/diversity/utils.py index 3c188fddc0..82ab8aeba2 100644 --- a/zoo/evaluation/metrics/diversity/utils.py +++ b/zoo/evaluation/metrics/diversity/utils.py @@ -259,7 +259,7 @@ def count_intersection_segment(pos_list1, pos_list2): def generate_curve(A, B, C, D): """ - if Seg(A1, B1) and Seg(A2, B2) intersects at P, + if Segment(A1, B1) and Segment(A2, B2) intersects at P, then C is the closest point to A in the trajectory1 opposite to the direction of B, and D is the closest point to B opposite to the direction of A diff --git a/zoo/policies/replay_agent.py b/zoo/policies/replay_agent.py index 0653628318..58f7e2f481 100644 --- a/zoo/policies/replay_agent.py +++ b/zoo/policies/replay_agent.py @@ -14,7 +14,7 @@ class ReplayAgent(Agent): """A helper agent that wraps another agent to allow replay of the agent inputs and actions - Checkout examples/replay/README.md on how to use it""" + Look at `examples/replay/README.md` on how to use this agent.""" def __init__(self, save_directory, id, read: bool, internal_spec: AgentSpec): import smarts.core diff --git a/zoo/policies/rl-agent/rl_agent/lane_space.py b/zoo/policies/rl-agent/rl_agent/lane_space.py index 02b523d3d8..7550133d62 100644 --- a/zoo/policies/rl-agent/rl_agent/lane_space.py +++ b/zoo/policies/rl-agent/rl_agent/lane_space.py @@ -148,7 +148,7 @@ def ttc_by_path( goal_info = np.array([goal_is_nearby, goal_relative_lane_index]) - # return if no neighbour vehicle or off the routes(no waypoint paths) + # return if no neighbor vehicle or off the routes(no waypoint paths) if not neighborhood_vehicle_states or not wp_paths_num: return ( lane_ttc, @@ -161,7 +161,7 @@ def ttc_by_path( goal_info, ) - # compute neighbour vehicle closest wp + # compute neighbor vehicle closest wp nv_poses = np.array([nv.position for nv in neighborhood_vehicle_states]) nv_wp_distance = np.linalg.norm( nv_poses[:, :2][:, np.newaxis] - wp_poses, axis=2 @@ -209,12 +209,12 @@ def ttc_by_path( wps_with_lane_dist_list += wps_with_lane_dist.tolist() wps_with_lane_dist_list = np.array(wps_with_lane_dist_list) - # get neighbour vehicle closest waypoints index + # get neighbor vehicle closest waypoints index nv_closest_wp_index = nv_closest_wp_index[close_nv_index] - # ego car and neighbour car distance, not very accurate since use the closest wp + # ego car and neighbor car distance, not very accurate since use the closest wp ego_nv_distance = wps_with_lane_dist_list[nv_closest_wp_index] - # get neighbour vehicle lane index + # get neighbor vehicle lane index nv_lane_index = np.array( [merge_waypoint_paths[i].lane_index for i in nv_closest_wp_index] ) From a5f84daf1baf905cbacdf5ac3cc828049336be62 Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Fri, 19 May 2023 21:57:46 +0000 Subject: [PATCH 3/9] Fix type test. --- smarts/core/renderer_base.py | 2 +- .../core/sensors/parallel_sensor_resolver.py | 2 ++ smarts/core/sumo_road_network.py | 24 ++++++++++++++----- smarts/p3d/renderer.py | 2 +- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/smarts/core/renderer_base.py b/smarts/core/renderer_base.py index a4aba458b5..5fd88094ed 100644 --- a/smarts/core/renderer_base.py +++ b/smarts/core/renderer_base.py @@ -171,6 +171,6 @@ def build_offscreen_camera( width: int, height: int, resolution: float, - ) -> OffscreenCamera: + ) -> str: """Generates a new off-screen camera.""" raise NotImplementedError diff --git a/smarts/core/sensors/parallel_sensor_resolver.py b/smarts/core/sensors/parallel_sensor_resolver.py index 04ba8c6069..f6c614fc0a 100644 --- a/smarts/core/sensors/parallel_sensor_resolver.py +++ b/smarts/core/sensors/parallel_sensor_resolver.py @@ -305,12 +305,14 @@ def _run( def run(self): """Start the worker seeded with the given data.""" kwargs = dict(serialize_results=self._serialize_results) + # pytype: disable=wrong-arg-types self._proc = mp.Process( target=self._run, args=(self._child_connection,), kwargs=kwargs, daemon=True, ) + # pytype: enable=wrong-arg-types self._proc.start() return self._parent_connection diff --git a/smarts/core/sumo_road_network.py b/smarts/core/sumo_road_network.py index cb800a8c78..3a2bce1909 100644 --- a/smarts/core/sumo_road_network.py +++ b/smarts/core/sumo_road_network.py @@ -207,32 +207,44 @@ def _map_path(map_spec: MapSpec) -> str: return map_spec.source def is_same_map(self, map_or_spec: Union[MapSpec, RoadMap]) -> bool: + if self is map_or_spec: + return True + + self_map_spec = self.map_spec + if self_map_spec is None: + return False + if isinstance(map_or_spec, SumoRoadNetwork): map_spec = map_or_spec._map_spec elif isinstance(map_or_spec, MapSpec): map_spec = map_or_spec else: return False + if map_spec is None: + return False + + # pytype: disable=attribute-error return ( ( - map_spec.source == self._map_spec.source + map_spec.source == self_map_spec.source or SumoRoadNetwork._map_path(map_spec) - == SumoRoadNetwork._map_path(self._map_spec) + == SumoRoadNetwork._map_path(self_map_spec) ) - and map_spec.lanepoint_spacing == self._map_spec.lanepoint_spacing + and map_spec.lanepoint_spacing == self_map_spec.lanepoint_spacing and ( - map_spec.default_lane_width == self._map_spec.default_lane_width + map_spec.default_lane_width == self_map_spec.default_lane_width or SumoRoadNetwork._spec_lane_width(map_spec) - == SumoRoadNetwork._spec_lane_width(self._map_spec) + == SumoRoadNetwork._spec_lane_width(self_map_spec) ) and ( - map_spec.shift_to_origin == self._map_spec.shift_to_origin + map_spec.shift_to_origin == self_map_spec.shift_to_origin or ( not map_spec.shift_to_origin and not getattr(self._graph, "_shifted_by_smarts", False) ) ) ) + # pytype: enable=attribute-error @cached_property def bounding_box(self) -> BoundingBox: diff --git a/smarts/p3d/renderer.py b/smarts/p3d/renderer.py index 8343f855c7..01f25cb23d 100644 --- a/smarts/p3d/renderer.py +++ b/smarts/p3d/renderer.py @@ -501,7 +501,7 @@ def build_offscreen_camera( width: int, height: int, resolution: float, - ) -> P3dOffscreenCamera: + ) -> str: """Generates a new off-screen camera.""" # setup buffer win_props = WindowProperties.size(width, height) From 81adad8d19a8afa3e329dc349740ad77b37eaa65 Mon Sep 17 00:00:00 2001 From: Tucker Alban Date: Tue, 23 May 2023 15:46:08 -0400 Subject: [PATCH 4/9] Apply suggestions from code review Co-authored-by: adai --- docs/ecosystem/rllib.rst | 4 ++-- docs/sim/visualization.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/ecosystem/rllib.rst b/docs/ecosystem/rllib.rst index 969bbc6901..2a49341ae8 100644 --- a/docs/ecosystem/rllib.rst +++ b/docs/ecosystem/rllib.rst @@ -1,8 +1,8 @@ .. _rllib: -``RLlib`` -====================== +RLlib +===== **RLlib** is an open-source library for reinforcement learning that offers both high scalability and a unified API for a variety of applications. ``RLlib`` natively supports ``TensorFlow``, ``TensorFlow Eager``, and ``PyTorch``. Most of its internals are agnostic to such diff --git a/docs/sim/visualization.rst b/docs/sim/visualization.rst index 242eae1b38..403222abb7 100644 --- a/docs/sim/visualization.rst +++ b/docs/sim/visualization.rst @@ -87,8 +87,8 @@ Save an updated distribution if any changes were made to the Envision web applic # Saves to envision/web/dist $ npm run build -``Visdom`` ----------- +Visdom +------ Use the `visdom `_ integration to easily see the image-based observation outputs in real-time. Start the visdom server before running the scenario and open the server URL in your browser `http://localhost:8097 `_. From cf90b61e13b8eb8f2b8ec305e449d8a434842f06 Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Tue, 23 May 2023 19:52:40 +0000 Subject: [PATCH 5/9] Add spell checking test. --- .github/workflows/ci-format.yml | 5 ++++- docs/resources/containers.rst | 2 +- docs/resources/todo.rst | 4 ++-- docs/sim/configuration.rst | 2 +- docs/spelling_wordlist.txt | 3 +++ utils/docker/Dockerfile | 1 + utils/docker/Dockerfile.minimal | 7 +------ 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-format.yml b/.github/workflows/ci-format.yml index 97c4daca9e..c6569ace1c 100644 --- a/.github/workflows/ci-format.yml +++ b/.github/workflows/ci-format.yml @@ -88,6 +88,9 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Install Enchant + run: | + apt-get install -y libenchant-2-2 - name: Build Sphinx documentation run: | python3.8 -m venv ${{env.venv_dir}} @@ -96,7 +99,7 @@ jobs: pip install wheel==0.38.4 pip install .[camera_obs,doc,train,ray,envision,argoverse,opendrive,waymo] cd ${GITHUB_WORKSPACE}/docs - make html SPHINXOPTS="-W -T -E --keep-going" + make html SPHINXOPTS="-W -T -E --keep-going -b spelling" - name: Check build output run: | cd $GITHUB_WORKSPACE diff --git a/docs/resources/containers.rst b/docs/resources/containers.rst index a4151732cb..9126cfd8ad 100644 --- a/docs/resources/containers.rst +++ b/docs/resources/containers.rst @@ -27,7 +27,7 @@ SMARTS docker images are hosted at `dockerhub `_ container. diff --git a/docs/resources/todo.rst b/docs/resources/todo.rst index b3c13e01c5..2c41747d97 100644 --- a/docs/resources/todo.rst +++ b/docs/resources/todo.rst @@ -3,6 +3,6 @@ TODO List ========= -A list of current documentation TODO. +A list of current documentation TODOs. -.. todolist_:: \ No newline at end of file +.. todolist_:: diff --git a/docs/sim/configuration.rst b/docs/sim/configuration.rst index 34692021d0..60b4fe21a5 100644 --- a/docs/sim/configuration.rst +++ b/docs/sim/configuration.rst @@ -24,4 +24,4 @@ These settings are as follows: .. todo:: - List engine settings \ No newline at end of file + List engine settings diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 8bca9c9799..d9aa14dadd 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -7,6 +7,7 @@ accelerometer Ackermann acyclic acyclical +Apptainer Argoverse args bezier @@ -54,6 +55,7 @@ rebase renderer renderers repurposes +RLlib rtype scalable scalability @@ -71,6 +73,7 @@ unmanaged untriggered Vandenberghe vectorized +Visdom waypoint waypoints Waymo diff --git a/utils/docker/Dockerfile b/utils/docker/Dockerfile index f96b8adf8d..410feec256 100644 --- a/utils/docker/Dockerfile +++ b/utils/docker/Dockerfile @@ -20,6 +20,7 @@ RUN apt-get update --fix-missing && \ libspatialindex-dev \ python3.8 \ python3.8-venv \ + libenchant-2-2 \ xorg && \ apt-get autoremove -y && \ rm -rf /var/lib/apt/lists/* diff --git a/utils/docker/Dockerfile.minimal b/utils/docker/Dockerfile.minimal index 4f7d884d44..7fc36e26d4 100644 --- a/utils/docker/Dockerfile.minimal +++ b/utils/docker/Dockerfile.minimal @@ -22,17 +22,12 @@ RUN apt-get update --fix-missing && \ libspatialindex-dev \ python3.8 \ python3.8-venv \ - sumo \ - sumo-doc \ - sumo-tools \ + libenchant-2-2 \ wget \ xorg && \ apt-get autoremove -y && \ rm -rf /var/lib/apt/lists/* -# Setup SUMO -ENV SUMO_HOME /usr/share/sumo - # Update default python version RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 From b3659246c5cf6c6a0f33f516512693b1b4071f47 Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Tue, 23 May 2023 19:58:58 +0000 Subject: [PATCH 6/9] Fix libenchant install. --- .github/workflows/ci-format.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-format.yml b/.github/workflows/ci-format.yml index c6569ace1c..1d69d87498 100644 --- a/.github/workflows/ci-format.yml +++ b/.github/workflows/ci-format.yml @@ -90,6 +90,7 @@ jobs: fetch-depth: 0 - name: Install Enchant run: | + apt-get update --fix-missing apt-get install -y libenchant-2-2 - name: Build Sphinx documentation run: | From 1d0986399a5ec72b51db579f8f8164edd542c6fd Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Tue, 23 May 2023 20:19:53 +0000 Subject: [PATCH 7/9] Attempt CI install fix with libenchant-dev. --- .github/workflows/ci-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-format.yml b/.github/workflows/ci-format.yml index 1d69d87498..cf274f9a31 100644 --- a/.github/workflows/ci-format.yml +++ b/.github/workflows/ci-format.yml @@ -91,7 +91,7 @@ jobs: - name: Install Enchant run: | apt-get update --fix-missing - apt-get install -y libenchant-2-2 + apt-get install -y libenchant-dev - name: Build Sphinx documentation run: | python3.8 -m venv ${{env.venv_dir}} From 7c0b63839edb81e85ad815d44a62aaad42a946f4 Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Tue, 23 May 2023 20:28:25 +0000 Subject: [PATCH 8/9] Fix spelling whitelisted. --- docs/spelling_wordlist.txt | 3 ++- smarts/core/agent_manager.py | 4 ++-- smarts/core/lanepoints.py | 2 +- utils/docker/Dockerfile | 2 +- utils/docker/Dockerfile.minimal | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index d9aa14dadd..42e03306b3 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -77,4 +77,5 @@ Visdom waypoint waypoints Waymo -Welford \ No newline at end of file +Welford +whitelisted \ No newline at end of file diff --git a/smarts/core/agent_manager.py b/smarts/core/agent_manager.py index f1af56a330..b6e7e31d6c 100644 --- a/smarts/core/agent_manager.py +++ b/smarts/core/agent_manager.py @@ -662,7 +662,7 @@ def start_social_agent(self, agent_id, social_agent, agent_model): def teardown_ego_agents(self, filter_ids: Optional[Set] = None): """Tears down all given ego agents passed through the filter. Args: - filter_ids (Optional[Set[str]], optional): The whitelist of agent ids. If `None`, all ids are whitelisted. + filter_ids (Optional[Set[str]], optional): The whitelist of agent ids. If `None`, all ids are white-listed. """ ids_ = self._teardown_agents_by_ids(self._ego_agent_ids, filter_ids) self._ego_agent_ids -= ids_ @@ -671,7 +671,7 @@ def teardown_ego_agents(self, filter_ids: Optional[Set] = None): def teardown_social_agents(self, filter_ids: Optional[Set] = None): """Tears down all given social agents passed through the filter. Args: - filter_ids (Optional[Set[str]], optional): The whitelist of agent ids. If `None`, all ids are whitelisted. + filter_ids (Optional[Set[str]], optional): The whitelist of agent ids. If `None`, all ids are white-listed. """ ids_ = self._teardown_agents_by_ids(self._social_agent_ids, filter_ids) diff --git a/smarts/core/lanepoints.py b/smarts/core/lanepoints.py index 588266dfcb..bccea1d4bf 100644 --- a/smarts/core/lanepoints.py +++ b/smarts/core/lanepoints.py @@ -917,7 +917,7 @@ def paths_starting_at_lanepoint( lookahead (int): The maximum lane-points in a branch. filter_edge_ids (Tuple[str]): - Whitelisted edge ids. + White-listed edge ids. Returns: All branches(as lists) stemming from the input lane-point. """ diff --git a/utils/docker/Dockerfile b/utils/docker/Dockerfile index 410feec256..539c35ad35 100644 --- a/utils/docker/Dockerfile +++ b/utils/docker/Dockerfile @@ -20,7 +20,7 @@ RUN apt-get update --fix-missing && \ libspatialindex-dev \ python3.8 \ python3.8-venv \ - libenchant-2-2 \ + libenchant-dev \ xorg && \ apt-get autoremove -y && \ rm -rf /var/lib/apt/lists/* diff --git a/utils/docker/Dockerfile.minimal b/utils/docker/Dockerfile.minimal index 7fc36e26d4..c3cfd5e789 100644 --- a/utils/docker/Dockerfile.minimal +++ b/utils/docker/Dockerfile.minimal @@ -22,7 +22,7 @@ RUN apt-get update --fix-missing && \ libspatialindex-dev \ python3.8 \ python3.8-venv \ - libenchant-2-2 \ + libenchant-dev \ wget \ xorg && \ apt-get autoremove -y && \ From 2eac05bc649881bf49c908edd27c129460b4ec94 Mon Sep 17 00:00:00 2001 From: Montgomery Alban Date: Tue, 23 May 2023 20:35:46 +0000 Subject: [PATCH 9/9] Fix git call issue. --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 6a229ecc59..d2fe55e5c4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -112,6 +112,7 @@ spelling_ignore_pypi_package_names = True spelling_show_suggestions = True spelling_suggestion_limit = 2 +spelling_ignore_contributor_names=False spelling_word_list_filename = ["spelling_wordlist.txt"] # -- Options for HTML output -------------------------------------------------