Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Printing an element from the function getStops

Hello everyone

 

I have two buses using one route and I am trying to make sure that they do not bunch together as seen below:

 

In order to this, I am trying to have the follower bus (Bus 3) detect when it is a bus stop way from the leader bus (Bus 4). Once it detects the leader bus, the Bus 3 will hold at its current bus stop position for a specific duration until enough headway is between the two buses.

 

I am using the traci.vehicle.getStops() method in order to detect the Bus 4 one stop ahead. I understand that the output of this method is StopData() that seems to be in a non-subscriptable format. Is there any way that I can get the element of the data type StopData() printed or input into another argument or variable in Python? I was trying to see if I could take the element “lane” out StopData() data type and put into the print command, but I got the error: TypeError: 'StopData' object is not subscriptable. For reference, I have placed a screenshot of my code and error message I kept receiving in the command line when ran TraCI.

 

An Ink Drawing

 

Thank you in advance for the help

Ifezue

 

Sent from Mail for Windows

 


Back to the top