From 8988b392f3a9077010442742d6b05b67dceaa79b Mon Sep 17 00:00:00 2001 From: Tucker Date: Tue, 2 May 2023 11:33:22 -0400 Subject: [PATCH 1/3] Update chase via points agent --- zoo/policies/__init__.py | 2 +- zoo/policies/chase_via_points_agent.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/zoo/policies/__init__.py b/zoo/policies/__init__.py index abb505aeaa..a46097bf27 100644 --- a/zoo/policies/__init__.py +++ b/zoo/policies/__init__.py @@ -63,7 +63,7 @@ lane_positions=False, lidar_point_cloud=False, max_episode_steps=None, - neighborhood_vehicle_states=True, + neighborhood_vehicle_states=False, occupancy_grid_map=False, top_down_rgb=False, road_waypoints=False, diff --git a/zoo/policies/chase_via_points_agent.py b/zoo/policies/chase_via_points_agent.py index 8d91909677..a035fdabce 100644 --- a/zoo/policies/chase_via_points_agent.py +++ b/zoo/policies/chase_via_points_agent.py @@ -1,17 +1,26 @@ +import math +from functools import reduce +from typing import Dict, List + import numpy as np from smarts.core.agent import Agent -from smarts.core.observations import Observation +from smarts.core.observations import Observation, VehicleObservation from smarts.core.sensors import LANE_ID_CONSTANT +from smarts.core.utils.math import squared_dist +from smarts.env.custom_observations import scan_for_vehicles class ChaseViaPointsAgent(Agent): def act(self, obs: Observation): - assert obs.waypoint_paths, ( + assert obs.waypoint_paths is not None, ( f"Waypoint paths = {obs.waypoint_paths}; " "cannot be empty or None. Enable waypoint paths in agent interface." ) + if len(obs.waypoint_paths) == 0: + return (1, 0) + lane_change_dist = 80 # Truncate all paths to be of the same length From da672d42768d6c62147ef5b5fe98e8eae1ce7217 Mon Sep 17 00:00:00 2001 From: Tucker Date: Tue, 2 May 2023 11:34:45 -0400 Subject: [PATCH 2/3] Revert import changes. --- zoo/policies/chase_via_points_agent.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/zoo/policies/chase_via_points_agent.py b/zoo/policies/chase_via_points_agent.py index a035fdabce..0b25c9d8ee 100644 --- a/zoo/policies/chase_via_points_agent.py +++ b/zoo/policies/chase_via_points_agent.py @@ -1,14 +1,8 @@ -import math -from functools import reduce -from typing import Dict, List - import numpy as np from smarts.core.agent import Agent -from smarts.core.observations import Observation, VehicleObservation +from smarts.core.observations import Observation from smarts.core.sensors import LANE_ID_CONSTANT -from smarts.core.utils.math import squared_dist -from smarts.env.custom_observations import scan_for_vehicles class ChaseViaPointsAgent(Agent): From 408ae24a104c033eb54c99c35305557fda7760ae Mon Sep 17 00:00:00 2001 From: Tucker Date: Wed, 3 May 2023 09:58:32 -0400 Subject: [PATCH 3/3] Remove default motion change. --- zoo/policies/chase_via_points_agent.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/zoo/policies/chase_via_points_agent.py b/zoo/policies/chase_via_points_agent.py index 0b25c9d8ee..8d91909677 100644 --- a/zoo/policies/chase_via_points_agent.py +++ b/zoo/policies/chase_via_points_agent.py @@ -7,14 +7,11 @@ class ChaseViaPointsAgent(Agent): def act(self, obs: Observation): - assert obs.waypoint_paths is not None, ( + assert obs.waypoint_paths, ( f"Waypoint paths = {obs.waypoint_paths}; " "cannot be empty or None. Enable waypoint paths in agent interface." ) - if len(obs.waypoint_paths) == 0: - return (1, 0) - lane_change_dist = 80 # Truncate all paths to be of the same length