Skip to content

Commit

Permalink
update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirezaMorsali committed Oct 17, 2022
1 parent 35b49bd commit 21cd047
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 32 deletions.
1 change: 0 additions & 1 deletion examples/Demo_Drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
recurrent_states=response.recurrent_states,
get_birdviews=True,
location=args.location,
steps=1,
get_infractions=True,
)
pbar.set_description(
Expand Down
Binary file modified examples/iai-drive.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 15 additions & 4 deletions invertedai/api_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,30 @@ def location_info(
def initialize(
location="CARLA:Town03:Roundabout",
agent_count=1,
agent_attributes: List[AgentAttributes] = [],
states_history: Optional[List[List[AgentState]]] = [],
traffic_light_state_history: Optional[
List[Dict[TrafficLightId, TrafficLightState]]
] = [],
) -> InitializeResponse:
"""
Parameters
----------
location : str
Name of the location.
agent_attributes : List[AgentAttributes]
List of agent attributes
agent_count : int
Number of cars to spawn on the map
states_history: [List[List[AgentState]]]
History of agent states
traffic_light_state_history: Optional[List[Dict[TrafficLightId, TrafficLightState]]]
History of traffic light states
Returns
-------
Response : InitializeResponse
Expand Down Expand Up @@ -200,7 +214,6 @@ def drive(
agent_attributes: List[AgentAttributes] = [],
recurrent_states: Optional[List] = None,
get_birdviews: bool = False,
steps: int = 1,
get_infractions: bool = False,
exclude_ego_agent: bool = True,
present_mask: Optional[List] = None,
Expand All @@ -211,7 +224,7 @@ def drive(
location : str
Name of the location.
states : List[AgentState]
agent_states : List[AgentState]
List of agent states.
agent_attributes : List[AgentAttributes]
Expand Down Expand Up @@ -253,7 +266,6 @@ def drive(
states=response["states"],
recurrent_states=response["recurrent_states"],
traffic_states_id=response["traffic_states_id"],
steps=1,
get_birdviews=True,
get_infractions=True,)
"""
Expand All @@ -273,7 +285,6 @@ def _tolist(input_data: List):
agent_attributes=[state.tolist() for state in agent_attributes],
recurrent_states=recurrent_states,
# Expand from A to AxT_total for the API interface
steps=steps,
get_birdviews=get_birdviews,
get_infractions=get_infractions,
exclude_ego_agent=exclude_ego_agent,
Expand Down
27 changes: 0 additions & 27 deletions invertedai/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,32 +64,6 @@ class DriveResponse:

@dataclass
class InitializeResponse:
"""
agent_states : List[List[Tuple[(float,) * 4]]] (AxTx4)
List of positions and speeds of agents.
List of A (number of actors) lists,
each element is a list of size T (number of time steps),
each element is a list of 4 floats (x,y,speed, orientation)
recurrent_states : List[Tuple[(Tuple[(float,) * 64],) * 2]] (Ax2x64)
Internal state of simulation, which must be fedback to continue simulation
agent_attributes : List[Tuple[(float,) * 3]] (Ax3)
List of agent attributes
List of A (number of actors) lists,
each element is a list of x floats (width, length, lr)
traffic_light_state: Dict[str, str]
Dictionary of traffic light states.
Keys are the traffic-light ids and
values are light state: 'red', 'green', 'yellow' and 'red'
traffic_state_id: str
The id of the current stat of the traffic light,
which must be fedback to get the next state of the traffic light
"""

agent_states: List[AgentState]
agent_attributes: List[AgentAttributes]
recurrent_states: List[RecurrentStates]
Expand Down Expand Up @@ -122,7 +96,6 @@ class LocationResponse:
The length of the actor
<width> : float
The width of the actor
"""

rendered_map: List[int]
Expand Down

0 comments on commit 21cd047

Please sign in to comment.