Hi Tianjia,
 
I can confirm that it isn't working because it hasn't been implemented yet. 
There are a few other cases where a more complex data structure is returned 
which work in TraCI only currently.
 
Best regards
Mirko
 
 
 
-----Original-Nachricht-----
Betreff: [sumo-user] Subscriptions using libsumo
Datum: 2023-10-30T19:57:21+0100
Von: "Tianjia Yang via sumo-user" <sumo-user@eclipse.org>
An: "Sumo project User discussions" <sumo-user@eclipse.org>
 
 
 
Hi there,
 
I tried moving from traci to Libsumo to improve performance but ran into a 
problem. The code I use is as follows:

import traci.constants as tc

for veh_id in traci.vehicle.getIDList():
 traci.vehicle.subscribe(
 veh_id,
 (
 tc.VAR_NEXT_TLS,
 tc.VAR_LANE_ID,
 tc.VAR_SPEED,
 tc.VAR_TYPE,
 tc.VAR_TIMELOSS
 ),
 )
 veh_sub = traci.vehicle.getSubscriptionResults(veh_id)
 print('veh_sub:', veh_sub)

When I use traci, it works well and outputs all five values of these five 
variables I have subscribed as follows:
veh_sub: {112: (('J1', 14, 151.06976563317193, 'r'),), 81: 'E0_0', 64: 
13.67491418338082, 79: 'cv', 140: 0.5058405663126192}.
However, if I add "import libsumo as traci", this subscription code seems 
to only subscribe to the last four variables and outputs as follows:
veh_sub: {64: 10.471565467228892, 79: 'cv', 81: '-E2_0', 140: 
0.9248398121720126}
The values of "tc.VAR_NEXT_TLS" are missing.
I have read the Libsumo documentation and noticed that subscriptions 
require additional arguments. I'd like to know if this is the problem and 
how to fix it.
 
By the way, I use Python 3.9 and Sumo 1.18.0.
 
Best regards,
Tianjia 

_______________________________________________
sumo-user mailing list
sumo-user@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to