Package org.movsim.simulator.roadnetwork

Examples of org.movsim.simulator.roadnetwork.LaneSegment.type()


            // the vehicle is in the exit road segment, but not in the exit lane
            // react to vehicle ahead in exit lane
            // TODO this reaction is in same situations too short-sighted so that the vehicle in the exit lane must be
            // considered already in the upstream segment
            final LaneSegment exitLaneSegment = roadSegment.laneSegment(roadSegment.trafficLaneMax());
            if (exitLaneSegment != null && exitLaneSegment.type() == Lanes.Type.EXIT) {
                // this front vehicle could also result in negative net distances
                // but the deceleration is limited anyway
                Vehicle frontVehicle = exitLaneSegment.frontVehicle(this);
                double accToVehicleInExitLane = longitudinalModel.calcAcc(this, frontVehicle);
                final double decelLimit = 4.0;
View Full Code Here


        double prospectiveBalance = -Double.MAX_VALUE;
        final int currentLane = me.lane();
        final int newLane = currentLane + direction;
        assert newLane >= Lanes.MOST_INNER_LANE && newLane <= roadSegment.laneCount();
        final LaneSegment newLaneSegment = roadSegment.laneSegment(newLane);
        if (newLaneSegment.type() == Lanes.Type.ENTRANCE) {
            // never change lane into an entrance lane
            return prospectiveBalance;
        }

        final Vehicle newFront = newLaneSegment.frontVehicle(me);
View Full Code Here

        double accToLeft = -Double.MAX_VALUE;
        double accToRight = -Double.MAX_VALUE;
        // consider lane-changing to right-hand side lane
        if (currentLane + Lanes.TO_RIGHT <= roadSegment.trafficLaneMax()) {
            final LaneSegment newLaneSegment = roadSegment.laneSegment(currentLane + Lanes.TO_RIGHT);
            if (newLaneSegment.type() == Lanes.Type.TRAFFIC) {
                // only consider lane changes into traffic lanes, other lane changes are handled by mandatory lane
                // changing
                accToRight = lcModelMOBIL.calcAccelerationBalance(me, Lanes.TO_RIGHT, roadSegment);
            }
        }
View Full Code Here

        }

        // consider lane-changing to left-hand side lane
        if (currentLane + Lanes.TO_LEFT >= Lanes.MOST_INNER_LANE) {
            final LaneSegment newLaneSegment = roadSegment.laneSegment(currentLane + Lanes.TO_LEFT);
            if (newLaneSegment.type() == Lanes.Type.TRAFFIC) {
                // only consider lane changes into traffic lanes, other lane changes are handled by mandatory lane
                // changing
                accToLeft = lcModelMOBIL.calcAccelerationBalance(me, Lanes.TO_LEFT, roadSegment);
            }
        }
View Full Code Here

    private LaneChangeDecision checkForMandatoryLaneChangeAtEntrance(RoadSegment roadSegment) {
        final int currentLane = me.lane();
        final LaneSegment currentLaneSegment = roadSegment.laneSegment(currentLane);

        if (currentLaneSegment.type() == Lanes.Type.ENTRANCE) {
            final int direction = (currentLane == roadSegment.laneCount()) ? Lanes.TO_LEFT : Lanes.TO_RIGHT;
            if (currentLane + direction >= Lanes.MOST_INNER_LANE) {
                final LaneSegment newLaneSegment = roadSegment.laneSegment(currentLane + direction);
                if (isSafeLaneChange(newLaneSegment)) {
                    double distanceToRoadSegmentEnd = me.getDistanceToRoadSegmentEnd();
View Full Code Here

                                    me.getRelSpeed(frontVehicle), accToFront));
                }
                final int newLane = currentLane + Lanes.TO_LEFT;
                final LaneSegment newLaneSegment = roadSegment.laneSegment(newLane);

                if (newLaneSegment.type() == Lanes.Type.ENTRANCE) {
                    // never change lane into an entrance lane
                    return LaneChangeDecision.NONE;
                }
                final Vehicle newFront = newLaneSegment.frontVehicle(me);
                if (newFront != null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.