eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.58k stars 1.44k forks source link

Pedestrian Interaction with (Autonomous) Vehicles #7717

Open M-Colley opened 4 years ago

M-Colley commented 4 years ago

According to the documentation,

A pedestrian wishing to cross the street at an uncontrolled intersection can only do so if its expected time slot for using the intersection does not interfere with that of an approaching vehicle.

Further:

In the simulation, pedestrians will only use such a crossing if the whole length of the crossing is free of vehicles for the whole time needed to cross.

Would it also be possible to add a pedestrian model that tries to interact with a driver/vehicle and, therefore, vehicles will stop to let the pedestrian cross? This could be based on some probability or, for autonomous vehicles, be ensured (probability = 1). This probability should be adjustable for autonomous vehicles.

In general, making the pedestrian model more customizable would be very nice. For example, research indicates that there are numerous factors influencing crossing decisions (see Rasouli and Tsotsos). These include distance, shape of the vehicle, velocity, and in the future, also probably the autonomy (see Millard-Ball and Ackermans et al.) as well as external communication of autonomous vehicles. With such flexibility, the impact of realistic pedestrian flow can be studied, even when autonomous vehicles are included.

Enabling this would make crossings at unsignalized streets in densely crowded cities, pedestrian areas, but also in general, more realistic (see Hong Kong or Singapore).

namdre commented 4 years ago

The vType attributes jmIngoreFoeProb and jmIgnoreFoeSpeed can already be used to make pedestrians cross at an unprioritized crossing despite oncoming vehicles. See https://sumo.dlr.de/docs/Definition_of_Vehicles,_Vehicle_Types,_and_Routes.html#junction_model_parameters

M-Colley commented 4 years ago

Interesting, thank you for the clarification.

Would it be possible to split jmIgnoreFoeProb for pedestrians, vehicles, and even autonomous vehicles as I am only interested in pedestrians ignoring rules? Additionally, it would be really great to make this dependent on whether a manually driven vehicle or an autonomous vehicle approaches.

Again, this need is based on the work by Millard-ball and Ackermans et al. that argue that pedestrian behavior will alter for autonomous vehicles compared to manually driven vehicles and there will, probably, be a longer period of mixed traffic.

namdre commented 4 years ago

jmIgnoreFoeProb is set per vType (persons also have a vType). This means different vehicles and persons can use different values.

M-Colley commented 4 years ago

Thanks, but this is probably then set for the pedestrian without accounting what kind of vehicle is approaching, right?

For example: Person A has the probability to cross of 0.8, then Person A will cross in front of any vehicle with the probability of 0.8. It would be awesome to be able to define that for a Vehicle (type) A, the probability is 0.8, and for Vehicle B only 0.1.

namdre commented 4 years ago

Yes. Setting a probability to step in front of a vehicle based on the type of that vehicle would be a novel feature.

M-Colley commented 4 years ago

Okay, will you consider implementing such a feature?

I understand that you will have a lot of other work to do, so I am just curious how the process would be here :)

namdre commented 4 years ago

I will consider implementing it but since it would be one of 1579 open issues you are better served by obtaining the desired functionality via TraCI: For each pedestrian, check the oncoming vehicles and then you compute whether to walk or stop (eventually setting jmIgnoreFoeProb=0 or =1)

OrionZou commented 4 years ago

use sumo1.60. When the vehcle enters the crosswalk, the pedestrian will stop waiting for the vehcle to pass. I don't want the pedestrian to stop. for vehcle and pedestrian, I set jmIgnoreFoeSpeed 100, a high speed, and set jmIngoreFoeProb 0 or 1.However, the pedestrian also stop for the vehcle to pass. what should I do?

namdre commented 4 years ago

There is currently no option that would make the pedestrians model walk into an obstacle by itself. The only way to get this behavior is to forcefully place the pedestrian in an obstacle using traci.person.moveToXY.

OrionZou commented 4 years ago

Thank you very much, I will try your suggestions. It needs to be explained is that :when a car passes behind a pedestrian in an crosswalk, the pedestrian will still stop. Is this the same reason as you mentioned?

namdre commented 4 years ago

No. That sounds like a bug. The person should only stop walking while on the crossing if the car is actually in it's way. Please provide a minimal example to reproduce this.

OrionZou commented 4 years ago

File1: exp.sumocfg

File2: new_cross3.net.xml <?xml version="1.0" encoding="UTF-8"?>

File3: routes.rou.xml

File4: demo.py import traci from sumolib import checkBinary import time

if name == 'main': path = './exp.sumocfg' sumoBinary = checkBinary('sumo-gui') cmd = [sumoBinary, "-c", path] traci.start(cmd) ved_id = None while True: traci.simulationStep() if len(traci.vehicle.getIDList()) > 0: ved_id = traci.vehicle.getIDList()[0] traci.vehicle.setSpeedMode(ved_id, sm=0) traci.vehicle.setSpeed(ved_id, 6)

traci.vehicle.setLaneChangeMode(ved_id,lcm=0)

        traci.simulationStep()
        break
i = 0
while True:
    i += 1
    traci.simulationStep()
    time.sleep(0.1)
    if (i >= 78) and (i <= 82):
        print('pf1_.1 stopped')
    print(i)
OrionZou commented 4 years ago

File1's code view has problem, so I send a picture about it QQ图片20201124193355

OrionZou commented 4 years ago

In fact, I set traci.vehicle.setSpeedMode(self.curr_vehicle_id, sm=0), then when the vehcle enters the crossing and the pedestrian is very close to the vehcle, the pedestrian will stop, even if the pedestrian is in front of the car! the pedestrian is too stupid

namdre commented 4 years ago

You can zip your files and attach the zip. That would be much easier.

namdre commented 4 years ago

Note, I do not intend to re-type your file contents based on a screenshot. Please attach a zip file with the xml files.

OrionZou commented 4 years ago

Sorry, here is the .zip mini-sumo.zip

OrionZou commented 4 years ago

notice that path = './exp.sumocfg' in demo.py need to be insted of your file path.

namdre commented 4 years ago

I can confirm your bug: #7853 Some unrelated pointers for your example network:

OrionZou commented 4 years ago

Thank for your confirm ang your opinions. I am trying to use traci.person.moveToXY to achieve my requirement and I found:

I use traci.person.moveToXY. After a pedestrian have walked one edge, he cannot enter the next edge. Could you have a goo solution? Is there a good way to judge that the pedestrian has completed the current edge and needs to move to the next edge?

namdre commented 4 years ago

Make sure that the pedestrian has a complete route. Moving it to an edge not on it's route will set a new route that consists of a single edge. You can check/change the route with getStage and replaceStage.

OrionZou commented 4 years ago

I think I set a complete route, but the pedestrian is stuck on the edge of the crosswalk and cannot complete the route. Could you please help me look at the code? Thank you very much! I re-uploaded the code due to a careless bug mini-sumo-v3.zip

M-Colley commented 3 years ago

I will consider implementing it but since it would be one of 1579 open issues you are better served by obtaining the desired functionality via TraCI: For each pedestrian, check the oncoming vehicles and then you compute whether to walk or stop (eventually setting jmIgnoreFoeProb=0 or =1)

Hey, so I've looked at the documentation and wanted to ask, regarding the implementation, whether there is a function to get all oncoming vehicles or whether I will have to get all vehicles and then check "manually" whether they are near the pedestrian? This could be a problem when they are, say, 30 m away but there is a parallel street or a junction with other vehicles.

namdre commented 3 years ago

Hey, so I've looked at the documentation and wanted to ask, regarding the implementation, whether there is a function to get all oncoming vehicles or whether I will have to get all vehicles and then check "manually" whether they are near the pedestrian? This could be a problem when they are, say, 30 m away but there is a parallel street or a junction with other vehicles.

you can call traci.lane.getFoes(person.getLaneID(personID), person.getNextEdge(personID) + "_0") to get the lanes that need to be checked for incoming vehicles. If that call returns nothing, reverse the arguments (happens if the person is walking against the natural direction of the edge).

namdre commented 3 years ago

I think I set a complete route, but the pedestrian is stuck on the edge of the crosswalk and cannot complete the route. Could you please help me look at the code? Thank you very much! I re-uploaded the code due to a careless bug mini-sumo-v3.zip

This was a bug: https://github.com/eclipse/sumo/issues/7907

RickRocher commented 3 years ago

I also think that the interaction between vehicle (per type - autonomous vs manual) and pedestrians should be more customizable. This would be a great feature and would help to plan pedestrian flow for the future.

Thanks for considering!

namdre commented 2 years ago

for reference, some of the desired functionality may be achieved via https://sumo.dlr.de/docs/Definition_of_Vehicles%2C_Vehicle_Types%2C_and_Routes.html#transient_parameters