diff --git a/.github/workflows/ci-format.yml b/.github/workflows/ci-format.yml index 1151a5a988..6fbb8a30c7 100644 --- a/.github/workflows/ci-format.yml +++ b/.github/workflows/ci-format.yml @@ -1,12 +1,6 @@ name: SMARTS CI Format -on: - push: - branches-ignore: - - master - pull_request: - branches-ignore: - - master +on: [push, pull_request] env: venv_dir: .venv diff --git a/CHANGELOG.md b/CHANGELOG.md index db4c8af438..73107370d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,13 @@ Copy and pasting the git commit messages is __NOT__ enough. # [Unreleased] +### [0.6.1rc1] 15-04-18 +### Fixed +- Gracefully handle `EndlessGoal` missions in the MaRL benchmark. Relative goal distance with `EndlessGoal` will be now always be 0. +- Restore `rl-agent` to working order. Version incremented to `1.1.0`. +- Update `rl-agent` wheel. +- Add workaround for issue where traffic history starts offroad by fixing `scl scenario build`'s `--allow-offset-map` to work with traffic history. + ### [0.6.1rc0] 15-04-16 ### Added - Added `get_vehicle_start_time()` method for scenarios with traffic history data. See Issue #1210. diff --git a/baselines/marl_benchmark/common.py b/baselines/marl_benchmark/common.py index bba701f1b9..3aaf26918f 100644 --- a/baselines/marl_benchmark/common.py +++ b/baselines/marl_benchmark/common.py @@ -171,10 +171,11 @@ def cal_goal_relative_pos(env_obs: Observation, _): ego_state = env_obs.ego_vehicle_state goal = ego_state.mission.goal - assert isinstance(goal, PositionalGoal), goal ego_pos = ego_state.position[:2] - goal_pos = goal.position # the position of mission goal is 2-dimensional. + goal_pos = getattr( + goal, "position", ego_pos + ) # the position of mission goal is 2-dimensional. vector = np.asarray([goal_pos[0] - ego_pos[0], goal_pos[1] - ego_pos[1]]) # space = SPACE_LIB["goal_relative_pos"](None) # return vector / (space.high - space.low) diff --git a/baselines/marl_benchmark/metrics/basic_handler.py b/baselines/marl_benchmark/metrics/basic_handler.py index 69b66d0a2e..6a16311bc9 100644 --- a/baselines/marl_benchmark/metrics/basic_handler.py +++ b/baselines/marl_benchmark/metrics/basic_handler.py @@ -41,8 +41,8 @@ def agent_info_adapter(env_obs, shaped_reward: float, raw_info: dict): info["collision"] = 1 if len(env_obs.events.collisions) > 0 else 0 goal = env_obs.ego_vehicle_state.mission.goal - goal_pos = goal.position ego_2d_pos = env_obs.ego_vehicle_state.position[:2] + goal_pos = getattr(goal, "position", ego_2d_pos) info["distance_to_goal"] = distance.euclidean(ego_2d_pos, goal_pos) info["distance_to_center"] = CalObs.cal_distance_to_center(env_obs, "") diff --git a/baselines/marl_benchmark/wrappers/rllib/frame_stack.py b/baselines/marl_benchmark/wrappers/rllib/frame_stack.py index 6c1891c2a1..c038dbec12 100644 --- a/baselines/marl_benchmark/wrappers/rllib/frame_stack.py +++ b/baselines/marl_benchmark/wrappers/rllib/frame_stack.py @@ -234,20 +234,14 @@ def func(env_obs_seq, env_reward): # ======== Penalty: distance to goal ========= goal = last_env_obs.ego_vehicle_state.mission.goal ego_2d_position = last_env_obs.ego_vehicle_state.position[:2] - if hasattr(goal, "position"): - goal_position = goal.position - else: - goal_position = ego_2d_position + goal_position = getattr(goal, "position", ego_2d_position) goal_dist = distance.euclidean(ego_2d_position, goal_position) penalty += -0.01 * goal_dist old_obs = env_obs_seq[-2] old_goal = old_obs.ego_vehicle_state.mission.goal old_ego_2d_position = old_obs.ego_vehicle_state.position[:2] - if hasattr(old_goal, "position"): - old_goal_position = old_goal.position - else: - old_goal_position = old_ego_2d_position + old_goal_position = getattr(old_goal, "position", old_ego_2d_position) old_goal_dist = distance.euclidean(old_ego_2d_position, old_goal_position) penalty += 0.1 * (old_goal_dist - goal_dist) # 0.05 diff --git a/cli/studio.py b/cli/studio.py index 53adbe2b16..cd2eae79e6 100644 --- a/cli/studio.py +++ b/cli/studio.py @@ -71,7 +71,7 @@ def _build_single_scenario(clean: bool, allow_offset_map: bool, scenario: str): from smarts.core.scenario import Scenario traffic_histories = Scenario.discover_traffic_histories(scenario_root_str) - shift_to_origin = not allow_offset_map or bool(traffic_histories) + shift_to_origin = not allow_offset_map map_spec = Scenario.discover_map(scenario_root_str, shift_to_origin=shift_to_origin) road_map, _ = map_spec.builder_fn(map_spec) diff --git a/docs/sim/scenario_studio.rst b/docs/sim/scenario_studio.rst index 99f7b9cc4d..5929a9ba4f 100644 --- a/docs/sim/scenario_studio.rst +++ b/docs/sim/scenario_studio.rst @@ -24,7 +24,7 @@ Then in the scenario.py file: t.SocialAgentActor( name="my-rl-agent", - agent_locator="rl_agent:rl_agent-v0" + agent_locator="rl_agent:rl_agent-v1" ) diff --git a/examples/rllib/__init__.py b/examples/rllib/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/requirements.txt b/requirements.txt index 68c59923c2..c994e012e8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -59,7 +59,7 @@ hyperlink==21.0.0 idna==3.3 ijson==3.1.4 importlib-metadata==4.11.3 -importlib-resources==5.7.0 +importlib-resources==5.7.1 incremental==21.3.0 iniconfig==1.1.1 ipykernel==6.13.0 @@ -70,7 +70,7 @@ jsonpatch==1.32 jsonpointer==2.3 jsonschema==4.4.0 jupyter-client==7.2.2 -jupyter-core==4.9.2 +jupyter-core==4.10.0 jupyter-server==1.16.0 jupyter-server-mathjax==0.2.5 jupyterlab-pygments==0.2.2 @@ -170,7 +170,7 @@ tornado==6.1 traitlets==5.1.1 trimesh==3.9.29 Twisted==22.4.0 -typing_extensions==4.1.1 +typing_extensions==4.2.0 urllib3==1.26.9 visdom==0.1.8.9 wcwidth==0.2.5 diff --git a/scenarios/NGSIM/README.md b/scenarios/NGSIM/README.md index 918cd6f972..c4d01b24f5 100644 --- a/scenarios/NGSIM/README.md +++ b/scenarios/NGSIM/README.md @@ -16,6 +16,10 @@ Once that is done, you should be able to build your scenarios in the normal way, ```bash scl scenario build-all --clean scenarios/NGSIM ``` +or the following command to disable generating `shifted_map-AUTOGEN.net.xml` +```bash +scl scenario build-all --clean --allow-offset-map scenarios/NGSIM +``` For each traffic history `.yml` file specified in your `scenario.py`, this will creates a cooresponding `.shf` file that SMARTS will use diff --git a/scenarios/NGSIM/us101/map.net.xml b/scenarios/NGSIM/us101/map.net.xml index c6601d7cf0..58560c56bc 100644 --- a/scenarios/NGSIM/us101/map.net.xml +++ b/scenarios/NGSIM/us101/map.net.xml @@ -1,20 +1,20 @@ -