[1] I am trying to assign a new route to a vehicle using TraCE Command Interface::Vehicle::change Vehicle Route(const std::list<std::string>& edges)
but nothing is happening.
I am getting the current route and ['6/7to6/6', '6/6to5/6', '5/6to4/6', '4/6to3/6', '3/6to3/7', '3/7to3/8', '3/8to3/9', '3/9to2/9', '2/9to2/8'] calculate the new and send ['6/7to6/6', '6/6to5/6', '5/6to4/6', '4/6to3/6', '3/6to2/6', '2/6to2/7', '2/7to2/8', '2/8to3/8', '3/8to3/9', '3/9to2/9', '2/9to2/8'].
but the changeVehicleRoute(edges)
return 0, so the new route is not assigned.
A slice of my code is below. Can someone help me?
More questions,
[2] If my current route is [a , b, c, d, e, f]
and the vehicle is current in c
such that when I calculate the new route [a,b,c,H,I,f]
, I can assign all routes [a,b,c,H,I,f]
or only the rest of them [c,H,I,f]
?
[3] If I put only the rest this, it will be influenced in SUMO statistics of route Length, distance, Fuel...?
rot.h
TraCIMobility* mobility;
TraCICommandInterface* traci;
TraCICommandInterface::Vehicle* traciVehicle;
...
rot.cc
initialize(int stage){
...
mobility = TraCIMobilityAccess().get(getParentModule());
assert(mobility);
traci = mobility->getCommandInterface();
traciVehicle = mobility->getVehicleCommandInterface();
...
}
...
reroute(std::list<std::string> rList){
bool rota;
rota = traciVehicle->changeVehicleRoute(rList);
std::cout << rota << findHost()->getFullName() << std::endl;
}