Hi Thais, Please note that the subscription filters only work for the latest development version (i.e., downloaded from http://sumo.dlr.de/wiki/Downloads#Nightly_Snapshots).
If you have problems with that newest version please send a runnable failing example. Thanks, Leo Von: sumo-user-boun...@eclipse.org [mailto:sumo-user-boun...@eclipse.org] Im Auftrag von Thais Araújo Gesendet: Samstag, 10. November 2018 16:39 An: sumo-user@eclipse.org Betreff: [sumo-user] problem using subscribeContext Good afternoon, I have been trying to retrieve values via context subscription with no success. Here are some of the links I visited: http://sumo.sourceforge.net/userdoc/TraCI.html where there is this Code snippet: for veh_id in traci.simulation.getDepartedIDList(): traci.vehicle.subscribe(veh_id, [traci.constants.VAR_POSITION]) positions = traci.vehicle.getSubscriptionResults() This works perfectly and my simulation Exits cleanly. Then I tried subscribe context, as decribed in http://sumo.sourceforge.net/userdoc/TraCI/Interfacing_TraCI_from_Python.html traci.junction.subscribeContext(junctionID, tc.CMD_GET_VEHICLE_VARIABLE, 42, [tc.VAR_SPEED, tc.VAR_WAITING_TIME]) print(traci.junction.getContextSubscriptionResults(junctionID)) while k == 0 or traci.simulation.getMinExpectedNumber() > 0: ... k += 1 traci.simulationStep() print(traci.junction.getContextSubscriptionResults(junctionID)) traci.close() Junction subscription also works. But what I am interested at is actually the vehicle context subscription, and this one does not work. I have tried this Code snippet: while k == 0 or traci.simulation.getMinExpectedNumber() > 0: ... for veh_id in traci.simulation.getDepartedIDList(): traci.vehicle.subscribeContext(str(veh_id), tc.CMD_GET_VEHICLE_VARIABLE, 0.0, [tc.VAR_SPEED]) traci.vehicle.addSubscriptionFilterLanes([-1,0,1], noOpposite=True, downstreamDist=100, upstreamDist=50) print traci.vehicle.getContextSubscriptionResults(str(veh_id)) k += 1 traci.simulationStep() traci.close() I get the following error: raceback (most recent call last): File "C:/Users/gama_/LRZ Sync+Share/semester_3/Study_project/Interstate80/I80_runner.py", line 88, in <module> traci.vehicle.addSubscriptionFilterLanes([-1,0,1], noOpposite=True, downstreamDist=100, upstreamDist=50) TypeError: addSubscriptionFilterLanes() got an unexpected keyword argument 'noOpposite' Then, if I just leave the lane Parameter, and delete from noOpposit on, like this: for veh_id in traci.simulation.getDepartedIDList(): traci.vehicle.subscribeContext(str(veh_id), tc.CMD_GET_VEHICLE_VARIABLE, 100.0, [tc.VAR_SPEED]) traci.vehicle.addSubscriptionFilterLanes([-1,0,1]) print traci.vehicle.getContextSubscriptionResults(str(veh_id)) I can get some results, but they don't seem to be filtered neither by neighbouring lanes, nor by the same lane the vehicle is at. And the Simulation also does not Exit cleanly. This is the error I get in this case: Traceback (most recent call last): File "C:/Users/gama_/LRZ Sync+Share/semester_3/Study_project/Interstate80/I80_runner.py", line 100, in <module> traci.simulationStep() File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\__init__.py", line 127, in simulationStep responses = _connections[""].simulationStep(step) File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\connection.py", line 323, in simulationStep result = self._sendExact() File "C:\Program Files (x86)\Eclipse\Sumo\tools\traci\connection.py", line 99, in _sendExact raise FatalTraCIError("connection closed by SUMO") traci.exceptions.FatalTraCIError: connection closed by SUMO Process finished with exit code 1 Could anyone please help? Thank you in Advance, Thais Gesendet von Mail<https://go.microsoft.com/fwlink/?LinkId=550986> für Windows 10
_______________________________________________ sumo-user mailing list sumo-user@eclipse.org To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user