-
Notifications
You must be signed in to change notification settings - Fork 220
Remove vehicle type from agent interface #1294
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -573,7 +573,7 @@ def create_vehicle_in_providers( | |
| provider.create_vehicle( | ||
| VehicleState( | ||
| vehicle_id=vehicle.id, | ||
| vehicle_config_type="passenger", | ||
| vehicle_config_type=vehicle._vehicle_config_type, | ||
| pose=vehicle.pose, | ||
| dimensions=vehicle.chassis.dimensions, | ||
| speed=vehicle.speed, | ||
|
|
@@ -928,7 +928,7 @@ def _get_provider_state(self, source: str, action_space_pred) -> ProviderState: | |
| provider_state.vehicles.append( | ||
| VehicleState( | ||
| vehicle_id=vehicle.id, | ||
| vehicle_config_type="passenger", | ||
| vehicle_config_type=vehicle._vehicle_config_type, | ||
| pose=vehicle.pose, | ||
| dimensions=vehicle.chassis.dimensions, | ||
| speed=vehicle.speed, | ||
|
|
@@ -1239,7 +1239,6 @@ def _perform_agent_actions(self, agent_actions): | |
| controller_state, | ||
| sensor_state, | ||
| agent_interface.action_space, | ||
| agent_interface.vehicle_type, | ||
| ) | ||
|
|
||
| def _sync_vehicles_to_renderer(self): | ||
|
|
@@ -1354,10 +1353,15 @@ def _try_emit_envision_state(self, provider_state: ProviderState, obs, scores): | |
| for paths in vehicle_obs.road_waypoints.lanes.values() | ||
| for path in paths | ||
| ] | ||
|
|
||
| veh_type = ( | ||
| v.vehicle_config_type if v.vehicle_config_type else v.vehicle_type | ||
| ) | ||
|
|
||
| traffic[v.vehicle_id] = envision_types.TrafficActorState( | ||
| name=self._agent_manager.agent_name(agent_id), | ||
| actor_type=actor_type, | ||
| vehicle_type=envision_types.VehicleType.Car, | ||
| vehicle_type=veh_type, | ||
|
Contributor
Author
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. This change seems to cause the ego vehicle to be the wrong color (grey instead of red) on SUMO maps |
||
| position=tuple(v.pose.position), | ||
| heading=float(v.pose.heading), | ||
| speed=v.speed, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -394,9 +394,16 @@ def build_agent_vehicle( | |
| SceneColors.Agent.value if trainable else SceneColors.SocialAgent.value | ||
| ) | ||
|
|
||
| if agent_interface.vehicle_type == "sedan": | ||
| if mission.vehicle_spec == None: | ||
| vehicle_type = "passenger" | ||
| controller_type = "sedan" | ||
| else: | ||
| vehicle_type = mission.vehicle_spec.veh_config_type | ||
|
Contributor
Author
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. is this the right place to get the vehicle type?
Collaborator
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. Yes, although I am slightly confused as to why the
Contributor
Author
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. where should |
||
| controller_type = vehicle_type | ||
|
|
||
| if vehicle_type == "passenger": | ||
| urdf_name = "vehicle" | ||
| elif agent_interface.vehicle_type == "bus": | ||
| elif vehicle_type == "bus": | ||
| urdf_name = "bus" | ||
| else: | ||
| raise Exception("Vehicle type does not exist!!!") | ||
|
|
@@ -406,7 +413,7 @@ def build_agent_vehicle( | |
| vehicle_filepath = str(path.absolute()) | ||
|
|
||
| controller_parameters = sim.vehicle_index.controller_params_for_vehicle_type( | ||
| agent_interface.vehicle_type | ||
| controller_type | ||
| ) | ||
|
|
||
| chassis = None | ||
|
|
@@ -438,6 +445,7 @@ def build_agent_vehicle( | |
| id=vehicle_id, | ||
| chassis=chassis, | ||
| color=vehicle_color, | ||
| vehicle_config_type=vehicle_type | ||
| ) | ||
|
|
||
| return vehicle | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ | |
| from shapely.ops import split, unary_union | ||
|
|
||
| from smarts.core import gen_id | ||
| from smarts.core.coordinates import RefLinePoint | ||
| from smarts.core.coordinates import RefLinePoint, Dimensions | ||
| from smarts.core.default_map_builder import get_road_map | ||
| from smarts.core.road_map import RoadMap | ||
| from smarts.core.utils.id import SocialAgentId | ||
|
|
@@ -464,6 +464,14 @@ class TrapEntryTactic(EntryTactic): | |
| """The speed that the vehicle starts at when the hijack limit expiry emits a new vehicle""" | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class VehicleSpec: | ||
| """Vehicle specifications""" | ||
|
|
||
| veh_id: str | ||
| veh_config_type: str | ||
|
Contributor
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. This is problematic because we have been and are still distinguishing in our (core) code between |
||
| dimensions: Dimensions | ||
|
|
||
| @dataclass(frozen=True) | ||
| class Mission: | ||
| """The descriptor for an actor's mission.""" | ||
|
|
@@ -482,6 +490,9 @@ class Mission: | |
| entry_tactic: Optional[EntryTactic] = None | ||
| """A specific tactic the mission should employ to start the mission.""" | ||
|
|
||
| vehicle_spec: Optional[VehicleSpec] = None | ||
| """Vehicle Specifications""" | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class EndlessMission: | ||
|
|
@@ -503,6 +514,8 @@ class EndlessMission: | |
| """The earliest simulation time that this mission starts""" | ||
| entry_tactic: Optional[EntryTactic] = None | ||
| """A specific tactic the mission should employ to start the mission""" | ||
| vehicle_spec: Optional[VehicleSpec] = None | ||
| """Vehicle Specifications""" | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
|
|
@@ -521,6 +534,8 @@ class LapMission: | |
| """The earliest simulation time that this mission starts""" | ||
| entry_tactic: Optional[EntryTactic] = None | ||
| """A specific tactic the mission should employ to start the mission""" | ||
| vehicle_spec: Optional[VehicleSpec] = None | ||
| """Vehicle Specifications""" | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.