Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutowareAuto ROS2 support #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
# -- Project information -----------------------------------------------------

project = 'Scenic'
copyright = '2021, Daniel J. Fremont.'
author = 'Daniel J. Fremont, Edward Kim, Tommaso Dreossi, Shromona Ghosh, Xiangyu Yue, Alberto L. Sangiovanni-Vincentelli, and Sanjit A. Seshia'
copyright = '2020, Daniel J. Fremont.'
author = 'Daniel J. Fremont, Tommaso Dreossi, Shromona Ghosh, Edward Kim, Xiangyu Yue, Alberto L. Sangiovanni-Vincentelli, and Sanjit A. Seshia'


# -- General configuration ---------------------------------------------------
Expand Down Expand Up @@ -72,9 +72,6 @@
autodoc_member_order = 'bysource'
autodoc_mock_imports = ['carla', 'lgsvl']
autodoc_typehints = 'description'
autodoc_type_aliases = {
'Vectorlike': '`scenic.domains.driving.roads.Vectorlike`',
}
napoleon_numpy_docstring = False
napoleon_use_rtype = False
napoleon_use_ivar = True
Expand Down Expand Up @@ -231,19 +228,24 @@ def object_description(obj):
return orig_object_description(obj)
sphinx.ext.autodoc.object_description = object_description

# -- Extension for correctly displaying Scenic code and skipping internals ---
# TODO switch to type_aliases once Sphinx 3.3 is out;
# this hack suggested by sjjessop at https://github.com/sphinx-doc/sphinx/issues/6518
import typing
orig_get_type_hints = typing.get_type_hints
def get_type_hints(obj, globals=None, locals=None):
if locals is None:
locals = {}
locals['Vectorlike'] = 'Vectorlike'
return orig_get_type_hints(obj, globals, locals)
typing.get_type_hints = get_type_hints

from scenic.syntax.pygment import ScenicLexer
# -- Extension for correctly displaying Scenic code and skipping internals ---

def setup(app):
app.connect('viewcode-find-source', handle_find_source)
app.connect('autodoc-process-signature', handle_process_signature)
app.connect('autodoc-skip-member', handle_skip_member)

# for some reason, the Pygments entry point doesn't work on ReadTheDocs;
# so we register the custom lexer here
app.add_lexer('scenic', ScenicLexer)

return { 'parallel_read_safe': True }

import importlib
Expand Down Expand Up @@ -323,3 +325,13 @@ def scan(self, imported_members):
modname=modname, qualname=qualname)

as_gen.generate_autosummary_content = generate_autosummary_content

# -- Monkeypatch to fix bug in autodoc (temporarily) -------------------------

from sphinx.ext.autodoc import Documenter, Options

orig_init = Documenter.__init__
def __init__(self, *args, **kwargs):
orig_init(self, *args, **kwargs)
self.options = Options(self.options)
Documenter.__init__ = __init__
4 changes: 2 additions & 2 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Getting Started with Scenic
Installation
------------

Scenic requires **Python 3.7** or newer.
Scenic requires **Python 3.8** or newer.
You can install Scenic from PyPI by simply running:

.. code-block:: console
Expand All @@ -30,7 +30,7 @@ If you will be developing Scenic, add the ``-E dev`` option when invoking Poetry

.. note::

If you get an error saying that your machine does not have a compatible version, this means that you do not have Python 3.7 or later on your PATH.
If you get an error saying that your machine does not have a compatible version, this means that you do not have Python 3.8 or later on your PATH.
Install a newer version of Python, either directly from the `Python website <https://www.python.org/downloads/>`_ or using `pyenv <https://github.com/pyenv/pyenv>`_ (e.g. running :command:`pyenv install 3.8.5`).
If you install it somewhere that is not on your PATH (so running :command:`python --version` doesn't give you the correct version), you'll need to run :command:`poetry env use /full/path/to/python` before running :command:`poetry install`.

Expand Down
71 changes: 34 additions & 37 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,59 +1,56 @@
alabaster==0.7.12; python_version >= "3.6"
alabaster==0.7.12; python_version >= "3.5"
antlr4-python3-runtime==4.8
appdirs==1.4.4; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
astor==0.8.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
atomicwrites==1.4.0; python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.4.0"
attrs==19.3.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
babel==2.9.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
certifi==2021.5.30; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
chardet==4.0.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
babel==2.9.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5"
certifi==2020.12.5; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
chardet==4.0.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
colorama==0.4.4; python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" and platform_system == "Windows" or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.5.0" and platform_system == "Windows"
cycler==0.10.0; python_version >= "3.7"
decorator==5.0.9; python_version >= "3.5"
distlib==0.3.2; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
docutils==0.16; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
distlib==0.3.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
docutils==0.16; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
dotmap==1.3.23
filelock==3.0.12; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
idna==2.10; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
imagesize==1.2.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
importlib-metadata==3.10.1; python_version < "3.8" and python_version >= "3.6" and (python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_full_version >= "3.5.0" and python_version < "3.8" and python_version >= "3.6") and (python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_full_version >= "3.4.0" and python_version >= "3.6" and python_version < "3.8") or python_version >= "3.7" and python_version < "3.8"
idna==2.10; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
imagesize==1.2.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5"
iniconfig==1.1.1; python_version >= "3.6"
jinja2==3.0.1; python_version >= "3.6"
jinja2==2.11.3; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
kiwisolver==1.3.1; python_version >= "3.7"
mapbox-earcut==0.12.10
markupsafe==2.0.1; python_version >= "3.6"
matplotlib==3.4.2; python_version >= "3.7"
numpy==1.21.0; python_version >= "3.7"
opencv-python==4.5.2.54; python_version >= "3.6"
markupsafe==1.1.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
matplotlib==3.4.1; python_version >= "3.7"
numpy==1.20.2; python_version >= "3.7"
opencv-python==4.5.1.48; python_version >= "3.6"
packaging==20.9; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
pillow==8.2.0; python_version >= "3.6"
pillow==8.1.2; python_version >= "3.6"
pluggy==0.13.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
py==1.10.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
pygame==2.0.1
pygments==2.9.0; python_version >= "3.6"
pygments==2.8.1; python_version >= "3.5"
pynverse==0.1.4.4
pyparsing==2.4.7; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
pyproj==3.1.0; python_version >= "3.7"
pytest-randomly==3.8.0; python_version >= "3.6"
pytest==6.2.4; python_version >= "3.6"
pyproj==3.0.1; python_version >= "3.6"
pytest-randomly==3.5.0; python_version >= "3.5"
pytest==6.2.2; python_version >= "3.6"
python-dateutil==2.8.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.7"
pytz==2021.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
requests==2.25.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
pytz==2021.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5"
requests==2.25.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
scipy==1.6.1; python_version >= "3.7"
shapely==1.7.1
six==1.16.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
snowballstemmer==2.1.0; python_version >= "3.6"
sphinx-rtd-theme==0.5.2
sphinx==4.0.2; python_version >= "3.6"
sphinxcontrib-applehelp==1.0.2; python_version >= "3.6"
sphinxcontrib-devhelp==1.0.2; python_version >= "3.6"
sphinxcontrib-htmlhelp==2.0.0; python_version >= "3.6"
sphinxcontrib-jsmath==1.0.1; python_version >= "3.6"
sphinxcontrib-qthelp==1.0.3; python_version >= "3.6"
sphinxcontrib-serializinghtml==1.1.5; python_version >= "3.6"
six==1.15.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
snowballstemmer==2.1.0; python_version >= "3.5"
sphinx-rtd-theme==0.4.3
sphinx==3.5.3; python_version >= "3.5"
sphinxcontrib-applehelp==1.0.2; python_version >= "3.5"
sphinxcontrib-devhelp==1.0.2; python_version >= "3.5"
sphinxcontrib-htmlhelp==1.0.3; python_version >= "3.5"
sphinxcontrib-jsmath==1.0.1; python_version >= "3.5"
sphinxcontrib-qthelp==1.0.3; python_version >= "3.5"
sphinxcontrib-serializinghtml==1.1.4; python_version >= "3.5"
toml==0.10.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
tox==3.23.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
typing-extensions==3.10.0.0; python_version >= "3.7" and python_version < "3.8"
urllib3==1.26.6; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version < "4" and python_version >= "3.6"
virtualenv==20.4.7; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
zipp==3.4.1; python_version >= "3.7" and python_version < "3.8"
tox==3.23.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
urllib3==1.26.4; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version < "4" and python_version >= "3.5"
virtualenv==20.4.3; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
wrapt==1.12.1
6 changes: 3 additions & 3 deletions examples/driving/OAS_Scenarios/oas_scenario_04.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ The ego vehicle follows the lead car which suddenly stops
"""

#SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc)
param map = localPath('../../../tests/formats/opendrive/maps/CARLA/Town07.xodr') # or other CARLA map that definitely works
param carla_map = 'Town07'
param map = localPath('../../../tests/formats/opendrive/maps/LGSVL/cubetown.xodr') # or other CARLA map that definitely works
param lgsvl_map = 'CubeTown'
model scenic.domains.driving.model

#CONSTANTS
Expand Down Expand Up @@ -49,4 +49,4 @@ other = Car on select_lane.centerline,
with behavior LeadCarBehavior()

ego = Car following roadDirection from other for INITIAL_DISTANCE_APART,
with behavior FollowLeadCarBehavior()
with behavior FollowLeadCarBehavior()
4 changes: 2 additions & 2 deletions examples/driving/OAS_Scenarios/oas_scenario_28.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ because it is closer to the intersection.
"""

#SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc)
param map = localPath('../../../tests/formats/opendrive/maps/CARLA/Town05.xodr') # or other CARLA map that definitely works
param carla_map = 'Town05'
param map = localPath('../../../tests/formats/opendrive/maps/LGSVL/cubetown.xodr') # or other CARLA map that definitely works
param carla_map = 'CubeTown'
model scenic.domains.driving.model

param time_step = 1.0/10
Expand Down
4 changes: 2 additions & 2 deletions examples/driving/OAS_Scenarios/oas_scenario_29.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ has the right of the way and makes a left turn first because it is closer to the
"""

#SET MAP AND MODEL (i.e. definitions of all referenceable vehicle types, road library, etc)
param map = localPath('../../../tests/formats/opendrive/maps/CARLA/Town05.xodr') # or other CARLA map that definitely works
param carla_map = 'Town05'
param map = localPath('../../../tests/formats/opendrive/maps/LGSVL/cubetown.xodr') # or other CARLA map that definitely works
param lgsvl_map = 'CubeTown'
model scenic.domains.driving.model

# Constants
Expand Down
8 changes: 5 additions & 3 deletions examples/driving/badlyParkedCarPullingIn.scenic
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
param map = localPath('../../tests/formats/opendrive/maps/CARLA/Town05.xodr')
param carla_map = 'Town05'
param map = localPath('../../tests/formats/opendrive/maps/LGSVL/cubetown.xodr')
param lgsvl_map = 'CubeTown'
param time_step = 1.0/10

model scenic.domains.driving.model
Expand All @@ -10,7 +10,9 @@ behavior PullIntoRoad():
do FollowLaneBehavior(laneToFollow=ego.lane)

ego = Car with behavior DriveAvoidingCollisions(avoidance_threshold=5)

x = 10
print('lgsvl--', x)
x =x+10
rightCurb = ego.laneGroup.curb
spot = OrientedPoint on visible rightCurb
badAngle = Uniform(1.0, -1.0) * Range(10, 20) deg
Expand Down
6 changes: 3 additions & 3 deletions examples/lgsvl/carla_challenge_10.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# param map = localPath('maps/borregasave.xodr')
# param lgsvl_map = 'BorregasAve'

param map = localPath('../carla/OpenDrive/Town03.xodr')
param carla_map = 'Town03'
param map = localPath('maps/cubetown.xodr')
param lgsvl_map = 'CubeTown'
param time_step = 1.0/10

model scenic.simulators.lgsvl.model
Expand Down Expand Up @@ -143,4 +143,4 @@ actorCar = Car following roadDirection from pos2 by -actorDist,

terminate when ego in egoManeuver.endLane
terminate when actorCar in actorTurn.endLane
terminate when simulation().currentTime > MAX_TIME
terminate when simulation().currentTime > MAX_TIME
9 changes: 9 additions & 0 deletions examples/lgsvl/sample.scenic
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
param map = localPath('../../tests/formats/opendrive/maps/LGSVL/cubetown.xodr')
param lgsvl_map = 'CubeTown'
param time_step = 1.0/10

model scenic.domains.driving.model
from scenic.simulators.lgsvl.model import Car

ego = Car
Car
15 changes: 8 additions & 7 deletions examples/lgsvl/scenic-cut-in-new.scenic
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@

param map = localPath('maps/Straight2LaneSame.xodr')
param lgsvl_map = 'Straight2LaneSame'
param apolloHDMap = 'Straight2LaneSame'
param map = localPath('maps/cubeTown.xodr')
param lgsvl_map = 'cubeTown'
param apolloHDMap = 'cubeTown'
param time_step = 1.0/2

model scenic.simulators.lgsvl.model


egoStartPos = OrientedPoint on road
egoStartPos = Point on road
egoDestination = follow roadDirection from egoStartPos for 100
require egoDestination in road

ego = EgoCar at egoStartPos,
with behavior DriveTo(egoDestination)
ego = Car at egoStartPos,
with behavior DriveTo(egoDestination)
print("***** : ",ego)

npcStartPos = egoStartPos offset by -3.5 @ 0

Expand All @@ -31,7 +32,7 @@ waypoints = [npcWP0, npcWP1, npcWP2, npcWP3]

npc = Car at npcStartPos,
with behavior FollowWaypoints(waypoints),
with lgsvlName Uniform('Sedan', 'SUV', 'Hatchback', 'Jeep')
with lgsvlName Uniform('Sedan')

# Require NPC to be headed approximately the same way as the ego
require abs(relative heading of npc) <= 20 deg
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"
dotmap = "^1.3.13"
shapely = "^1.7.0"
mapbox_earcut = "^0.12.10"
Expand All @@ -33,18 +33,17 @@ opencv-python = "^4.2.0.34"
numpy = "^1.18.2"
pillow = "^8.1.1"
pynverse = "^0.1.4"
pygame = "^2.0.1"
pygame = "^2.0.0.dev6"
attrs = "^19.3.0"
decorator = "^5.0.9"
importlib_metadata = { version = "^3.7", python = "~3.7" }
wrapt = "^1.12.1"

pyproj = {version = "^3.0.0", optional = true}

pytest-randomly = {version = "^3.2.1", optional = true}
pytest = {version = "^6.0.0", optional = true}
sphinx = {version = ">=3.3.0, <5", optional = true}
sphinx = {version = "^3.1.0", optional = true}
tox = {version = "^3.14.0", optional = true}
sphinx_rtd_theme = {version = "^0.5.2", optional = true}
sphinx_rtd_theme = {version = "^0.4.3", optional = true}
astor = {version = "^0.8.1", optional = true}

[tool.poetry.extras]
Expand Down
12 changes: 5 additions & 7 deletions src/scenic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
import time
import argparse
import random

if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata
import importlib.metadata

import scenic.syntax.translator as translator
import scenic.core.errors as errors
Expand Down Expand Up @@ -40,6 +36,8 @@
type=int, default=None)
simOpts.add_argument('--count', help='number of successful simulations to run (default infinity)',
type=int, default=0)
simOpts.add_argument('--mycmd',help='testing (default none)', #sneha
type=float,default=0.0)
simOpts.add_argument('--max-sims-per-scene', type=int, default=1, metavar='N',
help='max # of rejected simulations before sampling a new scene (default 1)')

Expand All @@ -59,7 +57,7 @@
action='store_true')
debugOpts.add_argument('--pdb', action='store_true',
help='enter interactive debugger on errors (implies "-b")')
ver = metadata.version('scenic')
ver = importlib.metadata.version('scenic')
debugOpts.add_argument('--version', action='version', version=f'Scenic {ver}',
help='print Scenic version information and exit')
debugOpts.add_argument('--dump-initial-python', help='dump initial translated Python',
Expand Down Expand Up @@ -170,7 +168,7 @@ def runSimulation(scene):
else:
scene.show(zoom=args.zoom, block=False)
plt.pause(delay)
plt.clf()
plt.clf()
else: # Gather statistics over the specified number of scenes
its = []
startTime = time.time()
Expand Down
Loading