sumo
sumo copied to clipboard
Traci multiple parameter subscriptions
Is there a way to add subscriptions to multiple parameters?
I would like to to get the "device.battery.actualBatteryCapacity" and the "device.battery.energyCharged" parameters using subscriptions.
I can get one of them using the following code:
traci.vehicle.subscribe(veh, [traci.constants.VAR_PARAMETER], parameters={
traci.constants.VAR_PARAMETER: "device.battery.actualBatteryCapacity"
})
But this will not work for multiple ones (since the output of getSubscriptionResults is an dictionary with the key set to traci.constants.VAR_PARAMETER
No, currently there is no way to do this. I keep it open as a feature request
One tiny workaround is to use another subscription with VAR_PARAMETER_WITH_KEY. This way you will at least get two values
Thank you for that Idea. I actually only need two (as of now), thus it should work.
My current workaround is that I added new Traci constants for the two parameters that I need.