-
Notifications
You must be signed in to change notification settings - Fork 192
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
Add bubble_env
to benchmark.
#1814
Open
Gamenot
wants to merge
4
commits into
master
Choose a base branch
from
tucker/add-driving_smarts_full_v0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# MIT License | ||
# | ||
# Copyright (C) 2023. Huawei Technologies Co., Ltd. All rights reserved. | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# MIT License | ||
# | ||
# Copyright (C) 2023. Huawei Technologies Co., Ltd. All rights reserved. | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
from pathlib import Path | ||
|
||
DEFAULT_CONFIG = str((Path(__file__).parent / "config.yaml").absolute()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# smarts/benchmark/driving_smarts_v0/config.yaml | ||
--- | ||
benchmark: | ||
name: "Driving SMARTS V0" | ||
message: | # A useful message given at the start of the benchmark. | ||
This is a cleaned up version of the Driving SMARTS benchmark. | ||
|
||
Using `TargetPose` agent action has an applied 28m/s cap for agent motion. | ||
Using `RelativeTargetPose` agent action, the constraint is inbuilt into the action space. | ||
|
||
If bubble_env is not installed, please install the bubble_env repository: | ||
|
||
```bash | ||
# set $REPOS to wherever you wish to store the repository. | ||
git lfs clone https://bitbucket.org/malban/bubble_env.git $REPOS/bubble_env | ||
# read $REPOS/README.md and follow those instructions | ||
pip install $REPOS/bubble_env | ||
``` | ||
|
||
For history see: | ||
- https://codalab.lisn.upsaclay.fr/competitions/6618 | ||
- https://smarts-project.github.io/archive/2022_nips_driving_smarts/ | ||
eval_episodes: 50 | ||
shared_env_kwargs: | ||
seed: 42 | ||
headless: true | ||
envs: | ||
bubble: # reserved for bubble env | ||
loc: "smarts.env:driving-smarts-competition-bubble-env-v0" | ||
scenarios: | ||
- 6 | ||
- 4 | ||
- 42 | ||
standard: | ||
loc: "smarts.env:driving-smarts-competition-v0" | ||
scenarios: | ||
- 1_to_2lane_left_turn_c | ||
- 1_to_2lane_left_turn_t | ||
- 3lane_merge_multi_agent | ||
- 3lane_merge_single_agent | ||
- 3lane_cruise_multi_agent | ||
- 3lane_cruise_single_agent | ||
- 3lane_cut_in | ||
- 3lane_overtake | ||
kwargs: | ||
seed: 42 | ||
# kwargs: | ||
# naturalistic: # reserved for driving_smarts_competition_naturalistic-v0 | ||
# loc: "smarts.env:driving_smarts_competition_naturalistic-v0" | ||
# kwargs: | ||
# scenario_dirs: | ||
# - "./scenarios/naturalistic/waymo" | ||
# - "./scenarios/naturalistic/ngsim" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# MIT License | ||
# | ||
# Copyright (C) 2022. Huawei Technologies Co., Ltd. All rights reserved. | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# 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 gymnasium as gym | ||
|
||
from smarts.core.agent_interface import AgentInterface | ||
|
||
|
||
def checked_bubble_env_v0( | ||
agent_interface: AgentInterface, | ||
headless: bool = True, | ||
seed: int = 42, | ||
**kwargs, | ||
): | ||
"""Imports and generates the `bubble_env` environment which converts nearby replay | ||
traffic (non-reactive) into model based traffic (reactive). This uses the NGSIM i80 | ||
dataset as a basis. | ||
|
||
Args: | ||
traffic_mode (Literal["traffic_A"]): The version of bubble traffic to use. | ||
action_space (ActionSpaceType): The action space the agent should use. | ||
img_meters (float): The square side dimensions of the surface the top-down rgb image | ||
portrays. This affects resolution. | ||
img_pixels (float): The total number of pixels in the top-down rgb image. This affects | ||
resolution. | ||
headless (bool): If the environment should display sumo-gui. | ||
seed (int): The seed of the environment. | ||
Comment on lines
+38
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docstring needs to be updated to match the |
||
|
||
|
||
Returns: | ||
(gymnasium.Env): The bubble_env environment. | ||
|
||
Raises: | ||
ImportError: If `bubble_env` is not installed. | ||
""" | ||
try: | ||
import bubble_env_contrib | ||
except ImportError as err: | ||
raise ImportError( | ||
""" | ||
Bubble env is not installed. | ||
|
||
If bubble_env is not installed, please install the bubble_env repository: | ||
|
||
```bash | ||
# set $REPOS to wherever you wish to store the repository. | ||
git lfs clone https://bitbucket.org/malban/bubble_env.git $REPOS/bubble_env | ||
# read $REPOS/README.md and follow those instructions | ||
cd - | ||
pip install $REPOS/bubble_env | ||
``` | ||
""", | ||
"Install bubble_env", | ||
) from err | ||
|
||
env = gym.make( | ||
"bubble_env_contrib:bubble_env-v1", | ||
agent_interface=agent_interface, | ||
headless=headless, | ||
seed=seed, | ||
) | ||
return env |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps simply name it as
bubble_env_v0
?