Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] moveToXY and FatalTraCIError: connection closed by SUMO

Hi all, 

I encountered "connection closed by SUMO" error when using moveToXY. 

My scenario is that ego vehicle is moving on the lateral lane of opposite
direction(edgeID = "2to1") due to lane change resulted from front obstacle.
Now I want it to move back to the perivous lane(edgeID = "1to2") when its
position is 10m ahead of a stopped bus. The code is like this, 

 if lanechanged == True and ego_pos>traci.vehicle.getPosition("bus1")[0]+10: 
            traci.vehicle.moveToXY(vehID = "0", edgeID = "1to2", x =
ego_pos+3, y = 3, lane = 0, keepRoute = 1) 
            print("moved!!!",TIME)   

I got error instantly after running the above piece of code and no error
when I skipped the above code. So I guess something wrong with the moveToXY
part. 

Here is the error. 

FatalTraCIError                           Traceback (most recent call last) 
<ipython-input-26-d250dbde2daa> in <module>() 
     16     print("----start----") 
     17     while traci.simulation.getMinExpectedNumber() > 0 and 
traci.vehicle.getPosition("0")[0]<950: 
---> 18         traci.simulationStep() 
     19         ego_speed = traci.vehicle.getSpeed("0") 
     20         ego_pos = traci.vehicle.getPosition("0")[0] 

E:\_software\SUMO\tools\traci\__init__.py in simulationStep(step) 
    125     """ 
    126     global _stepListeners 
--> 127     responses = _connections[""].simulationStep(step) 
    128 
    129     # manage stepListeners 

E:\_software\SUMO\tools\traci\connection.py in simulationStep(self, step) 
    321         self._queue.append(tc.CMD_SIMSTEP) 
    322         self._string += struct.pack("!BBd", 1 + 1 + 8,
tc.CMD_SIMSTEP, step) 
--> 323         result = self._sendExact() 
    324         for subscriptionResults in
self._subscriptionMapping.values(): 
    325             subscriptionResults.reset() 

E:\_software\SUMO\tools\traci\connection.py in _sendExact(self) 
     97             self._socket.close() 
     98             del self._socket 
---> 99             raise FatalTraCIError("connection closed by SUMO") 
    100         for command in self._queue: 
    101             prefix = result.read("!BBB") 

FatalTraCIError: connection closed by SUMO 


Is this because this kind of movement is invalid in sumo? if so, how can I
move the car back to the perivous lane? 

Thanks in advance!



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/


Back to the top