Hello,
You can use traci.vehicle.getNextTLS(). As soon as the tls is no longer in
the returned list of upcoming traffic lights, you can be sure that it has
been passed.
regards,
Jakob

2018-04-11 13:27 GMT+02:00 Mouna Karoui via sumo-user <
[email protected]>:

> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sumo-user
> _______________________________________________
> sumo-user mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/sumo-user
>
_______________________________________________
sumo-user mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/sumo-user

Reply via email to