Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Jaywalking

Hi Michael, thank you so much for your responses!

I am now stuck on only one issue...

1) [Opposite sidewalks]

I've rebuilt the network with --opposites.guess, and in the network file I can see the "neigh" annotations you mentioned. For example:

<edge id="CE" from="C" to="E" priority="1">
        <lane id="CE_0" index="0" allow="pedestrian" speed="13.89" length="97.00" width="2.00" shape="103.00,42.35 200.00,42.35"/>
        <lane id="CE_1" index="1" disallow="pedestrian" speed="13.89" length="97.00" shape="103.00,45.05 200.00,45.05"/>
        <lane id="CE_2" index="2" disallow="pedestrian" speed="13.89" length="97.00" shape="103.00,48.35 200.00,48.35">
            <neigh lane="EC_2"/>
        </lane>
    </edge>
    <edge id="EC" from="E" to="C" priority="1">
        <lane id="EC_0" index="0" allow="pedestrian" speed="13.89" length="97.00" width="2.00" shape="200.00,57.65 103.00,57.65"/>
        <lane id="EC_1" index="1" disallow="pedestrian" speed="13.89" length="97.00" shape="200.00,54.95 103.00,54.95"/>
        <lane id="EC_2" index="2" disallow="pedestrian" speed="13.89" length="97.00" shape="200.00,51.65 103.00,51.65">
            <neigh lane="CE_2"/>
        </lane>
    </edge>

Hooray!

However, I have been unable to figure out how to access these neighbors from either traci or sumolib:

net = sumolib.net.readNet(net_file)
# ...
ped_road = traci.person.getRoadID(ped_id)
try:
    edge = net.getEdge(ped_road)
except KeyError:
    edge = None
if edge is not None: 
    inner_lane = edge.getLane(edge.getLaneNumber() - 1)

At this point I can't actually figure out how to access the "neigh" attribute. Reading through the NetReader class in sumolib/net/__init__.py, it seems that the attribute is not actually read in by sumolib..?

Thank you!
Yokhanan


-----Original Message-----
From: Michael Behrisch [mailto:oss@xxxxxxxxxxx] 
Sent: Thursday, January 25, 2018 2:49 AM
To: Sumo project User discussions <sumo-user@xxxxxxxxxxx>; Beck, Yokhanan Z. <Yokhanan.Beck@xxxxxxxxxxxxxxx>
Subject: Re: [sumo-user] Jaywalking

Hi Yokhanan,
for the answers see below

Am 23.01.2018 um 19:07 schrieb Beck, Yokhanan Z.:
> 1) There does not seem to be a way to get the opposite sidewalk on a 
> given street, if it exists. Currently I’ve just got a big lookup table 
> I built myself, but I’d rather automate this. Most recently I’ve tried 
> building a table at the beginning of the simulation by finding the 
> edge which runs in the opposite direction for each road, and checking 
> if they each have a “pedestrian” only lane. However, there seems to be 
> no way to find the opposite direction road via TraCI! I can’t even 
> find which junctions are connected via which edges, or which edges 
> connect to which junctions. Am I missing something in the TraCI 
> commands, or is there really no way to “traverse” the network graph via TraCI?

The concept of an opposite edge is not really well defined in every case and it is not needed for the simulation that's why it is currently not modelled. The only exception is when you want to model overtaking over the opposite lane. If you do this you need to rebuild your network with --opposites.guess which will annotate the leftmost lane of every edge for which an opposite one could be found with a "neigh" element mentioning the neighboring lane on the opposite side.

We try to limit TraCI to the dynamic parts of the simulation and access the static parts such as the network graph via sumolib (which is available for Python and Matlab at least). One reason is simply technical (it is much harder to implement and maintain a TraCI function than a simple XML parsing), the other is performance, the user should not overload the script with TraCI calls which are unnecessary because the values in question do not need a running simulation.

> 2) Likewise, there does not seem to be a way to get the end position 
> of a pedestrian along its stage list – you can simply get the final edge.
> But as for where along that edge it is going, TraCI does not provide a 
> way to access that. Is this correct, or is there something I’m missing?

This is correct, it is simply not implemented (there is no getArrivalPos for the vehicle as well), I opened a ticket
https://github.com/DLR-TS/sumo/issues/3780

> 3) Also, when my new vClass=”pedestrian” pedestrians cross the road, 
> they look like cars. Is there a way to adjust this so that they look 
> like pedestrians and use their bounding box for collisions? Currently 
> I create these new “pedestrians” in this way:

You can define the shape and the extensions of the "vehicle" when defining the type, see http://sumo.dlr.de/wiki/Definition_of_Vehicles,_Vehicle_Types,_and_Routes#Vehicle_Types
The easiest way is probably to define the type once (in XML) and then use it in the call like traci.vehicle.addFull(vehID, routeID, typeID).

> 4) The answer to (1) above will likely also be helpful for this 
> question. I want the pedestrians to “look both ways” before crossing 
> the street – in other words, I want them to get access to all cars 
> along the road they want to cross, within some certain distance, and 
> decide whether to cross. I presume this means I will need to 
> “traverse” the network like in (1). Is there another way of accomplishing this?

You could try context subscriptions which will give you every car in a given range but you would still need to find out whether they are on the road ahead, so probaly there is no other way than the one you mentioned.

> 5) The cars on the road seem to react to my new “pedestrians” as they 
> cross the road by slowing down, changing lanes, and even stopping for 
> them. However, these behaviors are only triggered by “pedestrians” who 
> are immediately in front of them. They do not begin slowing down, for 
> example, until the person is in their lane. However, “in real life” 
> the car would usually see them walking toward their lane, and 
> anticipate them entering it. One way I can handle this is by having 
> the “pedestrians” keep track of the incoming cars (as in (4)), and 
> then I can adjust those cars’ behaviors according to the geometry. Is 
> there a better way of accomplishing this? In other words, is there a 
> way for each vehicle to “look around” for other incoming “traffic” 
> instead of just directly in front of themselves?

Theoretically your "vehicle" could indicate that it wants to change lanes urgently and then the others would react. But currently this is not accessible via TraCI and would also not work for the opposite edge.
In general SUMO's vehicles are poor in anticipation and usually only do car following which is what you described.

Best regards,
Michael

PS: If you feel like implementing one of the missing features above, we are happily accepting patches / pull requests :-)


Back to the top