Hi, you can of course place the stop as close to the end as possible and you can also calculate the braking distance in advance from the current speed and the deceleration (at least approximately because the general formula s=v^2/b does not take discretization effects into account).
Best regards, Michael 2014/1/9 Simone Rondelli <[email protected]>: > Hi Michael, > > I resolved my issue. The problem is that you have to specify a lane position > where you want to stop and, if the vehicle speed is too high, the vehicle > cannot stop and traci returns an error... After i've tried one million of > times, with dfferent speed and different position the only way that i've > found to stop and parking the vehicle i to set the speed to 1 and send the > command for parking 5 meters ahead of my position.. > > I'm using Veins so my code is this: > > //if i were in road where i want to parking > if (traci->getRoadId() == myRoadId) { > double speed = round(traci->getSpeed()); > if (speed > 1.0) { > traci->commandSlowDown(1.0, 100); > } else if (speed <= 1.0) { > traci->commandStopNode(myRoadId, //Road where i want to parking > > traci->commandGetLanePosition() + 5, //position along the lane > 0, //lane id > 0.0, //stop time (0 because i > set the vehile parked) > PARKING_STOP); //kind of stop > } > } > > SO this function is called by veins every 0.1 seconds... I call > commandSlowDown until the speed of the vehicle drops to 1. when the speed is > 1 i park 5 meters ahead so i'm sure that the vehicle stops. > > There is a more elegant way to do this.. For exaple for sayng "stop in this > road" without position problem? If not i hope that this code can help > someone else! > > Kind Regards, > Simone Rondelli. > > 2014/1/9 Michael Behrisch <[email protected]> >> >> Michael > > > > > > -- > Simone Rondelli ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ sumo-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sumo-user
