-
Notifications
You must be signed in to change notification settings - Fork 0
Should spawner modify the list of all vehicles directly? #4
Description
Per discussion here: #2 (comment)
I'd let the spawner directly add the new vehicle to the self.vehicles set when
step_vehiclesis 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
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?