Dear sumo users,

How  can I verify that vehicles are crossed a traffic light or not ?

In fact, I developed this code;

 verifyPassage(std::string tlsID)
{
    bool passage;
    double p=0;
    std::vector<std::vector<libsumo::TraCILink>> ctrlLink;

    ctrlLink=
vehicle->getLiteAPI().trafficlights().getControlledLinks(tlsID);
    std::string
laneId=vehicle->getLiteAPI().vehicle().getLaneID(vehicle->getVehicleId());

if(tlsIndex==1){
    for (int i=0; i <  ctrlLink.size(); ++i)
    {
      for (int j=0; j <  ctrlLink[i].size(); ++j)
      {
        if (ctrlLink[i][j].to == laneId) {
            passage=true;
            p=1;
            p_vec.record(p);
            return passage;
         }
        else
        {
          passage=false;
          p=2;
          p_vec.record(p);
          return passage;
        }
    }
}
}
}

But it always return false. How can I rectify it ?  I have dificulties to
understand getControlledLink() code  ??

Best regards,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sumo-user mailing list
sumo-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sumo-user

Reply via email to