Conversation
…eyedAgents and set AgentProperties
examples/keyed_large_map_example.py
Outdated
There was a problem hiding this comment.
I think making 3 additional example files is a tad excessive and will muddy our examples directory.
There was a problem hiding this comment.
I think one example file should suffice at most. It may be easier to add this to an existing file instead.
examples/keyed_large_map_example.py
Outdated
| agents.set_recurrent_states(response.recurrent_states) | ||
| print(f"Begin stepping through simulation.") | ||
| for _ in tqdm(range(args.sim_length)): | ||
| response = iai.large_drive( |
There was a problem hiding this comment.
The functionality of the keyed agents are meant to replicate the same assumptions as the current SDK functionality. In this case, it means the mutability of parameters needs to remain the same (i.e. values should be passed by value, not be reference). This means that you will need to update the DriveResponse and InitializeResponse classes to return a KeyedAgents object with the update AgentData with the same keys.
There was a problem hiding this comment.
My vision is that the change to a script using keyed_agents vs what currently exists will only change by a few lines. Those lines being where the data is retrieved from the response object (e.g. for subsequent drive() calls or getting the data for logging/visualization).
invertedai/large/drive.py
Outdated
There was a problem hiding this comment.
large_initialize should be updated as well.
invertedai/keyed_agent.py
Outdated
| for i in range(num_agents): | ||
| aid = f"agent_{i}" | ||
| agents_dict[aid] = AgentData( | ||
| properties=get_default_agent_properties({AgentType.car: 1})[0] | ||
| ) |
There was a problem hiding this comment.
This can be reduced to a single line by passing num_agents to get_default_agent_properties().
invertedai/api/drive.py
Outdated
| def drive( | ||
| location: str, | ||
| agent_states: List[AgentState], | ||
| agent_states: Optional[List[AgentState]] = None, |
There was a problem hiding this comment.
Since agent_states is possibly Optional now, there should be a parameter validation step checking to make sure key_agents and agent_states are both not None.
There was a problem hiding this comment.
This should be repeated anywhere agent_states has become Optional due to the existence of keyed_agents.
Generate agents from iai.initialize calls
Users can optionally pass keys per agent requested (whether pre-existing or sampled agents)
Default behaviour: give all agents a UUID keys to store in agent_dict{}
Provide getters and setters for the AgentData so the user can manipulate them at will
Add Waypoints as a separate field into the AgentData (thus allowing us to not have to rely on InitializeResponse.AgentProperties)
Calls iai.large_drive and iai.large_initialize when you call AgentDataManager.drive and AgentDataManager.Initialize and packs/unpacks agent states/properties/recurrent states as necessary.
Allow the AgentDataManager to take in different class Config and therefore create new Configs for classes (such as a LoggerConfig) as necessary to initialize them within AgentDataManager
Integrate these different classes (like the waypoint manager, logger) into the AgentDataManager class before and after the iai.initialize/iai.drive calls
Conduct data validation for all data and configuration combinations with appropriate error messages if data is formatted incorrectly