Package org.movsim.simulator.trafficlights

Examples of org.movsim.simulator.trafficlights.TrafficLightLocation


                Controller controller = signalIdsToController.get(signal.getId());
                if (controller == null) {
                    throw new IllegalArgumentException("trafficlight signal with id=" + signal.getId()
                            + " is not referenced in xodr <controller> definition.");
                }
                roadSegment.addTrafficLightLocation(new TrafficLightLocation(signal, controller));
            }
        }

        if (road.isSetObjects()) {
            for (OpenDRIVE.Road.Objects.Tunnel tunnel : road.getObjects().getTunnel()) {
View Full Code Here


    }

    // TODO profiling ... lookup done quite often even w/o any trafficlights
    public TrafficLightLocationWithDistance getNextDownstreamTrafficLight(double position, int lane,
            double maxLookAheadDistance) {
        TrafficLightLocation trafficLightLocation = getNextDownstreamTrafficLight(position);
        double distance = (trafficLightLocation != null) ? trafficLightLocation.position() - position : roadLength
                - position;
        RoadSegment segment = this;
        while (trafficLightLocation == null && distance < maxLookAheadDistance) {
            segment = segment.sinkRoadSegment(Math.min(lane, segment.laneCount));
            if (segment == null) {
                break;
            }
            trafficLightLocation = segment.getNextDownstreamTrafficLight(0);
            distance += (trafficLightLocation != null) ? trafficLightLocation.position() : segment.roadLength();
        }
        return trafficLightLocation == null ? null : new TrafficLightLocationWithDistance(trafficLightLocation,
                distance);
    }
View Full Code Here

TOP

Related Classes of org.movsim.simulator.trafficlights.TrafficLightLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.