Skip to main content

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

you can access the lane directly with StopDataObject.lane. See https://github.com/eclipse/sumo/blob/67d2c4b37042d8fd3e8da6e7f013dd6696b5d6da/tools/traci/_vehicle.py#L35-L69

Am Mi., 20. Okt. 2021 um 03:04 Uhr schrieb vincentobiako <vincentobiako@xxxxxxxxx>:

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

 

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

Back to the top