-
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 actor alive interface #1919
Changes from all commits
3074d97
d48ee8f
0b1ca08
19e8593
2b1a636
fadb6a9
c8cd908
a80b03c
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 | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -20,7 +20,7 @@ | |||||||||||||||||||||||||||
import warnings | ||||||||||||||||||||||||||||
from dataclasses import dataclass, field, replace | ||||||||||||||||||||||||||||
from enum import IntEnum | ||||||||||||||||||||||||||||
from typing import List, Optional, Union | ||||||||||||||||||||||||||||
from typing import List, Optional, Tuple, Union | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
from smarts.core.controllers import ActionSpaceType | ||||||||||||||||||||||||||||
from smarts.core.lidar_sensor_params import BasicLidar | ||||||||||||||||||||||||||||
|
@@ -193,6 +193,19 @@ class AgentsAliveDoneCriteria: | |||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
@dataclass(frozen=True) | ||||||||||||||||||||||||||||
class ActorsAliveDoneCriteria: | ||||||||||||||||||||||||||||
"""Require actors to persist.""" | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
actors_of_interest: Tuple[str, ...] = () | ||||||||||||||||||||||||||||
"""Actors that should exist to continue this agent.""" | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
strict: bool = True | ||||||||||||||||||||||||||||
"""If strict the agent will be done instantly if an actor of interest is not available | ||||||||||||||||||||||||||||
immediately. | ||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
@dataclass(frozen=True) | ||||||||||||||||||||||||||||
class EventConfiguration: | ||||||||||||||||||||||||||||
"""Configure the conditions in which an Event is triggered.""" | ||||||||||||||||||||||||||||
|
@@ -225,6 +238,8 @@ class DoneCriteria: | |||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||
agents_alive: Optional[AgentsAliveDoneCriteria] = None | ||||||||||||||||||||||||||||
"""If set, triggers the ego agent to be done based on the number of active agents for multi-agent purposes.""" | ||||||||||||||||||||||||||||
actors_alive: Optional[ActorsAliveDoneCriteria] = None | ||||||||||||||||||||||||||||
"""If set, triggers the ego agent to be done based on actors existing in the simulation.""" | ||||||||||||||||||||||||||||
Comment on lines
239
to
+242
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. If possible, it might be better to combine or unify 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. I think what you are considering is the difference between AND and OR causing termination. It is slightly difficult to satisfy these complex cases without introducing expressions. I think we do not have the case for AND currently. 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. When we use a single env to cater to two types of scenarios, namely (i) one which uses and terminates with the social agent as the leader, and (ii) one which uses and terminates with the sumo vehicle as the leader, we end up with a code which looks like [Assume lines 151 to 158 are uncommented] SMARTS/smarts/env/gymnasium/platoon_env.py Lines 151 to 163 in 7cdc5c3
Here, the env will terminate immediately every time as one of the done criteria, namely Another issue here is the name of vehicle of interest differs in both scenarios, because |
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
@dataclass | ||||||||||||||||||||||||||||
|
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.
We could modify an exisiting test or add a new test to check for the actors alive done criteria.