Hi Giuliana Thank you for your response and sorry for the delay of my reply
I built a simple test case to illustrate the current problem (example.py) In the example, these variables are tested and the problem only occurs when including 'VAR_LEADER', 'VAR_SECURE_GAP' or both vehicle_variables_to_subscribe = [ 'VAR_SPEED', 'VAR_WAITING_TIME', #'VAR_LEADER', # Problems with subscription #'VAR_SECURE_GAP', # Problems with subscription ] The response error is the following "Error: Storage::readChar(): invalid positioncles TOT 1 ACT 1 BUF 0)" Sincerely, Marcelo d'Almeida On Sat, Sep 19, 2020 at 8:39 PM <[email protected]> wrote: > Hi Marcelo, > > > > I will copy Jakob's answer to someone who had a similar problem a few days > ago. Maybe it will help you J > > > > “The _socket gets removed in either of two cases: > > - after calling traci.close() > > - after receiving a FatalTraCIError "connection closed by SUMO" which can > happen if the input data to sumo is faulty or sumo has crashed > > If it happens to be the latter with the latest sumo release (1.7.0), > please try to boil down your code to a simple test case and provide the > necessary files for reproducing the crash.” > > > > Regards, > > Giuliana > > > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Marcelo Andrade Rodrigues D > Almeida > *Sent:* Samstag, 19. September 2020 21:10 > *To:* Sumo project User discussions > *Subject:* [sumo-user] 'Extended retrieval messages' info subscription > > > > Hi everyone > > > > How can I subscribe to retrieve 'Extended retrieval messages' information > (e.g. vehicle leader and secureGap) > > > > Everytime I include these I receive the following error message > > > > [...] > > #"VAR_LEADER", > #"VAR_SECURE_GAP", > > [...] > > > > "Traceback (most recent call last): > File "<string>", line 1, in <module> > File "/usr/share/sumo/tools/traci/domain.py", line 208, in subscribe > self._connection._subscribe(self._subscribeID, begin, end, objectID, > varIDs) > File "/usr/share/sumo/tools/traci/connection.py", line 231, in _subscribe > result = self._sendCmd(cmdID, (begin, end), objID, format, *args) > File "/usr/share/sumo/tools/traci/connection.py", line 178, in _sendCmd > return self._sendExact() > File "/usr/share/sumo/tools/traci/connection.py", line 83, in _sendExact > self._socket.send(length + self._string) > AttributeError: 'Connection' object has no attribute '_socket' > > " > > > > Thank you in advance > > > > Sincerely, > > > > Marcelo d'Almeida > _______________________________________________ > sumo-user mailing list > [email protected] > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/sumo-user >
<<attachment: temp.zip>>
import os
import sys
if 'SUMO_HOME' in os.environ:
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
sys.path.append(tools)
else:
sys.exit("please declare environment variable 'SUMO_HOME'")
import traci
import traci.constants as tc
from sumolib import checkBinary
from os.path import expanduser
def get_sumo_binary(gui=False):
if gui:
sumo_binary = checkBinary('sumo-gui')
else:
sumo_binary = checkBinary('sumo')
return sumo_binary
class Example:
def __init__(self, net_file, route_file, vehicle_variables_to_subscribe):
self.net_file = net_file
self.route_file = route_file
self.vehicle_variables_to_subscribe = vehicle_variables_to_subscribe
self.current_step_vehicle_subscription_data = None
self.previous_step_vehicle_subscription_data = None
self.current_step_vehicles = []
self.previous_step_vehicles = []
def _update_previous_measurements(self):
self.previous_step_vehicle_subscription_data = self.current_step_vehicle_subscription_data
self.previous_step_vehicles = self.current_step_vehicles
def _update_current_measurements(self):
# get vehicle list
self.current_step_vehicles = traci.vehicle.getIDList()
new_arrived_vehicles = list(set(self.current_step_vehicles) - set(self.previous_step_vehicles))
# update subscriptions
for vehicle in new_arrived_vehicles:
traci.vehicle.subscribe(vehicle, [getattr(tc, var) for var in self.vehicle_variables_to_subscribe])
# vehicle level observations
self.current_step_vehicle_subscription_data = {vehicle: traci.vehicle.getSubscriptionResults(vehicle)
for vehicle in self.current_step_vehicles}
def start_traci(self, gui=False):
traci.start([
get_sumo_binary(gui),
'-n', self.net_file,
'-r', self.route_file
])
def run_simulation(self):
while traci.simulation.getMinExpectedNumber() > 0:
self._update_previous_measurements()
traci.simulationStep()
self._update_current_measurements()
home = expanduser("~")
net_file = home + '/temp/regular-intersection__right_on_red.net.xml'
route_file = home + '/temp/regular-intersection.rou.xml'
vehicle_variables_to_subscribe = [
'VAR_SPEED',
'VAR_WAITING_TIME',
#'VAR_LEADER', # Problems with subscription
#'VAR_SECURE_GAP', # Problems with subscription
]
example = Example(net_file, route_file, vehicle_variables_to_subscribe)
example.start_traci()
example.run_simulation()
traci.close()
vehicle_variables_to_subscribe = [
'VAR_SPEED',
'VAR_WAITING_TIME',
'VAR_LEADER', # Problems with subscription
#'VAR_SECURE_GAP', # Problems with subscription
]
example = Example(net_file, route_file, vehicle_variables_to_subscribe)
example.start_traci()
example.run_simulation()
traci.close()
vehicle_variables_to_subscribe = [
'VAR_SPEED',
'VAR_WAITING_TIME',
#'VAR_LEADER', # Problems with subscription
'VAR_SECURE_GAP', # Problems with subscription
]
example = Example(net_file, route_file, vehicle_variables_to_subscribe)
example.start_traci()
example.run_simulation()
traci.close()
_______________________________________________ sumo-user mailing list [email protected] To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
