Skip to content
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

Should spawner modify the list of all vehicles directly? #4

Open
CarlinLiao opened this issue Feb 6, 2021 · 0 comments
Open

Should spawner modify the list of all vehicles directly? #4

CarlinLiao opened this issue Feb 6, 2021 · 0 comments
Assignees

Comments

@CarlinLiao
Copy link
Member

CarlinLiao commented Feb 6, 2021

https://github.com/spartalab/aimsim/blob/56e9beaeb158b0c045f117e3b44f2c7421879659/aimsim/simulator.py#L317-L327

Per discussion here: #2 (comment)

@ribsthakkar

I'd let the spawner directly add the new vehicle to the self.vehicles set when step_vehicles is called. It makes this a bit unclear and will let you expect uniform return value rather than this None or some variable mixture.

also you didn't specify the type annotation here getting me to think that we just want this function never return anything in the first place

@CarlinLiao

The type annotation is on the definition of step_vehicles.

step_vehicles returns nothing unless u is a spawner and it spawns a vehicle this timestep. If so, it gives the vehicle to both the downstream road (for kinematics) and back to the parent simulator here so the simulator has a pointer to all vehicles currently in the system.

I don't follow how the spawner would have access to the self.vehicles list?

simulator owns spawner
simulator owns self.vehicles
would i pass self.vehicles to spawner so it can add to it itself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants