2

I am implementing an Accident Avoidance scheme in Veins. I modified the TracIDemo11p.cc and changed the onData function as following -

void TraCIDemo11p::onData(WaveShortMessage* wsm) {
    findHost()->getDisplayString().updateWith("r=16,green");
    annotations->scheduleErase(1, annotations->drawLine(wsm->getSenderPos(), traci->getPositionAt(simTime()), "blue"));
    if (!sentMessage)
    {
        traci->commandSlowDown(0.0,4);  //speed changes smoothly to 0 in 4sec
        sendMessage(wsm->getWsmData());
    }
}

I want the vehicles to decelerate and stop in 4 sec after receiving the message. But this thing is not happening. When accident occurs the first vehicle brakes immediately and the remaining vehicles stop as usual. Where am I going wrong? Please suggest.

2 Answers2

1

As I wrote on the mailing list; I think that the cause of your problem is that SUMO automatically simulates the response of drivers to accidents or obstacles. If drivers see an accident, their response is to break with a specific pattern. SUMO is developed by the traffic science community to reflect this behavior with some degree of realism.

As far as I know, the commandSlowDown is intended as an additional feature, for example when you want to simulate vehicles slowing down for other reasons that SUMO does not simulate. In particular, you could use to slow down when you receive information about an accident that is further away (e.g., over multiple hops). I suspect that might be what you're trying to achieve, so are you sure that the other vehicles are receiving the message too?

  • Yes, the messages is received by all the vehicles because the Veins tutorial has the code to broadcast the messages over the entire platoon of vehicles and the vehicles in response change their routes. Similarly, I want to change the response as emergency braking instead of changing route. Where should I make the change? – Rohan Patil Mar 14 '16 at 11:37
  • I'm not sure what you mean. If you want to disable or change the emergency breaking behavior of SUMO, you should probably ask your question on the SUMO mailing list -- unfortunately I'm not familiar enough with SUMO to suggest a good way to deal with what you're trying to do. Alternatively you might want to look at Michele Segeta's [plexe](http://plexe.car2x.org/) work, which deals with platooning (and probably had similar problems). – Rens van der Heijden Mar 14 '16 at 13:02
0

The accident avoidance behavior overrides TraCI commands by default. You need to enable unsafe driving explicitly using the 'speed mode' command. See http://sumo.dlr.de/wiki/TraCI/Change_Vehicle_State#speed_mode_.280xb3.29

Jakob Erdmann
  • 190
  • 1
  • 7